WB32L003 Standard Peripherals Firmware Library

wb32l003_uart.h
浏览该文件的文档.
1
10 /* Define to prevent recursive inclusion -------------------------------------*/
11 #ifndef __WB32L003_UART_H
12 #define __WB32L003_UART_H
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 /* Includes ------------------------------------------------------------------*/
19 #include "wb32l003.h"
20
29 /* Exported types ------------------------------------------------------------*/
30
34 typedef struct
35 {
36 uint32_t UART_BandDouble;
39 uint32_t UART_BaudRateMode;
42 uint32_t UART_BaudRate;
44 uint8_t UART_WordLength;
46 } UART_InitTypeDef;
47
48 /* Exported constants --------------------------------------------------------*/
49
54 #define IS_UART_ALL_PERIPH(PERIPH) (((PERIPH) == UART1) || \
55 ((PERIPH) == UART2))
56
60 #define UART_WordLength_8b ((uint32_t)(0x01U << 6))
61 #define UART_WordLength_9b ((uint32_t)(0x03U << 6))
62
70 #define UART_BandDouble_Enable ((uint32_t)UART_SCON_DBAUD)
71 #define UART_BandDouble_Disable ((uint32_t)0x00)
72
80 #define UART_BaudRateMode_Self ((uint32_t)UART_BAUDCR_SELF_BRG)
81 #define UART_BaudRateMode_Tim ((uint32_t)0x00)
82
90 #define UART_Parity_None ((uint32_t)0x00)
91 #define UART_Parity_Odd ((uint32_t)0x01)
92 #define UART_Parity_Even ((uint32_t)0x02)
93
101 #define UART_IT_FE UART_SCON_FEEN
102 #define UART_IT_TI UART_SCON_TIEN
103 #define UART_IT_RI UART_SCON_RIEN
104
112 #define UART_FLAG_FE UART_INTSR_FE
113 #define UART_FLAG_TI UART_INTSR_TI
114 #define UART_FLAG_RI UART_INTSR_RI
115
124 /* Exported macro ------------------------------------------------------------*/
125 /* Exported functions --------------------------------------------------------*/
126
127 void UART_DeInit(UART_TypeDef* UARTx);
128 void UART_Init(UART_TypeDef* UARTx, UART_InitTypeDef* UART_InitStruct);
129 void UART_StructInit(UART_InitTypeDef* UART_InitStruct);
130 void UART_Cmd(UART_TypeDef* UARTx, FunctionalState NewState);
131 void UART_WriteData(UART_TypeDef* UARTx, uint8_t Data);
132 uint8_t UART_ReadData(UART_TypeDef* UARTx);
133 void UART_MultideviceCmd(UART_TypeDef* UARTx, FunctionalState NewState);
134 void UART_SetAddress(UART_TypeDef* UARTx, uint8_t UART_Address);
135 void UART_SetAddressMask(UART_TypeDef* UARTx, uint8_t UART_AddressMask);
136 void UART_IrDACmd(UART_TypeDef* UARTx, FunctionalState NewState);
137 void UART_ITConfig(UART_TypeDef* UARTx, uint8_t UART_IT, FunctionalState NewState);
138 FlagStatus UART_GetFlagStatus(UART_TypeDef* UARTx, uint32_t UART_FLAG);
139 void UART_ClearFlag(UART_TypeDef* UARTx, uint32_t UART_FLAG);
140
141
150 #ifdef __cplusplus
151 }
152 #endif
153
154 #endif /* __WB32L003_UART_H */
UART_InitTypeDef::UART_BaudRateMode
uint32_t UART_BaudRateMode
Definition: wb32l003_uart.h:39
UART_DeInit
void UART_DeInit(UART_TypeDef *UARTx)
Deinitializes the UARTx peripheral registers to their default reset values.
Definition: wb32l003_uart.c:40
UART_ClearFlag
void UART_ClearFlag(UART_TypeDef *UARTx, uint32_t UART_FLAG)
Clear the specified UART flag.
Definition: wb32l003_uart.c:312
UART_GetFlagStatus
FlagStatus UART_GetFlagStatus(UART_TypeDef *UARTx, uint32_t UART_FLAG)
Checks whether the specified UART flag is set or not.
Definition: wb32l003_uart.c:281
UART_SetAddressMask
void UART_SetAddressMask(UART_TypeDef *UARTx, uint8_t UART_AddressMask)
Sets the address mask of the UART node.
Definition: wb32l003_uart.c:260
UART_IrDACmd
void UART_IrDACmd(UART_TypeDef *UARTx, FunctionalState NewState)
Enables or disables the UARTx's IrDA Mode.
Definition: wb32l003_uart.c:172
UART_InitTypeDef::UART_BandDouble
uint32_t UART_BandDouble
Definition: wb32l003_uart.h:36
UART_WriteData
void UART_WriteData(UART_TypeDef *UARTx, uint8_t Data)
Write data to SBUF register.
Definition: wb32l003_uart.c:140
UART_SetAddress
void UART_SetAddress(UART_TypeDef *UARTx, uint8_t UART_Address)
Sets the address of the UART node.
Definition: wb32l003_uart.c:243
UART_InitTypeDef::UART_BaudRate
uint32_t UART_BaudRate
Definition: wb32l003_uart.h:42
UART_Cmd
void UART_Cmd(UART_TypeDef *UARTx, FunctionalState NewState)
Enables or disables the specified UART peripheral.
Definition: wb32l003_uart.c:115
UART_Init
void UART_Init(UART_TypeDef *UARTx, UART_InitTypeDef *UART_InitStruct)
Initializes the UARTx peripheral according to the specified parameters in the UART_InitStruct.
Definition: wb32l003_uart.c:68
UART_ITConfig
void UART_ITConfig(UART_TypeDef *UARTx, uint8_t UART_IT, FunctionalState NewState)
Enables or disables the UARTx's interrupts.
Definition: wb32l003_uart.c:199
UART_ReadData
uint8_t UART_ReadData(UART_TypeDef *UARTx)
Read data from SBUF register.
Definition: wb32l003_uart.c:155
UART_MultideviceCmd
void UART_MultideviceCmd(UART_TypeDef *UARTx, FunctionalState NewState)
Enables or disables the UARTx's Multidevice function.
Definition: wb32l003_uart.c:220
UART_TypeDef
Definition: wb32l003.h:350
UART_InitTypeDef
UART Init Structure definition
Definition: wb32l003_uart.h:34
UART_StructInit
void UART_StructInit(UART_InitTypeDef *UART_InitStruct)
Fills each UART_InitStruct member with its default value.
Definition: wb32l003_uart.c:97
UART_InitTypeDef::UART_WordLength
uint8_t UART_WordLength
Definition: wb32l003_uart.h:44