WB32L003 Standard Peripherals Firmware Library

wb32l003_lpuart.h
Go to the documentation of this file.
1
10 /* Define to prevent recursive inclusion -------------------------------------*/
11 #ifndef __WB32L003_LPUART_H
12 #define __WB32L003_LPUART_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 LPUART_ClkSel;
39 uint32_t LPUART_BandDouble;
42 uint32_t LPUART_BaudRateMode;
45 uint32_t LPUART_BaudRate;
47 uint32_t LPUART_LowPower;
50 uint32_t LPUART_ClkDivision;
53 uint8_t LPUART_WordLength;
55 } LPUART_InitTypeDef;
56
57 /* Exported constants --------------------------------------------------------*/
58
63 #define IS_LPUART_ALL_PERIPH(PERIPH) (((PERIPH) == LPUART))
64
68 #define LPUART_BandDouble_Enable ((uint32_t)LPUART_SCON_DBAUD)
69 #define LPUART_BandDouble_Disable ((uint32_t)0x00)
70
78 #define LPUART_BaudRateMode_Self ((uint32_t)LPUART_BAUDCR_SELF_BRG)
79 #define LPUART_BaudRateMode_Tim ((uint32_t)0x00)
80
88 #define LPUART_WordLength_8b ((uint32_t)(0x01U << 6))
89 #define LPUART_WordLength_9b ((uint32_t)(0x03U << 6))
90
98 #define LPUART_LowPower_Enable ((uint32_t)(0x01U << 10))
99 #define LPUART_LowPower_Disable ((uint32_t)0x00)
100
108 #define LPUART_ClkSel_PCLK ((uint32_t)(0x01U << 11))
109 #define LPUART_ClkSel_LSE ((uint32_t)(0x02U << 11))
110 #define LPUART_ClkSel_LSI ((uint32_t)(0x03U << 11))
111
119 #define LPUART_CLK_DIV1 ((uint32_t)(0x07U << 13))
120 #define LPUART_CLK_DIV2 ((uint32_t)(0x06U << 13))
121 #define LPUART_CLK_DIV4 ((uint32_t)(0x05U << 13))
122 #define LPUART_CLK_DIV8 ((uint32_t)(0x04U << 13))
123 #define LPUART_CLK_DIV16 ((uint32_t)(0x03U << 13))
124 #define LPUART_CLK_DIV32 ((uint32_t)(0x02U << 13))
125 #define LPUART_CLK_DIV64 ((uint32_t)(0x01U << 13))
126 #define LPUART_CLK_DIV128 ((uint32_t)(0x00U << 13))
127
135 #define LPUART_Parity_None ((uint32_t)0x00)
136 #define LPUART_Parity_Odd ((uint32_t)0x01)
137 #define LPUART_Parity_Even ((uint32_t)0x02)
138
146 #define LPUART_IT_FE LPUART_SCON_FEEN
147 #define LPUART_IT_TI LPUART_SCON_TIEN
148 #define LPUART_IT_RI LPUART_SCON_RIEN
149
157 #define LPUART_FLAG_FE LPUART_INTSR_FE
158 #define LPUART_FLAG_TI LPUART_INTSR_TI
159 #define LPUART_FLAG_RI LPUART_INTSR_RI
160
169 /* Exported macro ------------------------------------------------------------*/
170 /* Exported functions --------------------------------------------------------*/
171
172 void LPUART_DeInit(LPUART_TypeDef* LPUARTx);
173 void LPUART_Init(LPUART_TypeDef* LPUARTx, LPUART_InitTypeDef* LPUART_InitStruct);
174 void LPUART_StructInit(LPUART_InitTypeDef* LPUART_InitStruct);
175 void LPUART_Cmd(LPUART_TypeDef* LPUARTx, FunctionalState NewState);
176 void LPUART_WriteData(LPUART_TypeDef* LPUARTx, uint8_t Data);
177 uint8_t LPUART_ReadData(LPUART_TypeDef* LPUARTx);
178 void LPUART_MultideviceCmd(LPUART_TypeDef* LPUARTx, FunctionalState NewState);
179 void LPUART_SetAddress(LPUART_TypeDef* LPUARTx, uint8_t LPUART_Address);
180 void LPUART_SetAddressMask(LPUART_TypeDef* LPUARTx, uint8_t LPUART_AddressMask);
181 void LPUART_ITConfig(LPUART_TypeDef* LPUARTx, uint32_t LPUART_IT, FunctionalState NewState);
182 FlagStatus LPUART_GetFlagStatus(LPUART_TypeDef* LPUARTx, uint32_t LPUART_FLAG);
183 void LPUART_ClearFlag(LPUART_TypeDef* LPUARTx, uint32_t LPUART_FLAG);
184
185
194 #ifdef __cplusplus
195 }
196 #endif
197
198 #endif /* __WB32L003_LPUART_H */
LPUART_InitTypeDef::LPUART_ClkSel
uint32_t LPUART_ClkSel
Definition: wb32l003_lpuart.h:36
LPUART_InitTypeDef::LPUART_ClkDivision
uint32_t LPUART_ClkDivision
Definition: wb32l003_lpuart.h:50
LPUART_ReadData
uint8_t LPUART_ReadData(LPUART_TypeDef *LPUARTx)
Read data from SBUF register.
Definition: wb32l003_lpuart.c:166
LPUART_ITConfig
void LPUART_ITConfig(LPUART_TypeDef *LPUARTx, uint32_t LPUART_IT, FunctionalState NewState)
Enables or disables the LPUARTx's interrupts.
Definition: wb32l003_lpuart.c:187
LPUART_GetFlagStatus
FlagStatus LPUART_GetFlagStatus(LPUART_TypeDef *LPUARTx, uint32_t LPUART_FLAG)
Checks whether the specified UART flag is set or not.
Definition: wb32l003_lpuart.c:268
LPUART_SetAddressMask
void LPUART_SetAddressMask(LPUART_TypeDef *LPUARTx, uint8_t LPUART_AddressMask)
Sets the address mask of the LPUART node.
Definition: wb32l003_lpuart.c:248
LPUART_InitTypeDef::LPUART_BaudRate
uint32_t LPUART_BaudRate
Definition: wb32l003_lpuart.h:45
LPUART_SetAddress
void LPUART_SetAddress(LPUART_TypeDef *LPUARTx, uint8_t LPUART_Address)
Sets the address of the LPUART node.
Definition: wb32l003_lpuart.c:232
LPUART_InitTypeDef::LPUART_LowPower
uint32_t LPUART_LowPower
Definition: wb32l003_lpuart.h:47
LPUART_InitTypeDef
LPUART Init Structure definition.
Definition: wb32l003_lpuart.h:34
LPUART_StructInit
void LPUART_StructInit(LPUART_InitTypeDef *LPUART_InitStruct)
Fills each LPUART_InitStruct member with its default value.
Definition: wb32l003_lpuart.c:108
LPUART_WriteData
void LPUART_WriteData(LPUART_TypeDef *LPUARTx, uint8_t Data)
Write data to SBUF register.
Definition: wb32l003_lpuart.c:152
LPUART_InitTypeDef::LPUART_BaudRateMode
uint32_t LPUART_BaudRateMode
Definition: wb32l003_lpuart.h:42
LPUART_TypeDef
Definition: wb32l003.h:335
LPUART_InitTypeDef::LPUART_BandDouble
uint32_t LPUART_BandDouble
Definition: wb32l003_lpuart.h:39
LPUART_Cmd
void LPUART_Cmd(LPUART_TypeDef *LPUARTx, FunctionalState NewState)
Enables or disables the specified LPUART peripheral.
Definition: wb32l003_lpuart.c:128
LPUART_DeInit
void LPUART_DeInit(LPUART_TypeDef *LPUARTx)
Deinitializes the LPUARTx peripheral registers to their default reset values.
Definition: wb32l003_lpuart.c:38
LPUART_MultideviceCmd
void LPUART_MultideviceCmd(LPUART_TypeDef *LPUARTx, FunctionalState NewState)
Enables or disables the LPUARTx's Multidevice function.
Definition: wb32l003_lpuart.c:210
LPUART_InitTypeDef::LPUART_WordLength
uint8_t LPUART_WordLength
Definition: wb32l003_lpuart.h:53
LPUART_Init
void LPUART_Init(LPUART_TypeDef *LPUARTx, LPUART_InitTypeDef *LPUART_InitStruct)
Initializes the LPUARTx peripheral according to the specified parameters in the LPUART_InitStruct.
Definition: wb32l003_lpuart.c:56
LPUART_ClearFlag
void LPUART_ClearFlag(LPUART_TypeDef *LPUARTx, uint32_t LPUART_FLAG)
Clear the specified LPUART flag.
Definition: wb32l003_lpuart.c:298