Skip to content

Commit e72468c

Browse files
author
Sebastian Stockhammer
committed
Handle undefined DEVICE_SERIAL_FC
1 parent c31a360 commit e72468c

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

drivers/SerialBase.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,10 +344,14 @@ class SerialBase : private NonCopyable<SerialBase> {
344344
bool _tx_enabled;
345345
const PinName _tx_pin;
346346
const PinName _rx_pin;
347+
348+
#if DEVICE_SERIAL_FC
347349
Flow _flow_type;
348350
PinName _flow1;
349351
PinName _flow2;
350352
#endif
353+
354+
#endif
351355
};
352356

353357
/** @}*/

drivers/source/SerialBase.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@ SerialBase::SerialBase(PinName tx, PinName rx, int baud) :
3232
#endif
3333
_serial(),
3434
_baud(baud),
35+
#if DEVICE_SERIAL_FC
36+
_flow_type(Disabled),
37+
_flow1(NC),
38+
_flow2(NC),
39+
#endif
3540
_rx_enabled(true),
3641
_tx_enabled(true),
3742
_tx_pin(tx),
38-
_rx_pin(rx),
39-
_flow_type(Disabled),
40-
_flow1(NC),
41-
_flow2(NC)
43+
_rx_pin(rx)
4244
{
4345
// No lock needed in the constructor
4446

@@ -129,7 +131,9 @@ int SerialBase::_base_putc(int c)
129131
void SerialBase::_init()
130132
{
131133
serial_init(&_serial, _tx_pin, _rx_pin);
134+
#if DEVICE_SERIAL_FC
132135
set_flow_control(_flow_type, _flow1, _flow2);
136+
#endif
133137
serial_baud(&_serial, _baud);
134138
serial_irq_handler(&_serial, SerialBase::_irq_handler, (uint32_t)this);
135139
}
@@ -254,6 +258,11 @@ SerialBase::~SerialBase()
254258
void SerialBase::set_flow_control(Flow type, PinName flow1, PinName flow2)
255259
{
256260
lock();
261+
262+
_flow_type = type;
263+
_flow1 = flow1;
264+
_flow2 = flow2;
265+
257266
FlowControl flow_type = (FlowControl)type;
258267
switch (type) {
259268
case RTS:

drivers/source/UARTSerial.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ void UARTSerial::set_format(int bits, Parity parity, int stop_bits)
7777
void UARTSerial::set_flow_control(Flow type, PinName flow1, PinName flow2)
7878
{
7979
api_lock();
80-
_flow_type = type;
81-
_flow1 = flow1;
82-
_flow2 = flow2;
8380
SerialBase::set_flow_control(type, flow1, flow2);
8481
api_unlock();
8582
}

0 commit comments

Comments
 (0)