@@ -329,7 +329,7 @@ bool uartSetPins(uint8_t uart_num, int8_t rxPin, int8_t txPin, int8_t ctsPin, in
329329 UART_MUTEX_UNLOCK ();
330330
331331 if (!retCode ) {
332- log_e ("UART%d set pins failed." );
332+ log_e ("UART%d set pins failed." , uart_num );
333333 }
334334 return retCode ;
335335}
@@ -958,7 +958,7 @@ unsigned long uartDetectBaudrate(uart_t *uart)
958958}
959959
960960/*
961- These functions are for testing puspose only and can be used in Arduino Sketches
961+ These functions are for testing purpose only and can be used in Arduino Sketches
962962 Those are used in the UART examples
963963*/
964964
@@ -968,15 +968,17 @@ unsigned long uartDetectBaudrate(uart_t *uart)
968968 This code "replaces" the physical wiring for connecting TX <--> RX in a loopback
969969*/
970970
971- // gets the right TX SIGNAL, based on the UART number
971+ // gets the right TX or RX SIGNAL, based on the UART number from gpio_sig_map.h
972972#if SOC_UART_NUM > 2
973- #define UART_TX_SIGNAL (uartNumber ) (uartNumber == UART_NUM_0 ? U0TXD_OUT_IDX : (uartNumber == UART_NUM_1 ? U1TXD_OUT_IDX : U2TXD_OUT_IDX))
973+ #define UART_TX_SIGNAL (uartNumber ) (uartNumber == UART_NUM_0 ? U0TXD_OUT_IDX : (uartNumber == UART_NUM_1 ? U1TXD_OUT_IDX : U2TXD_OUT_IDX))
974+ #define UART_RX_SIGNAL (uartNumber ) (uartNumber == UART_NUM_0 ? U0RXD_IN_IDX : (uartNumber == UART_NUM_1 ? U1RXD_IN_IDX : U2RXD_IN_IDX))
974975#else
975- #define UART_TX_SIGNAL (uartNumber ) (uartNumber == UART_NUM_0 ? U0TXD_OUT_IDX : U1TXD_OUT_IDX)
976+ #define UART_TX_SIGNAL (uartNumber ) (uartNumber == UART_NUM_0 ? U0TXD_OUT_IDX : U1TXD_OUT_IDX)
977+ #define UART_RX_SIGNAL (uartNumber ) (uartNumber == UART_NUM_0 ? U0RXD_IN_IDX : U1RXD_IN_IDX)
976978#endif
977979/*
978- Make sure UART's RX signal is connected to TX pin
979- This creates a loop that lets us receive anything we send on the UART
980+ This function internally binds defined UARTs TX signal with defined RX pin of any UART (same or different).
981+ This creates a loop that lets us receive anything we send on the UART without external wires.
980982*/
981983void uart_internal_loopback (uint8_t uartNum , int8_t rxPin )
982984{
@@ -1008,4 +1010,4 @@ int uart_send_msg_with_break(uint8_t uartNum, uint8_t *msg, size_t msgSize)
10081010 return uart_write_bytes_with_break (uartNum , (const void * )msg , msgSize , 12 );
10091011}
10101012
1011- #endif /* SOC_UART_SUPPORTED */
1013+ #endif /* SOC_UART_SUPPORTED */
0 commit comments