[riot-notifications] [RIOT-OS/RIOT] cpu/esp32: add the new API function uart_mode to periph/uart (#11231)

MrKevinWeiss notifications at github.com
Thu Mar 28 13:26:39 CET 2019


MrKevinWeiss requested changes on this pull request.

Tested against scope.  Only the stop bits seem to be an issue, everything else appeared correct.

> +        case UART_DATA_BITS_8: _uarts[uart].regs->conf0.bit_num = 3; break;
+        default: LOG_TAG_ERROR("uart", "invalid number of data bits\n");
+                 critical_exit();
+                 return UART_NOMODE;
+    }
+    /* store changed number of data bits in configuration */
+    _uarts[uart].data = data_bits;
+
+    /* set number of stop bits */
+    #ifdef MCU_ESP32
+    /* workaround for hardware bug when stop bits are set to 2-bit mode. */
+    switch (stop_bits) {
+        case UART_STOP_BITS_1: _uarts[uart].regs->conf0.stop_bit_num = 1;
+                               _uarts[uart].regs->rs485_conf.dl1_en = 1;
+                               break;
+        case UART_STOP_BITS_2: _uarts[uart].regs->conf0.stop_bit_num = 1;

Should this be 2?  Either that or say not implemented.

> +
+    /* set number of stop bits */
+    #ifdef MCU_ESP32
+    /* workaround for hardware bug when stop bits are set to 2-bit mode. */
+    switch (stop_bits) {
+        case UART_STOP_BITS_1: _uarts[uart].regs->conf0.stop_bit_num = 1;
+                               _uarts[uart].regs->rs485_conf.dl1_en = 1;
+                               break;
+        case UART_STOP_BITS_2: _uarts[uart].regs->conf0.stop_bit_num = 1;
+                               _uarts[uart].regs->rs485_conf.dl1_en = 1;
+                               break;
+        default: LOG_TAG_ERROR("uart", "invalid number of stop bits\n");
+                 critical_exit();
+                 return UART_NOMODE;
+    }
+    #else

Is the ifdef needed here since they are all MCU_ESP32 that use this file?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11231#pullrequestreview-219986002
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190328/90c5de7a/attachment-0001.html>


More information about the notifications mailing list