From 9fea26e455c47bc2e59b494ae09422684493601e Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Thu, 8 Nov 2012 14:54:41 -0500 Subject: stm32/usart: Add enable_/disable_error_interrupt --- include/libopencm3/stm32/usart.h | 2 ++ lib/stm32/usart.c | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/libopencm3/stm32/usart.h b/include/libopencm3/stm32/usart.h index 088e67b..9994002 100644 --- a/include/libopencm3/stm32/usart.h +++ b/include/libopencm3/stm32/usart.h @@ -371,6 +371,8 @@ void usart_enable_rx_interrupt(u32 usart); void usart_disable_rx_interrupt(u32 usart); void usart_enable_tx_interrupt(u32 usart); void usart_disable_tx_interrupt(u32 usart); +void usart_enable_error_interrupt(u32 usart); +void usart_disable_error_interrupt(u32 usart); bool usart_get_flag(u32 usart, u32 flag); bool usart_get_interrupt_source(u32 usart, u32 flag); diff --git a/lib/stm32/usart.c b/lib/stm32/usart.c index 5cf861b..454df41 100644 --- a/lib/stm32/usart.c +++ b/lib/stm32/usart.c @@ -398,6 +398,27 @@ void usart_disable_tx_interrupt(u32 usart) USART_CR1(usart) &= ~USART_CR1_TXEIE; } +/*-----------------------------------------------------------------------------*/ +/** @brief USART Error Interrupt Enable. + +@param[in] usart unsigned 32 bit. USART block register address base @ref usart_reg_base +*/ + +void usart_enable_error_interrupt(u32 usart) +{ + USART_CR3(usart) |= USART_CR3_EIE; +} + +/*-----------------------------------------------------------------------------*/ +/** @brief USART Error Interrupt Disable. + +@param[in] usart unsigned 32 bit. USART block register address base @ref usart_reg_base +*/ + +void usart_disable_error_interrupt(u32 usart) +{ + USART_CR3(usart) &= ~USART_CR3_EIE; +} /*---------------------------------------------------------------------------*/ /** @brief USART Read a Status Flag. -- cgit v1.2.3