mirror of https://github.com/ARMmbed/mbed-os.git
Handle undefined DEVICE_SERIAL_FC
parent
c31a360271
commit
e72468c037
|
@ -344,10 +344,14 @@ protected:
|
||||||
bool _tx_enabled;
|
bool _tx_enabled;
|
||||||
const PinName _tx_pin;
|
const PinName _tx_pin;
|
||||||
const PinName _rx_pin;
|
const PinName _rx_pin;
|
||||||
|
|
||||||
|
#if DEVICE_SERIAL_FC
|
||||||
Flow _flow_type;
|
Flow _flow_type;
|
||||||
PinName _flow1;
|
PinName _flow1;
|
||||||
PinName _flow2;
|
PinName _flow2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @}*/
|
/** @}*/
|
||||||
|
|
|
@ -32,13 +32,15 @@ SerialBase::SerialBase(PinName tx, PinName rx, int baud) :
|
||||||
#endif
|
#endif
|
||||||
_serial(),
|
_serial(),
|
||||||
_baud(baud),
|
_baud(baud),
|
||||||
|
#if DEVICE_SERIAL_FC
|
||||||
|
_flow_type(Disabled),
|
||||||
|
_flow1(NC),
|
||||||
|
_flow2(NC),
|
||||||
|
#endif
|
||||||
_rx_enabled(true),
|
_rx_enabled(true),
|
||||||
_tx_enabled(true),
|
_tx_enabled(true),
|
||||||
_tx_pin(tx),
|
_tx_pin(tx),
|
||||||
_rx_pin(rx),
|
_rx_pin(rx)
|
||||||
_flow_type(Disabled),
|
|
||||||
_flow1(NC),
|
|
||||||
_flow2(NC)
|
|
||||||
{
|
{
|
||||||
// No lock needed in the constructor
|
// No lock needed in the constructor
|
||||||
|
|
||||||
|
@ -129,7 +131,9 @@ int SerialBase::_base_putc(int c)
|
||||||
void SerialBase::_init()
|
void SerialBase::_init()
|
||||||
{
|
{
|
||||||
serial_init(&_serial, _tx_pin, _rx_pin);
|
serial_init(&_serial, _tx_pin, _rx_pin);
|
||||||
|
#if DEVICE_SERIAL_FC
|
||||||
set_flow_control(_flow_type, _flow1, _flow2);
|
set_flow_control(_flow_type, _flow1, _flow2);
|
||||||
|
#endif
|
||||||
serial_baud(&_serial, _baud);
|
serial_baud(&_serial, _baud);
|
||||||
serial_irq_handler(&_serial, SerialBase::_irq_handler, (uint32_t)this);
|
serial_irq_handler(&_serial, SerialBase::_irq_handler, (uint32_t)this);
|
||||||
}
|
}
|
||||||
|
@ -254,6 +258,11 @@ SerialBase::~SerialBase()
|
||||||
void SerialBase::set_flow_control(Flow type, PinName flow1, PinName flow2)
|
void SerialBase::set_flow_control(Flow type, PinName flow1, PinName flow2)
|
||||||
{
|
{
|
||||||
lock();
|
lock();
|
||||||
|
|
||||||
|
_flow_type = type;
|
||||||
|
_flow1 = flow1;
|
||||||
|
_flow2 = flow2;
|
||||||
|
|
||||||
FlowControl flow_type = (FlowControl)type;
|
FlowControl flow_type = (FlowControl)type;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case RTS:
|
case RTS:
|
||||||
|
|
|
@ -77,9 +77,6 @@ void UARTSerial::set_format(int bits, Parity parity, int stop_bits)
|
||||||
void UARTSerial::set_flow_control(Flow type, PinName flow1, PinName flow2)
|
void UARTSerial::set_flow_control(Flow type, PinName flow1, PinName flow2)
|
||||||
{
|
{
|
||||||
api_lock();
|
api_lock();
|
||||||
_flow_type = type;
|
|
||||||
_flow1 = flow1;
|
|
||||||
_flow2 = flow2;
|
|
||||||
SerialBase::set_flow_control(type, flow1, flow2);
|
SerialBase::set_flow_control(type, flow1, flow2);
|
||||||
api_unlock();
|
api_unlock();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue