mbed library sources. Supersedes mbed-src.

Fork of mbed-dev by mbed official

Revision:
153:fa9ff456f731
Parent:
151:5eaa88a5bcc7
Child:
161:2cc1468da177
diff -r 9a67f0b066fc -r fa9ff456f731 targets/TARGET_NUVOTON/TARGET_M451/serial_api.c
--- a/targets/TARGET_NUVOTON/TARGET_M451/serial_api.c	Thu Dec 15 11:48:27 2016 +0000
+++ b/targets/TARGET_NUVOTON/TARGET_M451/serial_api.c	Tue Dec 20 17:27:56 2016 +0000
@@ -300,8 +300,8 @@
         MBED_ASSERT(uart_rts == obj->serial.uart);
         // Enable the pin for RTS function
         pinmap_pinout(rxflow, PinMap_UART_RTS);
-        // nRTS pin output is high level active
-        uart_base->MODEM = (uart_base->MODEM & ~UART_MODEM_RTSACTLV_Msk);
+        // nRTS pin output is low level active
+        uart_base->MODEM |= UART_MODEM_RTSACTLV_Msk;
         uart_base->FIFO = (uart_base->FIFO & ~UART_FIFO_RTSTRGLV_Msk) | UART_FIFO_RTSTRGLV_8BYTES;
         // Enable RTS
         uart_base->INTEN |= UART_INTEN_ATORTSEN_Msk;
@@ -313,8 +313,8 @@
         MBED_ASSERT(uart_cts == obj->serial.uart);
         // Enable the pin for CTS function
         pinmap_pinout(txflow, PinMap_UART_CTS);
-        // nCTS pin input is high level active
-        uart_base->MODEMSTS = (uart_base->MODEMSTS & ~UART_MODEMSTS_CTSACTLV_Msk);
+        // nCTS pin input is low level active
+        uart_base->MODEMSTS |= UART_MODEMSTS_CTSACTLV_Msk;
         // Enable CTS
         uart_base->INTEN |= UART_INTEN_ATOCTSEN_Msk;
     }
@@ -479,9 +479,6 @@
 #if DEVICE_SERIAL_ASYNCH
 int serial_tx_asynch(serial_t *obj, const void *tx, size_t tx_length, uint8_t tx_width, uint32_t handler, uint32_t event, DMAUsage hint)
 {
-    // NOTE: tx_width is deprecated. Assume its value is databits ceiled to the nearest number among 8, 16, and 32.
-    tx_width = (obj->serial.databits <= 8) ? 8 : (obj->serial.databits <= 16) ? 16 : 32;
-    
     MBED_ASSERT(tx_width == 8 || tx_width == 16 || tx_width == 32);
 
     obj->serial.dma_usage_tx = hint;
@@ -536,9 +533,6 @@
 
 void serial_rx_asynch(serial_t *obj, void *rx, size_t rx_length, uint8_t rx_width, uint32_t handler, uint32_t event, uint8_t char_match, DMAUsage hint)
 {
-    // NOTE: rx_width is deprecated. Assume its value is databits ceiled to the nearest number among 8, 16, and 32.
-    rx_width = (obj->serial.databits <= 8) ? 8 : (obj->serial.databits <= 16) ? 16 : 32;
-    
     MBED_ASSERT(rx_width == 8 || rx_width == 16 || rx_width == 32);
 
     obj->serial.dma_usage_rx = hint;