mbed library sources. Supersedes mbed-src.

Dependents:   BREAK_SENSOR_LED

Fork of mbed-dev by mbed official

Revision:
172:7d866c31b3c5
Parent:
165:e614a9f1c9e2
Child:
176:447f873cad2f
--- a/targets/TARGET_NUVOTON/TARGET_M451/serial_api.c	Wed Aug 16 18:27:13 2017 +0100
+++ b/targets/TARGET_NUVOTON/TARGET_M451/serial_api.c	Thu Aug 31 17:27:04 2017 +0100
@@ -269,7 +269,11 @@
     // Flush Tx FIFO. Otherwise, output data may get lost on this change.
     while (! UART_IS_TX_EMPTY(((UART_T *) NU_MODBASE(obj->serial.uart))));
     
-    // TODO: Assert for not supported parity and data bits
+    // Sanity check arguments    
+    MBED_ASSERT((data_bits == 5) || (data_bits == 6) || (data_bits == 7) || (data_bits == 8));
+    MBED_ASSERT((parity == ParityNone) || (parity == ParityOdd) || (parity == ParityEven) || (parity == ParityForced1) || (parity == ParityForced0));
+    MBED_ASSERT((stop_bits == 1) || (stop_bits == 2));
+    
     obj->serial.databits = data_bits;
     obj->serial.parity = parity;
     obj->serial.stopbits = stop_bits;