Forked.

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_NUC472/serial_api.c
--- a/targets/TARGET_NUVOTON/TARGET_NUC472/serial_api.c	Thu Dec 15 11:48:27 2016 +0000
+++ b/targets/TARGET_NUVOTON/TARGET_NUC472/serial_api.c	Tue Dec 20 17:27:56 2016 +0000
@@ -330,8 +330,10 @@
         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) | UART_MODEM_RTSACTLV_Msk;
+        // nRTS pin output is low level active
+        uart_base->MODEM |= UART_MODEM_RTSACTLV_Msk;
+        uart_base->MODEM &= ~UART_MODEM_RTS_Msk;
+    
         uart_base->FIFO = (uart_base->FIFO & ~UART_FIFO_RTSTRGLV_Msk) | UART_FIFO_RTSTRGLV_8BYTES;
         // Enable RTS
         uart_base->INTEN |= UART_INTEN_ATORTSEN_Msk;
@@ -343,8 +345,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) | 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;
     }
@@ -519,9 +521,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;
@@ -574,9 +573,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;