@@ -151,7 +151,9 @@ void SerialBase::_init()
151
151
{
152
152
serial_init (&_serial, _tx_pin, _rx_pin);
153
153
#if DEVICE_SERIAL_FC
154
- set_flow_control (_flow_type, _flow1, _flow2);
154
+ if (_set_flow_control_dp_func) {
155
+ (this ->*_set_flow_control_dp_func)(_flow_type, _flow1, _flow2);
156
+ }
155
157
#endif
156
158
serial_baud (&_serial, _baud);
157
159
serial_irq_handler (&_serial, SerialBase::_irq_handler, (uint32_t )this );
@@ -161,8 +163,8 @@ void SerialBase::_init_direct()
161
163
{
162
164
serial_init_direct (&_serial, _static_pinmap);
163
165
#if DEVICE_SERIAL_FC
164
- if (_static_pinmap_fc) {
165
- set_flow_control (_flow_type, *_static_pinmap_fc);
166
+ if (_static_pinmap_fc && _set_flow_control_dp_func ) {
167
+ ( this ->*_set_flow_control_sp_func) (_flow_type, *_static_pinmap_fc);
166
168
}
167
169
#endif
168
170
serial_baud (&_serial, _baud);
@@ -303,6 +305,7 @@ SerialBase::~SerialBase()
303
305
void SerialBase::set_flow_control (Flow type, PinName flow1, PinName flow2)
304
306
{
305
307
MBED_ASSERT (_static_pinmap == NULL ); // this function must be used when serial object has been created using dynamic pin-map constructor
308
+ _set_flow_control_dp_func = &SerialBase::set_flow_control;
306
309
lock ();
307
310
308
311
_flow_type = type;
@@ -333,6 +336,7 @@ void SerialBase::set_flow_control(Flow type, PinName flow1, PinName flow2)
333
336
void SerialBase::set_flow_control (Flow type, const serial_fc_pinmap_t &static_pinmap)
334
337
{
335
338
MBED_ASSERT (_static_pinmap != NULL ); // this function must be used when serial object has been created using static pin-map constructor
339
+ _set_flow_control_sp_func = &SerialBase::set_flow_control;
336
340
lock ();
337
341
_static_pinmap_fc = &static_pinmap;
338
342
_flow_type = type;
0 commit comments