diff --git a/include/libopencm3/stm32/common/usart_common_all.h b/include/libopencm3/stm32/common/usart_common_all.h index 5a41684b..8c310a9c 100644 --- a/include/libopencm3/stm32/common/usart_common_all.h +++ b/include/libopencm3/stm32/common/usart_common_all.h @@ -122,6 +122,8 @@ void usart_enable_tx_interrupt(uint32_t usart); void usart_disable_tx_interrupt(uint32_t usart); void usart_enable_tx_complete_interrupt(uint32_t usart); void usart_disable_tx_complete_interrupt(uint32_t usart); +void usart_enable_idle_interrupt(uint32_t usart); +void usart_disable_idle_interrupt(uint32_t usart); void usart_enable_error_interrupt(uint32_t usart); void usart_disable_error_interrupt(uint32_t usart); bool usart_get_flag(uint32_t usart, uint32_t flag); diff --git a/lib/stm32/common/usart_common_all.c b/lib/stm32/common/usart_common_all.c index 3565e802..e30e2feb 100644 --- a/lib/stm32/common/usart_common_all.c +++ b/lib/stm32/common/usart_common_all.c @@ -376,6 +376,29 @@ void usart_disable_tx_complete_interrupt(uint32_t usart) USART_CR1(usart) &= ~USART_CR1_TCIE; } +/** @brief USART Idle Interrupt Enable. + +@param[in] usart unsigned 32 bit. USART block register address base @ref +usart_reg_base +*/ + +void usart_enable_idle_interrupt(uint32_t usart) +{ + USART_CR1(usart) |= USART_CR1_IDLEIE; +} + +/*---------------------------------------------------------------------------*/ +/** @brief USART Idle Interrupt Disable. + +@param[in] usart unsigned 32 bit. USART block register address base @ref +usart_reg_base +*/ + +void usart_disable_idle_interrupt(uint32_t usart) +{ + USART_CR1(usart) &= ~USART_CR1_IDLEIE; +} + /*---------------------------------------------------------------------------*/ /** @brief USART Error Interrupt Enable.