2 ******************************************************************************
3 * @file stm32f30x_usart.h
4 * @author MCD Application Team
7 * @brief This file contains all the functions prototypes for the USART
9 ******************************************************************************
12 * <h2><center>© COPYRIGHT 2014 STMicroelectronics</center></h2>
14 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
15 * You may not use this file except in compliance with the License.
16 * You may obtain a copy of the License at:
18 * http://www.st.com/software_license_agreement_liberty_v2
20 * Unless required by applicable law or agreed to in writing, software
21 * distributed under the License is distributed on an "AS IS" BASIS,
22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 * See the License for the specific language governing permissions and
24 * limitations under the License.
26 ******************************************************************************
29 /* Define to prevent recursive inclusion -------------------------------------*/
30 #ifndef __STM32F30x_USART_H
31 #define __STM32F30x_USART_H
37 /* Includes ------------------------------------------------------------------*/
38 #include "stm32f30x.h"
40 /** @addtogroup STM32F30x_StdPeriph_Driver
48 /* Exported types ------------------------------------------------------------*/
53 * @brief USART Init Structure definition
58 uint32_t USART_BaudRate
; /*!< This member configures the USART communication baud rate.
59 The baud rate is computed using the following formula:
60 - IntegerDivider = ((PCLKx) / (16 * (USART_InitStruct->USART_BaudRate)))
61 - FractionalDivider = ((IntegerDivider - ((uint32_t) IntegerDivider)) * 16) + 0.5 */
63 uint32_t USART_WordLength
; /*!< Specifies the number of data bits transmitted or received in a frame.
64 This parameter can be a value of @ref USART_Word_Length */
66 uint32_t USART_StopBits
; /*!< Specifies the number of stop bits transmitted.
67 This parameter can be a value of @ref USART_Stop_Bits */
69 uint32_t USART_Parity
; /*!< Specifies the parity mode.
70 This parameter can be a value of @ref USART_Parity
71 @note When parity is enabled, the computed parity is inserted
72 at the MSB position of the transmitted data (9th bit when
73 the word length is set to 9 data bits; 8th bit when the
74 word length is set to 8 data bits). */
76 uint32_t USART_Mode
; /*!< Specifies wether the Receive or Transmit mode is enabled or disabled.
77 This parameter can be a value of @ref USART_Mode */
79 uint32_t USART_HardwareFlowControl
; /*!< Specifies wether the hardware flow control mode is enabled
81 This parameter can be a value of @ref USART_Hardware_Flow_Control*/
85 * @brief USART Clock Init Structure definition
90 uint32_t USART_Clock
; /*!< Specifies whether the USART clock is enabled or disabled.
91 This parameter can be a value of @ref USART_Clock */
93 uint32_t USART_CPOL
; /*!< Specifies the steady state of the serial clock.
94 This parameter can be a value of @ref USART_Clock_Polarity */
96 uint32_t USART_CPHA
; /*!< Specifies the clock transition on which the bit capture is made.
97 This parameter can be a value of @ref USART_Clock_Phase */
99 uint32_t USART_LastBit
; /*!< Specifies whether the clock pulse corresponding to the last transmitted
100 data bit (MSB) has to be output on the SCLK pin in synchronous mode.
101 This parameter can be a value of @ref USART_Last_Bit */
102 } USART_ClockInitTypeDef
;
104 /* Exported constants --------------------------------------------------------*/
106 /** @defgroup USART_Exported_Constants
110 #define IS_USART_ALL_PERIPH(PERIPH) (((PERIPH) == USART1) || \
111 ((PERIPH) == USART2) || \
112 ((PERIPH) == USART3) || \
113 ((PERIPH) == UART4) || \
116 #define IS_USART_123_PERIPH(PERIPH) (((PERIPH) == USART1) || \
117 ((PERIPH) == USART2) || \
118 ((PERIPH) == USART3))
120 #define IS_USART_1234_PERIPH(PERIPH) (((PERIPH) == USART1) || \
121 ((PERIPH) == USART2) || \
122 ((PERIPH) == USART3) || \
126 /** @defgroup USART_Word_Length
130 #define USART_WordLength_8b ((uint32_t)0x00000000)
131 #define USART_WordLength_9b USART_CR1_M
132 #define IS_USART_WORD_LENGTH(LENGTH) (((LENGTH) == USART_WordLength_8b) || \
133 ((LENGTH) == USART_WordLength_9b))
138 /** @defgroup USART_Stop_Bits
142 #define USART_StopBits_1 ((uint32_t)0x00000000)
143 #define USART_StopBits_2 USART_CR2_STOP_1
144 #define USART_StopBits_1_5 (USART_CR2_STOP_0 | USART_CR2_STOP_1)
145 #define IS_USART_STOPBITS(STOPBITS) (((STOPBITS) == USART_StopBits_1) || \
146 ((STOPBITS) == USART_StopBits_2) || \
147 ((STOPBITS) == USART_StopBits_1_5))
152 /** @defgroup USART_Parity
156 #define USART_Parity_No ((uint32_t)0x00000000)
157 #define USART_Parity_Even USART_CR1_PCE
158 #define USART_Parity_Odd (USART_CR1_PCE | USART_CR1_PS)
159 #define IS_USART_PARITY(PARITY) (((PARITY) == USART_Parity_No) || \
160 ((PARITY) == USART_Parity_Even) || \
161 ((PARITY) == USART_Parity_Odd))
166 /** @defgroup USART_Mode
170 #define USART_Mode_Rx USART_CR1_RE
171 #define USART_Mode_Tx USART_CR1_TE
172 #define IS_USART_MODE(MODE) ((((MODE) & (uint32_t)0xFFFFFFF3) == 0x00) && \
173 ((MODE) != (uint32_t)0x00))
178 /** @defgroup USART_Hardware_Flow_Control
182 #define USART_HardwareFlowControl_None ((uint32_t)0x00000000)
183 #define USART_HardwareFlowControl_RTS USART_CR3_RTSE
184 #define USART_HardwareFlowControl_CTS USART_CR3_CTSE
185 #define USART_HardwareFlowControl_RTS_CTS (USART_CR3_RTSE | USART_CR3_CTSE)
186 #define IS_USART_HARDWARE_FLOW_CONTROL(CONTROL)\
187 (((CONTROL) == USART_HardwareFlowControl_None) || \
188 ((CONTROL) == USART_HardwareFlowControl_RTS) || \
189 ((CONTROL) == USART_HardwareFlowControl_CTS) || \
190 ((CONTROL) == USART_HardwareFlowControl_RTS_CTS))
195 /** @defgroup USART_Clock
199 #define USART_Clock_Disable ((uint32_t)0x00000000)
200 #define USART_Clock_Enable USART_CR2_CLKEN
201 #define IS_USART_CLOCK(CLOCK) (((CLOCK) == USART_Clock_Disable) || \
202 ((CLOCK) == USART_Clock_Enable))
207 /** @defgroup USART_Clock_Polarity
211 #define USART_CPOL_Low ((uint32_t)0x00000000)
212 #define USART_CPOL_High USART_CR2_CPOL
213 #define IS_USART_CPOL(CPOL) (((CPOL) == USART_CPOL_Low) || ((CPOL) == USART_CPOL_High))
219 /** @defgroup USART_Clock_Phase
223 #define USART_CPHA_1Edge ((uint32_t)0x00000000)
224 #define USART_CPHA_2Edge USART_CR2_CPHA
225 #define IS_USART_CPHA(CPHA) (((CPHA) == USART_CPHA_1Edge) || ((CPHA) == USART_CPHA_2Edge))
231 /** @defgroup USART_Last_Bit
235 #define USART_LastBit_Disable ((uint32_t)0x00000000)
236 #define USART_LastBit_Enable USART_CR2_LBCL
237 #define IS_USART_LASTBIT(LASTBIT) (((LASTBIT) == USART_LastBit_Disable) || \
238 ((LASTBIT) == USART_LastBit_Enable))
243 /** @defgroup USART_DMA_Requests
247 #define USART_DMAReq_Tx USART_CR3_DMAT
248 #define USART_DMAReq_Rx USART_CR3_DMAR
249 #define IS_USART_DMAREQ(DMAREQ) ((((DMAREQ) & (uint32_t)0xFFFFFF3F) == 0x00) && \
250 ((DMAREQ) != (uint32_t)0x00))
256 /** @defgroup USART_DMA_Recception_Error
260 #define USART_DMAOnError_Enable ((uint32_t)0x00000000)
261 #define USART_DMAOnError_Disable USART_CR3_DDRE
262 #define IS_USART_DMAONERROR(DMAERROR) (((DMAERROR) == USART_DMAOnError_Disable)|| \
263 ((DMAERROR) == USART_DMAOnError_Enable))
268 /** @defgroup USART_MuteMode_WakeUp_methods
272 #define USART_WakeUp_IdleLine ((uint32_t)0x00000000)
273 #define USART_WakeUp_AddressMark USART_CR1_WAKE
274 #define IS_USART_MUTEMODE_WAKEUP(WAKEUP) (((WAKEUP) == USART_WakeUp_IdleLine) || \
275 ((WAKEUP) == USART_WakeUp_AddressMark))
280 /** @defgroup USART_Address_Detection
284 #define USART_AddressLength_4b ((uint32_t)0x00000000)
285 #define USART_AddressLength_7b USART_CR2_ADDM7
286 #define IS_USART_ADDRESS_DETECTION(ADDRESS) (((ADDRESS) == USART_AddressLength_4b) || \
287 ((ADDRESS) == USART_AddressLength_7b))
292 /** @defgroup USART_StopMode_WakeUp_methods
296 #define USART_WakeUpSource_AddressMatch ((uint32_t)0x00000000)
297 #define USART_WakeUpSource_StartBit USART_CR3_WUS_1
298 #define USART_WakeUpSource_RXNE (uint32_t)(USART_CR3_WUS_0 | USART_CR3_WUS_1)
299 #define IS_USART_STOPMODE_WAKEUPSOURCE(SOURCE) (((SOURCE) == USART_WakeUpSource_AddressMatch) || \
300 ((SOURCE) == USART_WakeUpSource_StartBit) || \
301 ((SOURCE) == USART_WakeUpSource_RXNE))
306 /** @defgroup USART_LIN_Break_Detection_Length
310 #define USART_LINBreakDetectLength_10b ((uint32_t)0x00000000)
311 #define USART_LINBreakDetectLength_11b USART_CR2_LBDL
312 #define IS_USART_LIN_BREAK_DETECT_LENGTH(LENGTH) \
313 (((LENGTH) == USART_LINBreakDetectLength_10b) || \
314 ((LENGTH) == USART_LINBreakDetectLength_11b))
319 /** @defgroup USART_IrDA_Low_Power
323 #define USART_IrDAMode_LowPower USART_CR3_IRLP
324 #define USART_IrDAMode_Normal ((uint32_t)0x00000000)
325 #define IS_USART_IRDA_MODE(MODE) (((MODE) == USART_IrDAMode_LowPower) || \
326 ((MODE) == USART_IrDAMode_Normal))
331 /** @defgroup USART_DE_Polarity
335 #define USART_DEPolarity_High ((uint32_t)0x00000000)
336 #define USART_DEPolarity_Low USART_CR3_DEP
337 #define IS_USART_DE_POLARITY(POLARITY) (((POLARITY) == USART_DEPolarity_Low) || \
338 ((POLARITY) == USART_DEPolarity_High))
343 /** @defgroup USART_Inversion_Pins
347 #define USART_InvPin_Tx USART_CR2_TXINV
348 #define USART_InvPin_Rx USART_CR2_RXINV
349 #define IS_USART_INVERSTION_PIN(PIN) ((((PIN) & (uint32_t)0xFFFCFFFF) == 0x00) && \
350 ((PIN) != (uint32_t)0x00))
356 /** @defgroup USART_AutoBaudRate_Mode
360 #define USART_AutoBaudRate_StartBit ((uint32_t)0x00000000)
361 #define USART_AutoBaudRate_FallingEdge USART_CR2_ABRMODE_0
362 #define USART_AutoBaudRate_0x7FFrame USART_CR2_ABRMODE_1
363 #define USART_AutoBaudRate_0x55Frame (USART_CR2_ABRMODE_0 | USART_CR2_ABRMODE_1)
364 #define IS_USART_AUTOBAUDRATE_MODE(MODE) (((MODE) == USART_AutoBaudRate_StartBit) || \
365 ((MODE) == USART_AutoBaudRate_FallingEdge) || \
366 ((MODE) == USART_AutoBaudRate_0x7FFrame) || \
367 ((MODE) == USART_AutoBaudRate_0x55Frame))
372 /** @defgroup USART_OVR_DETECTION
376 #define USART_OVRDetection_Enable ((uint32_t)0x00000000)
377 #define USART_OVRDetection_Disable USART_CR3_OVRDIS
378 #define IS_USART_OVRDETECTION(OVR) (((OVR) == USART_OVRDetection_Enable)|| \
379 ((OVR) == USART_OVRDetection_Disable))
383 /** @defgroup USART_Request
387 #define USART_Request_ABRRQ USART_RQR_ABRRQ
388 #define USART_Request_SBKRQ USART_RQR_SBKRQ
389 #define USART_Request_MMRQ USART_RQR_MMRQ
390 #define USART_Request_RXFRQ USART_RQR_RXFRQ
391 #define USART_Request_TXFRQ USART_RQR_TXFRQ
393 #define IS_USART_REQUEST(REQUEST) (((REQUEST) == USART_Request_TXFRQ) || \
394 ((REQUEST) == USART_Request_RXFRQ) || \
395 ((REQUEST) == USART_Request_MMRQ) || \
396 ((REQUEST) == USART_Request_SBKRQ) || \
397 ((REQUEST) == USART_Request_ABRRQ))
402 /** @defgroup USART_Flags
405 #define USART_FLAG_REACK USART_ISR_REACK
406 #define USART_FLAG_TEACK USART_ISR_TEACK
407 #define USART_FLAG_WU USART_ISR_WUF
408 #define USART_FLAG_RWU USART_ISR_RWU
409 #define USART_FLAG_SBK USART_ISR_SBKF
410 #define USART_FLAG_CM USART_ISR_CMF
411 #define USART_FLAG_BUSY USART_ISR_BUSY
412 #define USART_FLAG_ABRF USART_ISR_ABRF
413 #define USART_FLAG_ABRE USART_ISR_ABRE
414 #define USART_FLAG_EOB USART_ISR_EOBF
415 #define USART_FLAG_RTO USART_ISR_RTOF
416 #define USART_FLAG_nCTSS USART_ISR_CTS
417 #define USART_FLAG_CTS USART_ISR_CTSIF
418 #define USART_FLAG_LBD USART_ISR_LBD
419 #define USART_FLAG_TXE USART_ISR_TXE
420 #define USART_FLAG_TC USART_ISR_TC
421 #define USART_FLAG_RXNE USART_ISR_RXNE
422 #define USART_FLAG_IDLE USART_ISR_IDLE
423 #define USART_FLAG_ORE USART_ISR_ORE
424 #define USART_FLAG_NE USART_ISR_NE
425 #define USART_FLAG_FE USART_ISR_FE
426 #define USART_FLAG_PE USART_ISR_PE
427 #define IS_USART_FLAG(FLAG) (((FLAG) == USART_FLAG_PE) || ((FLAG) == USART_FLAG_TXE) || \
428 ((FLAG) == USART_FLAG_TC) || ((FLAG) == USART_FLAG_RXNE) || \
429 ((FLAG) == USART_FLAG_IDLE) || ((FLAG) == USART_FLAG_LBD) || \
430 ((FLAG) == USART_FLAG_CTS) || ((FLAG) == USART_FLAG_ORE) || \
431 ((FLAG) == USART_FLAG_NE) || ((FLAG) == USART_FLAG_FE) || \
432 ((FLAG) == USART_FLAG_nCTSS) || ((FLAG) == USART_FLAG_RTO) || \
433 ((FLAG) == USART_FLAG_EOB) || ((FLAG) == USART_FLAG_ABRE) || \
434 ((FLAG) == USART_FLAG_ABRF) || ((FLAG) == USART_FLAG_BUSY) || \
435 ((FLAG) == USART_FLAG_CM) || ((FLAG) == USART_FLAG_SBK) || \
436 ((FLAG) == USART_FLAG_RWU) || ((FLAG) == USART_FLAG_WU) || \
437 ((FLAG) == USART_FLAG_TEACK)|| ((FLAG) == USART_FLAG_REACK))
439 #define IS_USART_CLEAR_FLAG(FLAG) (((FLAG) == USART_FLAG_WU) || ((FLAG) == USART_FLAG_TC) || \
440 ((FLAG) == USART_FLAG_IDLE) || ((FLAG) == USART_FLAG_ORE) || \
441 ((FLAG) == USART_FLAG_NE) || ((FLAG) == USART_FLAG_FE) || \
442 ((FLAG) == USART_FLAG_LBD) || ((FLAG) == USART_FLAG_CTS) || \
443 ((FLAG) == USART_FLAG_RTO) || ((FLAG) == USART_FLAG_EOB) || \
444 ((FLAG) == USART_FLAG_CM) || ((FLAG) == USART_FLAG_PE))
449 /** @defgroup USART_Interrupt_definition
450 * @brief USART Interrupt definition
451 * USART_IT possible values
452 * Elements values convention: 0xZZZZYYXX
453 * XX: Position of the corresponding Interrupt
455 * ZZZZ: Flag position
459 #define USART_IT_WU ((uint32_t)0x00140316)
460 #define USART_IT_CM ((uint32_t)0x0011010E)
461 #define USART_IT_EOB ((uint32_t)0x000C011B)
462 #define USART_IT_RTO ((uint32_t)0x000B011A)
463 #define USART_IT_PE ((uint32_t)0x00000108)
464 #define USART_IT_TXE ((uint32_t)0x00070107)
465 #define USART_IT_TC ((uint32_t)0x00060106)
466 #define USART_IT_RXNE ((uint32_t)0x00050105)
467 #define USART_IT_IDLE ((uint32_t)0x00040104)
468 #define USART_IT_LBD ((uint32_t)0x00080206)
469 #define USART_IT_CTS ((uint32_t)0x0009030A)
470 #define USART_IT_ERR ((uint32_t)0x00000300)
471 #define USART_IT_ORE ((uint32_t)0x00030300)
472 #define USART_IT_NE ((uint32_t)0x00020300)
473 #define USART_IT_FE ((uint32_t)0x00010300)
475 #define IS_USART_CONFIG_IT(IT) (((IT) == USART_IT_PE) || ((IT) == USART_IT_TXE) || \
476 ((IT) == USART_IT_TC) || ((IT) == USART_IT_RXNE) || \
477 ((IT) == USART_IT_IDLE) || ((IT) == USART_IT_LBD) || \
478 ((IT) == USART_IT_CTS) || ((IT) == USART_IT_ERR) || \
479 ((IT) == USART_IT_RTO) || ((IT) == USART_IT_EOB) || \
480 ((IT) == USART_IT_CM) || ((IT) == USART_IT_WU))
482 #define IS_USART_GET_IT(IT) (((IT) == USART_IT_PE) || ((IT) == USART_IT_TXE) || \
483 ((IT) == USART_IT_TC) || ((IT) == USART_IT_RXNE) || \
484 ((IT) == USART_IT_IDLE) || ((IT) == USART_IT_LBD) || \
485 ((IT) == USART_IT_CTS) || ((IT) == USART_IT_ORE) || \
486 ((IT) == USART_IT_NE) || ((IT) == USART_IT_FE) || \
487 ((IT) == USART_IT_RTO) || ((IT) == USART_IT_EOB) || \
488 ((IT) == USART_IT_CM) || ((IT) == USART_IT_WU))
490 #define IS_USART_CLEAR_IT(IT) (((IT) == USART_IT_TC) || ((IT) == USART_IT_PE) || \
491 ((IT) == USART_IT_FE) || ((IT) == USART_IT_NE) || \
492 ((IT) == USART_IT_ORE) || ((IT) == USART_IT_IDLE) || \
493 ((IT) == USART_IT_LBD) || ((IT) == USART_IT_CTS) || \
494 ((IT) == USART_IT_RTO) || ((IT) == USART_IT_EOB) || \
495 ((IT) == USART_IT_CM) || ((IT) == USART_IT_WU))
500 /** @defgroup USART_Global_definition
504 #define IS_USART_BAUDRATE(BAUDRATE) (((BAUDRATE) > 0) && ((BAUDRATE) < 0x005B8D81))
505 #define IS_USART_DE_ASSERTION_DEASSERTION_TIME(TIME) ((TIME) <= 0x1F)
506 #define IS_USART_AUTO_RETRY_COUNTER(COUNTER) ((COUNTER) <= 0x7)
507 #define IS_USART_TIMEOUT(TIMEOUT) ((TIMEOUT) <= 0x00FFFFFF)
508 #define IS_USART_DATA(DATA) ((DATA) <= 0x1FF)
518 /* Exported macro ------------------------------------------------------------*/
519 /* Exported functions ------------------------------------------------------- */
521 /* Initialization and Configuration functions *********************************/
522 void USART_DeInit(USART_TypeDef
* USARTx
);
523 void USART_Init(USART_TypeDef
* USARTx
, USART_InitTypeDef
* USART_InitStruct
);
524 void USART_StructInit(USART_InitTypeDef
* USART_InitStruct
);
525 void USART_ClockInit(USART_TypeDef
* USARTx
, USART_ClockInitTypeDef
* USART_ClockInitStruct
);
526 void USART_ClockStructInit(USART_ClockInitTypeDef
* USART_ClockInitStruct
);
527 void USART_Cmd(USART_TypeDef
* USARTx
, FunctionalState NewState
);
528 void USART_DirectionModeCmd(USART_TypeDef
* USARTx
, uint32_t USART_DirectionMode
, FunctionalState NewState
);
529 void USART_SetPrescaler(USART_TypeDef
* USARTx
, uint8_t USART_Prescaler
);
530 void USART_OverSampling8Cmd(USART_TypeDef
* USARTx
, FunctionalState NewState
);
531 void USART_OneBitMethodCmd(USART_TypeDef
* USARTx
, FunctionalState NewState
);
532 void USART_MSBFirstCmd(USART_TypeDef
* USARTx
, FunctionalState NewState
);
533 void USART_DataInvCmd(USART_TypeDef
* USARTx
, FunctionalState NewState
);
534 void USART_InvPinCmd(USART_TypeDef
* USARTx
, uint32_t USART_InvPin
, FunctionalState NewState
);
535 void USART_SWAPPinCmd(USART_TypeDef
* USARTx
, FunctionalState NewState
);
536 void USART_ReceiverTimeOutCmd(USART_TypeDef
* USARTx
, FunctionalState NewState
);
537 void USART_SetReceiverTimeOut(USART_TypeDef
* USARTx
, uint32_t USART_ReceiverTimeOut
);
539 /* STOP Mode functions ********************************************************/
540 void USART_STOPModeCmd(USART_TypeDef
* USARTx
, FunctionalState NewState
);
541 void USART_StopModeWakeUpSourceConfig(USART_TypeDef
* USARTx
, uint32_t USART_WakeUpSource
);
543 /* AutoBaudRate functions *****************************************************/
544 void USART_AutoBaudRateCmd(USART_TypeDef
* USARTx
, FunctionalState NewState
);
545 void USART_AutoBaudRateConfig(USART_TypeDef
* USARTx
, uint32_t USART_AutoBaudRate
);
547 /* Data transfers functions ***************************************************/
548 void USART_SendData(USART_TypeDef
* USARTx
, uint16_t Data
);
549 uint16_t USART_ReceiveData(USART_TypeDef
* USARTx
);
551 /* Multi-Processor Communication functions ************************************/
552 void USART_SetAddress(USART_TypeDef
* USARTx
, uint8_t USART_Address
);
553 void USART_MuteModeWakeUpConfig(USART_TypeDef
* USARTx
, uint32_t USART_WakeUp
);
554 void USART_MuteModeCmd(USART_TypeDef
* USARTx
, FunctionalState NewState
);
555 void USART_AddressDetectionConfig(USART_TypeDef
* USARTx
, uint32_t USART_AddressLength
);
556 /* LIN mode functions *********************************************************/
557 void USART_LINBreakDetectLengthConfig(USART_TypeDef
* USARTx
, uint32_t USART_LINBreakDetectLength
);
558 void USART_LINCmd(USART_TypeDef
* USARTx
, FunctionalState NewState
);
560 /* Half-duplex mode function **************************************************/
561 void USART_HalfDuplexCmd(USART_TypeDef
* USARTx
, FunctionalState NewState
);
563 /* Smartcard mode functions ***************************************************/
564 void USART_SmartCardCmd(USART_TypeDef
* USARTx
, FunctionalState NewState
);
565 void USART_SmartCardNACKCmd(USART_TypeDef
* USARTx
, FunctionalState NewState
);
566 void USART_SetGuardTime(USART_TypeDef
* USARTx
, uint8_t USART_GuardTime
);
567 void USART_SetAutoRetryCount(USART_TypeDef
* USARTx
, uint8_t USART_AutoCount
);
568 void USART_SetBlockLength(USART_TypeDef
* USARTx
, uint8_t USART_BlockLength
);
570 /* IrDA mode functions ********************************************************/
571 void USART_IrDAConfig(USART_TypeDef
* USARTx
, uint32_t USART_IrDAMode
);
572 void USART_IrDACmd(USART_TypeDef
* USARTx
, FunctionalState NewState
);
574 /* RS485 mode functions *******************************************************/
575 void USART_DECmd(USART_TypeDef
* USARTx
, FunctionalState NewState
);
576 void USART_DEPolarityConfig(USART_TypeDef
* USARTx
, uint32_t USART_DEPolarity
);
577 void USART_SetDEAssertionTime(USART_TypeDef
* USARTx
, uint32_t USART_DEAssertionTime
);
578 void USART_SetDEDeassertionTime(USART_TypeDef
* USARTx
, uint32_t USART_DEDeassertionTime
);
580 /* DMA transfers management functions *****************************************/
581 void USART_DMACmd(USART_TypeDef
* USARTx
, uint32_t USART_DMAReq
, FunctionalState NewState
);
582 void USART_DMAReceptionErrorConfig(USART_TypeDef
* USARTx
, uint32_t USART_DMAOnError
);
584 /* Interrupts and flags management functions **********************************/
585 void USART_ITConfig(USART_TypeDef
* USARTx
, uint32_t USART_IT
, FunctionalState NewState
);
586 void USART_RequestCmd(USART_TypeDef
* USARTx
, uint32_t USART_Request
, FunctionalState NewState
);
587 void USART_OverrunDetectionConfig(USART_TypeDef
* USARTx
, uint32_t USART_OVRDetection
);
588 FlagStatus
USART_GetFlagStatus(USART_TypeDef
* USARTx
, uint32_t USART_FLAG
);
589 void USART_ClearFlag(USART_TypeDef
* USARTx
, uint32_t USART_FLAG
);
590 ITStatus
USART_GetITStatus(USART_TypeDef
* USARTx
, uint32_t USART_IT
);
591 void USART_ClearITPendingBit(USART_TypeDef
* USARTx
, uint32_t USART_IT
);
597 #endif /* __STM32F30x_USART_H */
607 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/