1 /**
2   ******************************************************************************
3   * @file               ft32f0xx_usart.h
4   * @author             FMD AE
5   * @brief              This file contains all the functions prototypes for the USART
6   *                     firmware library.
7   * @version            V1.0.0
8   * @data                   2021-07-01
9   ******************************************************************************
10   */
11 
12 
13 /* Define to prevent recursive inclusion -------------------------------------*/
14 #ifndef __FT32F0XX_USART_H
15 #define __FT32F0XX_USART_H
16 
17 #ifdef __cplusplus
18  extern "C" {
19 #endif
20 
21 /* Includes ------------------------------------------------------------------*/
22 #include "ft32f0xx.h"
23 
24 
25 /** @addtogroup USART
26   * @{
27   */
28 
29 /* Exported types ------------------------------------------------------------*/
30 
31 
32 
33 /**
34   * @brief  USART Init Structure definition
35   */
36 
37 typedef struct
38 {
39   uint32_t USART_BaudRate;            /*!< This member configures the USART communication baud rate.
40                                            The baud rate is computed using the following formula:
41                                             - IntegerDivider = ((PCLKx) / (16 * (USART_InitStruct->USART_BaudRate)))
42                                             - FractionalDivider = ((IntegerDivider - ((uint32_t) IntegerDivider)) * 16) + 0.5 */
43 
44   uint32_t USART_WordLength;          /*!< Specifies the number of data bits transmitted or received in a frame.
45                                            This parameter can be a value of @ref USART_Word_Length */
46 
47   uint32_t USART_StopBits;            /*!< Specifies the number of stop bits transmitted.
48                                            This parameter can be a value of @ref USART_Stop_Bits */
49 
50   uint32_t USART_Parity;              /*!< Specifies the parity mode.
51                                            This parameter can be a value of @ref USART_Parity
52                                            @note When parity is enabled, the computed parity is inserted
53                                                  at the MSB position of the transmitted data (9th bit when
54                                                  the word length is set to 9 data bits; 8th bit when the
55                                                  word length is set to 8 data bits). */
56 
57   uint32_t USART_Mode;                /*!< Specifies wether the Receive or Transmit mode is enabled or disabled.
58                                            This parameter can be a value of @ref USART_Mode */
59 
60   uint32_t USART_HardwareFlowControl; /*!< Specifies wether the hardware flow control mode is enabled
61                                            or disabled.
62                                            This parameter can be a value of @ref USART_Hardware_Flow_Control*/
63 } USART_InitTypeDef;
64 
65 /**
66   * @brief  USART Clock Init Structure definition
67   */
68 
69 typedef struct
70 {
71   uint32_t USART_Clock;             /*!< Specifies whether the USART clock is enabled or disabled.
72                                          This parameter can be a value of @ref USART_Clock */
73 
74   uint32_t USART_CPOL;              /*!< Specifies the steady state of the serial clock.
75                                          This parameter can be a value of @ref USART_Clock_Polarity */
76 
77   uint32_t USART_CPHA;              /*!< Specifies the clock transition on which the bit capture is made.
78                                          This parameter can be a value of @ref USART_Clock_Phase */
79 
80   uint32_t USART_LastBit;           /*!< Specifies whether the clock pulse corresponding to the last transmitted
81                                          data bit (MSB) has to be output on the SCLK pin in synchronous mode.
82                                          This parameter can be a value of @ref USART_Last_Bit */
83 } USART_ClockInitTypeDef;
84 
85 /* Exported constants --------------------------------------------------------*/
86 
87 /** @defgroup USART_Exported_Constants
88   * @{
89   */
90 
91 #define IS_USART_ALL_PERIPH(PERIPH) (((PERIPH) == USART1) || \
92                                      ((PERIPH) == USART2))
93 
94 #define IS_USART_123_PERIPH(PERIPH) (((PERIPH) == USART1) || \
95                                      ((PERIPH) == USART2) || \
96                                      ((PERIPH) == USART3))
97 
98 /** @defgroup USART_Word_Length
99   * @{
100   */
101 
102 #define USART_WordLength_8b                  ((uint32_t)0x00000000)
103 #define USART_WordLength_9b                  USART_CR1_M /* should be ((uint32_t)0x00001000) */
104 #define USART_WordLength_7b                  ((uint32_t)0x10001000)
105 #define IS_USART_WORD_LENGTH(LENGTH) (((LENGTH) == USART_WordLength_8b) || \
106                                       ((LENGTH) == USART_WordLength_9b) || \
107                                       ((LENGTH) == USART_WordLength_7b))
108 /**
109   * @}
110   */
111 
112 /** @defgroup USART_Stop_Bits
113   * @{
114   */
115 
116 #define USART_StopBits_1                     ((uint32_t)0x00000000)
117 #define USART_StopBits_2                     USART_CR2_STOP_1
118 #define USART_StopBits_1_5                   (USART_CR2_STOP_0 | USART_CR2_STOP_1)
119 #define IS_USART_STOPBITS(STOPBITS) (((STOPBITS) == USART_StopBits_1) || \
120                                      ((STOPBITS) == USART_StopBits_2) || \
121                                      ((STOPBITS) == USART_StopBits_1_5))
122 /**
123   * @}
124   */
125 
126 /** @defgroup USART_Parity
127   * @{
128   */
129 
130 #define USART_Parity_No                      ((uint32_t)0x00000000)
131 #define USART_Parity_Even                    USART_CR1_PCE
132 #define USART_Parity_Odd                     (USART_CR1_PCE | USART_CR1_PS)
133 #define IS_USART_PARITY(PARITY) (((PARITY) == USART_Parity_No) || \
134                                  ((PARITY) == USART_Parity_Even) || \
135                                  ((PARITY) == USART_Parity_Odd))
136 /**
137   * @}
138   */
139 
140 /** @defgroup USART_Mode
141   * @{
142   */
143 
144 #define USART_Mode_Rx                        USART_CR1_RE
145 #define USART_Mode_Tx                        USART_CR1_TE
146 #define IS_USART_MODE(MODE) ((((MODE) & (uint32_t)0xFFFFFFF3) == 0x00) && \
147                               ((MODE) != (uint32_t)0x00))
148 /**
149   * @}
150   */
151 
152 /** @defgroup USART_Hardware_Flow_Control
153   * @{
154   */
155 
156 #define USART_HardwareFlowControl_None       ((uint32_t)0x00000000)
157 #define USART_HardwareFlowControl_RTS        USART_CR3_RTSE
158 #define USART_HardwareFlowControl_CTS        USART_CR3_CTSE
159 #define USART_HardwareFlowControl_RTS_CTS    (USART_CR3_RTSE | USART_CR3_CTSE)
160 #define IS_USART_HARDWARE_FLOW_CONTROL(CONTROL)\
161                               (((CONTROL) == USART_HardwareFlowControl_None) || \
162                                ((CONTROL) == USART_HardwareFlowControl_RTS) || \
163                                ((CONTROL) == USART_HardwareFlowControl_CTS) || \
164                                ((CONTROL) == USART_HardwareFlowControl_RTS_CTS))
165 /**
166   * @}
167   */
168 
169 /** @defgroup USART_Clock
170   * @{
171   */
172 
173 #define USART_Clock_Disable                  ((uint32_t)0x00000000)
174 #define USART_Clock_Enable                   USART_CR2_CLKEN
175 #define IS_USART_CLOCK(CLOCK) (((CLOCK) == USART_Clock_Disable) || \
176                                ((CLOCK) == USART_Clock_Enable))
177 /**
178   * @}
179   */
180 
181 /** @defgroup USART_Clock_Polarity
182   * @{
183   */
184 
185 #define USART_CPOL_Low                       ((uint32_t)0x00000000)
186 #define USART_CPOL_High                      USART_CR2_CPOL
187 #define IS_USART_CPOL(CPOL) (((CPOL) == USART_CPOL_Low) || ((CPOL) == USART_CPOL_High))
188 
189 /**
190   * @}
191   */
192 
193 /** @defgroup USART_Clock_Phase
194   * @{
195   */
196 
197 #define USART_CPHA_1Edge                     ((uint32_t)0x00000000)
198 #define USART_CPHA_2Edge                     USART_CR2_CPHA
199 #define IS_USART_CPHA(CPHA) (((CPHA) == USART_CPHA_1Edge) || ((CPHA) == USART_CPHA_2Edge))
200 
201 /**
202   * @}
203   */
204 
205 /** @defgroup USART_Last_Bit
206   * @{
207   */
208 
209 #define USART_LastBit_Disable                ((uint32_t)0x00000000)
210 #define USART_LastBit_Enable                 USART_CR2_LBCL
211 #define IS_USART_LASTBIT(LASTBIT) (((LASTBIT) == USART_LastBit_Disable) || \
212                                    ((LASTBIT) == USART_LastBit_Enable))
213 /**
214   * @}
215   */
216 
217 /** @defgroup USART_DMA_Requests
218   * @{
219   */
220 
221 #define USART_DMAReq_Tx                      USART_CR3_DMAT
222 #define USART_DMAReq_Rx                      USART_CR3_DMAR
223 #define IS_USART_DMAREQ(DMAREQ) ((((DMAREQ) & (uint32_t)0xFFFFFF3F) == 0x00) && \
224                                   ((DMAREQ) != (uint32_t)0x00))
225 
226 /**
227   * @}
228   */
229 
230 /** @defgroup USART_DMA_Recception_Error
231   * @{
232   */
233 
234 #define USART_DMAOnError_Enable              ((uint32_t)0x00000000)
235 #define USART_DMAOnError_Disable             USART_CR3_DDRE
236 #define IS_USART_DMAONERROR(DMAERROR) (((DMAERROR) == USART_DMAOnError_Disable)|| \
237                                        ((DMAERROR) == USART_DMAOnError_Enable))
238 /**
239   * @}
240   */
241 
242 /** @defgroup USART_MuteMode_WakeUp_methods
243   * @{
244   */
245 
246 #define USART_WakeUp_IdleLine                ((uint32_t)0x00000000)
247 #define USART_WakeUp_AddressMark             USART_CR1_WAKE
248 #define IS_USART_MUTEMODE_WAKEUP(WAKEUP) (((WAKEUP) == USART_WakeUp_IdleLine) || \
249                                           ((WAKEUP) == USART_WakeUp_AddressMark))
250 /**
251   * @}
252   */
253 
254 /** @defgroup USART_Address_Detection
255   * @{
256   */
257 
258 #define USART_AddressLength_4b               ((uint32_t)0x00000000)
259 #define USART_AddressLength_7b               USART_CR2_ADDM7
260 #define IS_USART_ADDRESS_DETECTION(ADDRESS) (((ADDRESS) == USART_AddressLength_4b) || \
261                                              ((ADDRESS) == USART_AddressLength_7b))
262 /**
263   * @}
264   */
265 
266 /**
267   * @}
268   */
269 
270 /**
271   * @}
272   */
273 
274 /** @defgroup USART_IrDA_Low_Power
275   * @{
276   */
277 
278 #define USART_IrDAMode_LowPower              USART_CR3_IRLP
279 #define USART_IrDAMode_Normal                ((uint32_t)0x00000000)
280 #define IS_USART_IRDA_MODE(MODE) (((MODE) == USART_IrDAMode_LowPower) || \
281                                   ((MODE) == USART_IrDAMode_Normal))
282 /**
283   * @}
284   */
285 
286 /** @defgroup USART_DE_Polarity
287   * @{
288   */
289 
290 #define USART_DEPolarity_High                ((uint32_t)0x00000000)
291 #define USART_DEPolarity_Low                 USART_CR3_DEP
292 #define IS_USART_DE_POLARITY(POLARITY) (((POLARITY) == USART_DEPolarity_Low) || \
293                                         ((POLARITY) == USART_DEPolarity_High))
294 /**
295   * @}
296   */
297 
298 /** @defgroup USART_Inversion_Pins
299   * @{
300   */
301 
302 #define USART_InvPin_Tx                      USART_CR2_TXINV
303 #define USART_InvPin_Rx                      USART_CR2_RXINV
304 #define IS_USART_INVERSTION_PIN(PIN) ((((PIN) & (uint32_t)0xFFFCFFFF) == 0x00) && \
305                                        ((PIN) != (uint32_t)0x00))
306 
307 /**
308   * @}
309   */
310 
311 /** @defgroup USART_AutoBaudRate_Mode
312   * @{
313   */
314 
315 #define USART_AutoBaudRate_StartBit          ((uint32_t)0x00000000)
316 #define USART_AutoBaudRate_FallingEdge       USART_CR2_ABRMODE_0
317 #define IS_USART_AUTOBAUDRATE_MODE(MODE) (((MODE) == USART_AutoBaudRate_StartBit) || \
318                                           ((MODE) == USART_AutoBaudRate_FallingEdge))
319 /**
320   * @}
321   */
322 
323 /** @defgroup USART_OVR_DETECTION
324   * @{
325   */
326 
327 #define USART_OVRDetection_Enable            ((uint32_t)0x00000000)
328 #define USART_OVRDetection_Disable           USART_CR3_OVRDIS
329 #define IS_USART_OVRDETECTION(OVR) (((OVR) == USART_OVRDetection_Enable)|| \
330                                     ((OVR) == USART_OVRDetection_Disable))
331 /**
332   * @}
333   */
334 /** @defgroup USART_Request
335   * @{
336   */
337 
338 #define USART_Request_ABRRQ                  USART_RQR_ABRRQ
339 #define USART_Request_SBKRQ                  USART_RQR_SBKRQ
340 #define USART_Request_MMRQ                   USART_RQR_MMRQ
341 #define USART_Request_RXFRQ                  USART_RQR_RXFRQ
342 #define USART_Request_TXFRQ                  USART_RQR_TXFRQ
343 
344 #define IS_USART_REQUEST(REQUEST) (((REQUEST) == USART_Request_TXFRQ) || \
345                                    ((REQUEST) == USART_Request_RXFRQ) || \
346                                    ((REQUEST) == USART_Request_MMRQ) || \
347                                    ((REQUEST) == USART_Request_SBKRQ) || \
348                                    ((REQUEST) == USART_Request_ABRRQ))
349 /**
350   * @}
351   */
352 
353 /** @defgroup USART_Flags
354   * @{
355   */
356 #define USART_FLAG_REACK                     USART_ISR_REACK
357 #define USART_FLAG_TEACK                     USART_ISR_TEACK
358 #define USART_FLAG_WU                        USART_ISR_WUF
359 #define USART_FLAG_RWU                       USART_ISR_RWU
360 #define USART_FLAG_SBK                       USART_ISR_SBKF
361 #define USART_FLAG_CM                        USART_ISR_CMF
362 #define USART_FLAG_BUSY                      USART_ISR_BUSY
363 #define USART_FLAG_ABRF                      USART_ISR_ABRF
364 #define USART_FLAG_ABRE                      USART_ISR_ABRE
365 #define USART_FLAG_EOB                       USART_ISR_EOBF
366 #define USART_FLAG_RTO                       USART_ISR_RTOF
367 #define USART_FLAG_nCTSS                     USART_ISR_CTS
368 #define USART_FLAG_CTS                       USART_ISR_CTSIF
369 #define USART_FLAG_LBD                       USART_ISR_LBD
370 #define USART_FLAG_TXE                       USART_ISR_TXE
371 #define USART_FLAG_TC                        USART_ISR_TC
372 #define USART_FLAG_RXNE                      USART_ISR_RXNE
373 #define USART_FLAG_IDLE                      USART_ISR_IDLE
374 #define USART_FLAG_ORE                       USART_ISR_ORE
375 #define USART_FLAG_NE                        USART_ISR_NE
376 #define USART_FLAG_FE                        USART_ISR_FE
377 #define USART_FLAG_PE                        USART_ISR_PE
378 #define IS_USART_FLAG(FLAG) (((FLAG) == USART_FLAG_PE) || ((FLAG) == USART_FLAG_TXE) || \
379                              ((FLAG) == USART_FLAG_TC) || ((FLAG) == USART_FLAG_RXNE) || \
380                              ((FLAG) == USART_FLAG_IDLE) || ((FLAG) == USART_FLAG_LBD) || \
381                              ((FLAG) == USART_FLAG_CTS) || ((FLAG) == USART_FLAG_ORE) || \
382                              ((FLAG) == USART_FLAG_NE) || ((FLAG) == USART_FLAG_FE) || \
383                              ((FLAG) == USART_FLAG_nCTSS) || ((FLAG) == USART_FLAG_RTO) || \
384                              ((FLAG) == USART_FLAG_EOB) || ((FLAG) == USART_FLAG_ABRE) || \
385                              ((FLAG) == USART_FLAG_ABRF) || ((FLAG) == USART_FLAG_BUSY) || \
386                              ((FLAG) == USART_FLAG_CM) || ((FLAG) == USART_FLAG_SBK) || \
387                              ((FLAG) == USART_FLAG_RWU) || ((FLAG) == USART_FLAG_WU) || \
388                              ((FLAG) == USART_FLAG_TEACK)|| ((FLAG) == USART_FLAG_REACK))
389 
390 #define IS_USART_CLEAR_FLAG(FLAG) (((FLAG) == USART_FLAG_WU) || ((FLAG) == USART_FLAG_TC) || \
391                                    ((FLAG) == USART_FLAG_IDLE) || ((FLAG) == USART_FLAG_ORE) || \
392                                    ((FLAG) == USART_FLAG_NE) || ((FLAG) == USART_FLAG_FE) || \
393                                    ((FLAG) == USART_FLAG_LBD) || ((FLAG) == USART_FLAG_CTS) || \
394                                    ((FLAG) == USART_FLAG_RTO) || ((FLAG) == USART_FLAG_EOB) || \
395                                    ((FLAG) == USART_FLAG_CM) || ((FLAG) == USART_FLAG_PE))
396 /**
397   * @}
398   */
399 
400 /** @defgroup USART_Interrupt_definition
401   * @brief USART Interrupt definition
402   * USART_IT possible values
403   * Elements values convention: 0xZZZZYYXX
404   *   XX: Position of the corresponding Interrupt
405   *   YY: Register index
406   *   ZZZZ: Flag position
407   * @{
408   */
409 
410 #define USART_IT_WU                          ((uint32_t)0x00140316)
411 #define USART_IT_CM                          ((uint32_t)0x0011010E)
412 #define USART_IT_EOB                         ((uint32_t)0x000C011B)
413 #define USART_IT_RTO                         ((uint32_t)0x000B011A)
414 #define USART_IT_PE                          ((uint32_t)0x00000108)
415 #define USART_IT_TXE                         ((uint32_t)0x00070107)
416 #define USART_IT_TC                          ((uint32_t)0x00060106)
417 #define USART_IT_RXNE                        ((uint32_t)0x00050105)
418 #define USART_IT_IDLE                        ((uint32_t)0x00040104)
419 #define USART_IT_LBD                         ((uint32_t)0x00080206)
420 #define USART_IT_CTS                         ((uint32_t)0x0009030A)
421 #define USART_IT_ERR                         ((uint32_t)0x00000300)
422 #define USART_IT_ORE                         ((uint32_t)0x00030300)
423 #define USART_IT_NE                          ((uint32_t)0x00020300)
424 #define USART_IT_FE                          ((uint32_t)0x00010300)
425 
426 #define IS_USART_CONFIG_IT(IT) (((IT) == USART_IT_PE) || ((IT) == USART_IT_TXE) || \
427                                 ((IT) == USART_IT_TC) || ((IT) == USART_IT_RXNE) || \
428                                 ((IT) == USART_IT_IDLE) || ((IT) == USART_IT_LBD) || \
429                                 ((IT) == USART_IT_CTS) || ((IT) == USART_IT_ERR) || \
430                                 ((IT) == USART_IT_RTO) || ((IT) == USART_IT_EOB) || \
431                                 ((IT) == USART_IT_CM) || ((IT) == USART_IT_WU))
432 
433 #define IS_USART_GET_IT(IT) (((IT) == USART_IT_PE) || ((IT) == USART_IT_TXE) || \
434                              ((IT) == USART_IT_TC) || ((IT) == USART_IT_RXNE) || \
435                              ((IT) == USART_IT_IDLE) || ((IT) == USART_IT_LBD) || \
436                              ((IT) == USART_IT_CTS) || ((IT) == USART_IT_ORE) || \
437                              ((IT) == USART_IT_NE) || ((IT) == USART_IT_FE) || \
438                              ((IT) == USART_IT_RTO) || ((IT) == USART_IT_EOB) || \
439                              ((IT) == USART_IT_CM) || ((IT) == USART_IT_WU))
440 
441 #define IS_USART_CLEAR_IT(IT) (((IT) == USART_IT_TC) || ((IT) == USART_IT_PE) || \
442                                ((IT) == USART_IT_FE) || ((IT) == USART_IT_NE) || \
443                                ((IT) == USART_IT_ORE) || ((IT) == USART_IT_IDLE) || \
444                                ((IT) == USART_IT_LBD) || ((IT) == USART_IT_CTS) || \
445                                ((IT) == USART_IT_RTO) || ((IT) == USART_IT_EOB) || \
446                                ((IT) == USART_IT_CM) || ((IT) == USART_IT_WU))
447 /**
448   * @}
449   */
450 
451 /** @defgroup USART_Global_definition
452   * @{
453   */
454 
455 #define IS_USART_BAUDRATE(BAUDRATE) (((BAUDRATE) > 0) && ((BAUDRATE) < 0x005B8D81))
456 #define IS_USART_DE_ASSERTION_DEASSERTION_TIME(TIME) ((TIME) <= 0x1F)
457 #define IS_USART_AUTO_RETRY_COUNTER(COUNTER) ((COUNTER) <= 0x7)
458 #define IS_USART_TIMEOUT(TIMEOUT) ((TIMEOUT) <= 0x00FFFFFF)
459 #define IS_USART_DATA(DATA) ((DATA) <= 0x1FF)
460 
461 /**
462   * @}
463   */
464 
465 /**
466   * @}
467   */
468 
469 /* Exported macro ------------------------------------------------------------*/
470 /* Exported functions ------------------------------------------------------- */
471 
472 /* Initialization and Configuration functions *********************************/
473 void USART_DeInit(USART_TypeDef* USARTx);
474 void USART_Init(USART_TypeDef* USARTx, USART_InitTypeDef* USART_InitStruct);
475 void USART_StructInit(USART_InitTypeDef* USART_InitStruct);
476 void USART_ClockInit(USART_TypeDef* USARTx, USART_ClockInitTypeDef* USART_ClockInitStruct);
477 void USART_ClockStructInit(USART_ClockInitTypeDef* USART_ClockInitStruct);
478 void USART_Cmd(USART_TypeDef* USARTx, FunctionalState NewState);
479 void USART_DirectionModeCmd(USART_TypeDef* USARTx, uint32_t USART_DirectionMode, FunctionalState NewState);
480 void USART_OverSampling8Cmd(USART_TypeDef* USARTx, FunctionalState NewState);
481 void USART_OneBitMethodCmd(USART_TypeDef* USARTx, FunctionalState NewState);
482 void USART_MSBFirstCmd(USART_TypeDef* USARTx, FunctionalState NewState);
483 void USART_DataInvCmd(USART_TypeDef* USARTx, FunctionalState NewState);
484 void USART_InvPinCmd(USART_TypeDef* USARTx, uint32_t USART_InvPin, FunctionalState NewState);
485 void USART_SWAPPinCmd(USART_TypeDef* USARTx, FunctionalState NewState);
486 void USART_ReceiverTimeOutCmd(USART_TypeDef* USARTx, FunctionalState NewState);
487 void USART_SetReceiverTimeOut(USART_TypeDef* USARTx, uint32_t USART_ReceiverTimeOut);
488 
489 /* AutoBaudRate functions *****************************************************/
490 void USART_AutoBaudRateCmd(USART_TypeDef* USARTx, FunctionalState NewState);
491 void USART_AutoBaudRateConfig(USART_TypeDef* USARTx, uint32_t USART_AutoBaudRate);
492 
493 /* Data transfers functions ***************************************************/
494 void USART_SendData(USART_TypeDef* USARTx, uint16_t Data);
495 uint16_t USART_ReceiveData(USART_TypeDef* USARTx);
496 
497 /* Multi-Processor Communication functions ************************************/
498 void USART_SetAddress(USART_TypeDef* USARTx, uint8_t USART_Address);
499 void USART_MuteModeWakeUpConfig(USART_TypeDef* USARTx, uint32_t USART_WakeUp);
500 void USART_MuteModeCmd(USART_TypeDef* USARTx, FunctionalState NewState);
501 void USART_AddressDetectionConfig(USART_TypeDef* USARTx, uint32_t USART_AddressLength);
502 
503 /* Half-duplex mode function **************************************************/
504 void USART_HalfDuplexCmd(USART_TypeDef* USARTx, FunctionalState NewState);
505 
506 /* RS485 mode functions *******************************************************/
507 void USART_DECmd(USART_TypeDef* USARTx, FunctionalState NewState);
508 void USART_DEPolarityConfig(USART_TypeDef* USARTx, uint32_t USART_DEPolarity);
509 void USART_SetDEAssertionTime(USART_TypeDef* USARTx, uint32_t USART_DEAssertionTime);
510 void USART_SetDEDeassertionTime(USART_TypeDef* USARTx, uint32_t USART_DEDeassertionTime);
511 
512 /* DMA transfers management functions *****************************************/
513 void USART_DMACmd(USART_TypeDef* USARTx, uint32_t USART_DMAReq, FunctionalState NewState);
514 void USART_DMAReceptionErrorConfig(USART_TypeDef* USARTx, uint32_t USART_DMAOnError);
515 
516 /* Interrupts and flags management functions **********************************/
517 void USART_ITConfig(USART_TypeDef* USARTx, uint32_t USART_IT, FunctionalState NewState);
518 void USART_RequestCmd(USART_TypeDef* USARTx, uint32_t USART_Request, FunctionalState NewState);
519 void USART_OverrunDetectionConfig(USART_TypeDef* USARTx, uint32_t USART_OVRDetection);
520 FlagStatus USART_GetFlagStatus(USART_TypeDef* USARTx, uint32_t USART_FLAG);
521 void USART_ClearFlag(USART_TypeDef* USARTx, uint32_t USART_FLAG);
522 ITStatus USART_GetITStatus(USART_TypeDef* USARTx, uint32_t USART_IT);
523 void USART_ClearITPendingBit(USART_TypeDef* USARTx, uint32_t USART_IT);
524 
525 #ifdef __cplusplus
526 }
527 #endif
528 
529 #endif /* __FT32F0XX_USART_H */
530 
531 /**
532   * @}
533   */
534 
535 /**
536   * @}
537   */
538 
539 /************************ (C) COPYRIGHT FMD *****END OF FILE****/
540