Skip to content

Commit dd70938

Browse files
authored
Merge pull request #11839 from JanneKiiskila/SerialBase-compwarning
SerialBase.h|cpp [-Wreorder] compiler warning fix
2 parents 6e6c7d0 + 916b91f commit dd70938

File tree

2 files changed

+11
-22
lines changed

2 files changed

+11
-22
lines changed

drivers/SerialBase.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -329,26 +329,26 @@ class SerialBase : private NonCopyable<SerialBase> {
329329

330330
#if DEVICE_SERIAL_ASYNCH
331331
CThunk<SerialBase> _thunk_irq;
332-
DMAUsage _tx_usage;
333-
DMAUsage _rx_usage;
332+
DMAUsage _tx_usage = DMA_USAGE_NEVER;
333+
DMAUsage _rx_usage = DMA_USAGE_NEVER;
334334
event_callback_t _tx_callback;
335335
event_callback_t _rx_callback;
336-
bool _tx_asynch_set;
337-
bool _rx_asynch_set;
336+
bool _tx_asynch_set = false;
337+
bool _rx_asynch_set = false;
338338
#endif
339339

340-
serial_t _serial;
340+
serial_t _serial {};
341341
Callback<void()> _irq[IrqCnt];
342342
int _baud;
343-
bool _rx_enabled;
344-
bool _tx_enabled;
343+
bool _rx_enabled = true;
344+
bool _tx_enabled = true;
345345
const PinName _tx_pin;
346346
const PinName _rx_pin;
347347

348348
#if DEVICE_SERIAL_FC
349-
Flow _flow_type;
350-
PinName _flow1;
351-
PinName _flow2;
349+
Flow _flow_type = Disabled;
350+
PinName _flow1 = NC;
351+
PinName _flow2 = NC;
352352
#endif
353353

354354
#endif

drivers/source/SerialBase.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,9 @@ namespace mbed {
2525

2626
SerialBase::SerialBase(PinName tx, PinName rx, int baud) :
2727
#if DEVICE_SERIAL_ASYNCH
28-
_thunk_irq(this), _tx_usage(DMA_USAGE_NEVER),
29-
_rx_usage(DMA_USAGE_NEVER), _tx_callback(NULL),
30-
_rx_callback(NULL), _tx_asynch_set(false),
31-
_rx_asynch_set(false),
28+
_thunk_irq(this),
3229
#endif
33-
_serial(),
3430
_baud(baud),
35-
#if DEVICE_SERIAL_FC
36-
_flow_type(Disabled),
37-
_flow1(NC),
38-
_flow2(NC),
39-
#endif
40-
_rx_enabled(true),
41-
_tx_enabled(true),
4231
_tx_pin(tx),
4332
_rx_pin(rx)
4433
{

0 commit comments

Comments
 (0)