stm32: uart: add USART_FLAG_ defines

Similar to how we have abstract defines for the stop bits, parity and
flow control common mode namees, provide abstract flag names for the
"standard" flags.  This allows us to start using common API code for v1
and v2 uarts

For stm32f3, drop the "compatibility" defines that simply pollute the
namespace, making it confusingly appear as if f3 has both SR and ISR
registers.
This commit is contained in:
Karl Palsson 2017-10-24 23:52:38 +00:00
parent 2bc19d499c
commit 557e2a0b09
3 changed files with 35 additions and 41 deletions

View File

@ -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

View File

@ -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 */
/*****************************************************************************/

View File

@ -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 */