]> granicus.if.org Git - esp-idf/commitdiff
driver: add rs485 half duplex interface support to uart driver (update after review)
authorAlex Lisitsyn <aleks@espressif.com>
Thu, 31 May 2018 08:33:40 +0000 (10:33 +0200)
committerAlex Lisitsyn <aleks@espressif.com>
Mon, 2 Jul 2018 13:24:58 +0000 (15:24 +0200)
An existing UART driver does not support RS485 half duplex mode.
This task adds this functionality to ESP_IDF UART driver.
driver/uart.c/h: updated to add support of RS485 half duplex mode
examples/peripherals/uart_echo_rs485/main/rs485_example.c: added test example
components/driver/test/test_uart.c: added test of RS485 half duplex mode
docs/en/api-reference/peripherals/uart.rst: updated documentation
test_uart.c: suppress GCC warnings about discarded const qualifiers
uart.rst: remove sphinx warning - "Duplicate explicit target name"
simple change in uart.h file
update (test_uart.c) after rebase from master
update uart.rst, uart.c, rs485_example.c
Update example description in file Readme.md
update uart.c/h, uart.rst, test_uart.c according to review results
update uart.h (uart_set_rx_timeout() description

The tests are completed using RS485 adapters hardware connected to two ESP32 WROVER KITs.

TW#13812
Closes https://github.com/espressif/esp-idf/pull/667
Closes https://github.com/espressif/esp-idf/pull/1006

components/driver/include/driver/uart.h

index 914d1d8eb5ea1ad3bfa99eb97fa34b091fe92a7e..d70da5e1a7c9fc91814b6b5b63412d44167f4605 100644 (file)
@@ -765,7 +765,7 @@ esp_err_t uart_set_mode(uart_port_t uart_num, uart_mode_t mode);
  * @brief UART set threshold timeout for TOUT feature
  *
  * @param uart_num     Uart number to configure
- * @param tout_thresh  This parameter defines timeout threshold in uart symbol periods. 
+ * @param tout_thresh  This parameter defines timeout threshold in uart symbol periods. The maximum value of threshold is 126. 
  *        tout_thresh = 1, defines TOUT interrupt timeout equal to transmission time of one symbol (~11 bit) on current baudrate. 
  *        If the time is expired the UART_RXFIFO_TOUT_INT interrupt is triggered. If tout_thresh == 0,
  *        the TOUT feature is disabled.
@@ -779,7 +779,7 @@ esp_err_t uart_set_rx_timeout(uart_port_t uart_num, const uint8_t tout_thresh);
 /**
  * @brief Returns collision detection flag for RS485 mode
  *        Function returns the collision detection flag into variable pointed by collision_flag.
- *        *collision_flag = true, if collision detected else it is equal to false. The maximum value of threshold is 126. 
+ *        *collision_flag = true, if collision detected else it is equal to false.
  *        This function should be executed when actual transmission is completed (after uart_write_bytes()).
  *
  * @param uart_num       Uart number to configure