1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/periph/uart: add periph_uart_collision feature

This commit is contained in:
Benjamin Valentin 2021-07-26 14:42:03 +02:00
parent 026d6cfba1
commit f89d0c7c25
3 changed files with 51 additions and 0 deletions

View File

@ -296,6 +296,48 @@ void uart_rxstart_irq_enable(uart_t uart);
void uart_rxstart_irq_disable(uart_t uart);
#endif /* MODULE_PERIPH_UART_RXSTART_IRQ */
#if defined(MODULE_PERIPH_UART_COLLISION) || DOXYGEN
/**
* @brief Enables collision detection check of the UART.
* This assumes the UART is connected to a bus where RX and TX are
* connected. After each sent byte it is checked whether the same
* byte could be received.
*
* This disables the RX interrupt.
*
* @note You have to add the module `periph_uart_rxstart_irq` to your project
* to enable this function
*
* @param[in] uart The device to configure
*/
void uart_collision_detect_enable(uart_t uart);
/**
* @brief Disables collision detection check of the UART.
*
* If an RX interrupt was configured before, it is enabled again.
*
* @note You have to add the module `periph_uart_rxstart_irq` to your project
* to enable this function
*
* @param[in] uart The device to configure
*/
void uart_collision_detect_disable(uart_t uart);
/**
* @brief Disables collision detection check of the UART.
*
* If an RX interrupt was configured before, it is enabled again.
*
* @note You have to add the module `periph_uart_rxstart_irq` to your project
* to enable this function
*
* @param[in] uart The device to probe
*
* @return true if a collision occurred during the last transder
*/
bool uart_collision_detected(uart_t uart);
#endif /* MODULE_PERIPH_UART_COLLISION */
/**
* @brief Setup parity, data and stop bits for a given UART device
*

View File

@ -28,6 +28,10 @@ config MODULE_PERIPH_LPUART
bool "Enable Low Power UART (LPUART)"
depends on HAS_PERIPH_LPUART
config MODULE_PERIPH_UART_COLLISION
bool "Enable UART collision detection"
depends on HAS_PERIPH_UART_COLLISION
config MODULE_PERIPH_UART_NONBLOCKING
bool "Non-blocking support"
depends on HAS_PERIPH_UART_NONBLOCKING

View File

@ -323,6 +323,11 @@ config HAS_PERIPH_UART
help
Indicates that an UART peripheral is present.
config HAS_PERIPH_UART_COLLISION
bool
help
Indicates that the UART peripheral supports hardware collision detection.
config HAS_PERIPH_UART_HW_FC
bool
help