diff --git a/include/libopencm3/stm32/common/usart_common_f124.h b/include/libopencm3/stm32/common/usart_common_f124.h index 283503d2..bfe50cd0 100644 --- a/include/libopencm3/stm32/common/usart_common_f124.h +++ b/include/libopencm3/stm32/common/usart_common_f124.h @@ -95,6 +95,23 @@ specific memorymap.h header before including this header file.*/ #define UART4_GTPR USART_GTPR(UART4_BASE) #define UART5_GTPR USART_GTPR(UART5_BASE) +/** @defgroup usart_convenience_flags U(S)ART convenience Flags + * @ingroup STM32F_usart_defines + * We define the "common" lower flag bits using a standard name, + * allowing them to be used regardless of which usart peripheral + * version you have. + * @{ + */ +#define USART_FLAG_PE USART_SR_PE +#define USART_FLAG_FE USART_SR_FE +#define USART_FLAG_NF USART_SR_NF +#define USART_FLAG_ORE USART_SR_ORE +#define USART_FLAG_IDLE USART_SR_IDLE +#define USART_FLAG_RXNE USART_SR_RXNE +#define USART_FLAG_TC USART_SR_TC +#define USART_FLAG_TXE USART_SR_TXE +/**@}*/ + /* --- USART_SR values ----------------------------------------------------- */ /****************************************************************************/ /** @defgroup usart_sr_flags USART Status register Flags diff --git a/include/libopencm3/stm32/common/usart_common_v2.h b/include/libopencm3/stm32/common/usart_common_v2.h index 2ae3ee35..4b5bee60 100644 --- a/include/libopencm3/stm32/common/usart_common_v2.h +++ b/include/libopencm3/stm32/common/usart_common_v2.h @@ -196,6 +196,24 @@ /**@}*/ +/** @defgroup usart_convenience_flags U(S)ART convenience Flags + * @ingroup STM32F_usart_defines + * We define the "common" lower flag bits using a standard name, + * allowing them to be used regardless of which usart peripheral + * version you have. + * @{ + */ +#define USART_FLAG_PE USART_ISR_PE +#define USART_FLAG_FE USART_ISR_FE +#define USART_FLAG_NF USART_ISR_NF +#define USART_FLAG_ORE USART_ISR_ORE +#define USART_FLAG_IDLE USART_ISR_IDLE +#define USART_FLAG_RXNE USART_ISR_RXNE +#define USART_FLAG_TC USART_ISR_TC +#define USART_FLAG_TXE USART_ISR_TXE +/**@}*/ + + /*****************************************************************************/ /* Register values */ /*****************************************************************************/ diff --git a/include/libopencm3/stm32/f3/usart.h b/include/libopencm3/stm32/f3/usart.h index 4d3766f7..ce4af10f 100644 --- a/include/libopencm3/stm32/f3/usart.h +++ b/include/libopencm3/stm32/f3/usart.h @@ -80,47 +80,6 @@ - -/* --- USART_SR values ----------------------------------------------------- */ -/****************************************************************************/ -/** @defgroup usart_sr_flags USART Status register Flags -@ingroup STM32F_usart_defines - -@{*/ - -/** CTS: CTS flag */ -/** @note: undefined on UART4 and UART5 */ -#define USART_SR_CTS USART_ISR_CTS - -/** LBD: LIN break detection flag */ -#define USART_SR_LBD USART_ISR_LBDF - -/** TXE: Transmit data buffer empty */ -#define USART_SR_TXE USART_ISR_TXE - -/** TC: Transmission complete */ -#define USART_SR_TC USART_ISR_TC - -/** RXNE: Read data register not empty */ -#define USART_SR_RXNE USART_ISR_RXNE - -/** IDLE: Idle line detected */ -#define USART_SR_IDLE USART_ISR_IDLE - -/** ORE: Overrun error */ -#define USART_SR_ORE USART_ISR_ORE - -/** NE: Noise error flag */ -#define USART_SR_NE USART_ISR_NF - -/** FE: Framing error */ -#define USART_SR_FE USART_ISR_FE - -/** PE: Parity error */ -#define USART_SR_PE USART_ISR_PE -/**@}*/ - - /* --- USART_RDR values --------------------------------------------------- */ /* RDR[8:0]: Receive data value */