diff --git a/os/hal/ports/STM32/LLD/USARTv1/hal_uart_lld.c b/os/hal/ports/STM32/LLD/USARTv1/hal_uart_lld.c index a0457f883..0619b020c 100644 --- a/os/hal/ports/STM32/LLD/USARTv1/hal_uart_lld.c +++ b/os/hal/ports/STM32/LLD/USARTv1/hal_uart_lld.c @@ -348,6 +348,10 @@ static void serve_usart_irq(UARTDriver *uartp) { /* End of transmission, a callback is generated.*/ _uart_tx2_isr_code(uartp); } + + /* Timeout interrupt sources are only checked if enabled in CR1.*/ + if ((cr1 & USART_CR1_IDLEIE) && (sr & USART_SR_IDLE)) + _uart_timeout_isr_code(uartp); } /*===========================================================================*/ diff --git a/os/hal/ports/STM32/LLD/USARTv1/hal_uart_lld.h b/os/hal/ports/STM32/LLD/USARTv1/hal_uart_lld.h index 40e8885d4..ea4047325 100644 --- a/os/hal/ports/STM32/LLD/USARTv1/hal_uart_lld.h +++ b/os/hal/ports/STM32/LLD/USARTv1/hal_uart_lld.h @@ -603,6 +603,12 @@ typedef struct { */ uartecb_t rxerr_cb; /* End of the mandatory fields.*/ + /** + * @brief Receiver timeout callback. + * @details Handles idle interrupts depending on configured + * flags in CR registers and supported hardware features. + */ + uartcb_t timeout_cb; /** * @brief Bit rate. */ diff --git a/readme.txt b/readme.txt index 390077cea..0e9f1ec62 100644 --- a/readme.txt +++ b/readme.txt @@ -74,6 +74,7 @@ ***************************************************************************** *** Next *** +- HAL: Idle callback support for STM32 USARTv1 UART driver. - LIB: Added support for asynchronous jobs queues to OSLIB. - LIB: Added support for delegate threads to OSLIB. - NIL: Improvements to messages, new functions chMsgWaitS(),