mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
Diff: targets/TARGET_STM/TARGET_STM32F0/serial_device.c
- Revision:
- 189:f392fc9709a3
- Parent:
- 187:0387e8f68319
diff -r bcfe06ba3d64 -r f392fc9709a3 targets/TARGET_STM/TARGET_STM32F0/serial_device.c --- a/targets/TARGET_STM/TARGET_STM32F0/serial_device.c Thu Nov 08 11:46:34 2018 +0000 +++ b/targets/TARGET_STM/TARGET_STM32F0/serial_device.c Wed Feb 20 22:31:08 2019 +0000 @@ -742,13 +742,13 @@ { struct serial_s *obj_s = SERIAL_S(obj); - // Determine the UART to use (UART_1, UART_2, ...) + // Checked used UART name (UART_1, UART_2, ...) UARTName uart_rts = (UARTName)pinmap_peripheral(rxflow, PinMap_UART_RTS); UARTName uart_cts = (UARTName)pinmap_peripheral(txflow, PinMap_UART_CTS); - - // Get the peripheral name (UART_1, UART_2, ...) from the pin and assign it to the object - obj_s->uart = (UARTName)pinmap_merge(uart_cts, uart_rts); - MBED_ASSERT(obj_s->uart != (UARTName)NC); + if (((UARTName)pinmap_merge(uart_rts, obj_s->uart) == (UARTName)NC) || ((UARTName)pinmap_merge(uart_cts, obj_s->uart) == (UARTName)NC)) { + MBED_ASSERT(0); + return; + } if (type == FlowControlNone) { // Disable hardware flow control