Functions | |
void | USART_DeInit (USART_TypeDef *USARTx) |
Deinitializes the USARTx peripheral registers to their default reset values. | |
void | USART_Init (USART_TypeDef *USARTx, USART_InitTypeDef *USART_InitStruct) |
Initializes the USARTx peripheral according to the specified parameters in the USART_InitStruct . | |
void | USART_StructInit (USART_InitTypeDef *USART_InitStruct) |
Fills each USART_InitStruct member with its default value. | |
void | USART_ClockInit (USART_TypeDef *USARTx, USART_ClockInitTypeDef *USART_ClockInitStruct) |
Initializes the USARTx peripheral Clock according to the specified parameters in the USART_ClockInitStruct . | |
void | USART_ClockStructInit (USART_ClockInitTypeDef *USART_ClockInitStruct) |
Fills each USART_ClockInitStruct member with its default value. | |
void | USART_Cmd (USART_TypeDef *USARTx, FunctionalState NewState) |
Enables or disables the specified USART peripheral. | |
void | USART_ITConfig (USART_TypeDef *USARTx, uint16_t USART_IT, FunctionalState NewState) |
Enables or disables the specified USART interrupts. | |
void | USART_DMACmd (USART_TypeDef *USARTx, uint16_t USART_DMAReq, FunctionalState NewState) |
Enables or disables the USART’s DMA interface. | |
void | USART_SetAddress (USART_TypeDef *USARTx, uint8_t USART_Address) |
Sets the address of the USART node. | |
void | USART_WakeUpConfig (USART_TypeDef *USARTx, uint16_t USART_WakeUp) |
Selects the USART WakeUp method. | |
void | USART_ReceiverWakeUpCmd (USART_TypeDef *USARTx, FunctionalState NewState) |
Determines if the USART is in mute mode or not. | |
void | USART_LINBreakDetectLengthConfig (USART_TypeDef *USARTx, uint16_t USART_LINBreakDetectLength) |
Sets the USART LIN Break detection length. | |
void | USART_LINCmd (USART_TypeDef *USARTx, FunctionalState NewState) |
Enables or disables the USART’s LIN mode. | |
void | USART_SendData (USART_TypeDef *USARTx, uint16_t Data) |
Transmits single data through the USARTx peripheral. | |
uint16_t | USART_ReceiveData (USART_TypeDef *USARTx) |
Returns the most recent received data by the USARTx peripheral. | |
void | USART_SendBreak (USART_TypeDef *USARTx) |
Transmits break characters. | |
void | USART_SetGuardTime (USART_TypeDef *USARTx, uint8_t USART_GuardTime) |
Sets the specified USART guard time. | |
void | USART_SetPrescaler (USART_TypeDef *USARTx, uint8_t USART_Prescaler) |
Sets the system clock prescaler. | |
void | USART_SmartCardCmd (USART_TypeDef *USARTx, FunctionalState NewState) |
Enables or disables the USART’s Smart Card mode. | |
void | USART_SmartCardNACKCmd (USART_TypeDef *USARTx, FunctionalState NewState) |
Enables or disables NACK transmission. | |
void | USART_HalfDuplexCmd (USART_TypeDef *USARTx, FunctionalState NewState) |
Enables or disables the USART’s Half Duplex communication. | |
void | USART_OverSampling8Cmd (USART_TypeDef *USARTx, FunctionalState NewState) |
Enables or disables the USART's 8x oversampling mode. | |
void | USART_OneBitMethodCmd (USART_TypeDef *USARTx, FunctionalState NewState) |
Enables or disables the USART's one bit sampling methode. | |
void | USART_IrDAConfig (USART_TypeDef *USARTx, uint16_t USART_IrDAMode) |
Configures the USART’s IrDA interface. | |
void | USART_IrDACmd (USART_TypeDef *USARTx, FunctionalState NewState) |
Enables or disables the USART’s IrDA interface. | |
FlagStatus | USART_GetFlagStatus (USART_TypeDef *USARTx, uint16_t USART_FLAG) |
Checks whether the specified USART flag is set or not. | |
void | USART_ClearFlag (USART_TypeDef *USARTx, uint16_t USART_FLAG) |
Clears the USARTx's pending flags. | |
ITStatus | USART_GetITStatus (USART_TypeDef *USARTx, uint16_t USART_IT) |
Checks whether the specified USART interrupt has occurred or not. | |
void | USART_ClearITPendingBit (USART_TypeDef *USARTx, uint16_t USART_IT) |
Clears the USARTx’s interrupt pending bits. |
void USART_DeInit | ( | USART_TypeDef * | USARTx | ) |
Deinitializes the USARTx peripheral registers to their default reset values.
USARTx,: | Select the USART or the UART peripheral. This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5. |
None |
References assert_param, DISABLE, ENABLE, IS_USART_ALL_PERIPH, RCC_APB1Periph_UART4, RCC_APB1Periph_UART5, RCC_APB1Periph_USART2, RCC_APB1Periph_USART3, RCC_APB1PeriphResetCmd(), RCC_APB2Periph_USART1, RCC_APB2PeriphResetCmd(), UART4, UART5, USART1, USART2, and USART3.
void USART_Init | ( | USART_TypeDef * | USARTx, |
USART_InitTypeDef * | USART_InitStruct | ||
) |
Initializes the USARTx peripheral according to the specified parameters in the USART_InitStruct .
USARTx,: | Select the USART or the UART peripheral. This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5. |
USART_InitStruct,: | pointer to a USART_InitTypeDef structure that contains the configuration information for the specified USART peripheral. |
None |
References assert_param, USART_TypeDef::BRR, USART_TypeDef::CR1, CR1_CLEAR_Mask, CR1_OVER8_Set, USART_TypeDef::CR2, CR2_STOP_CLEAR_Mask, USART_TypeDef::CR3, CR3_CLEAR_Mask, IS_USART_123_PERIPH, IS_USART_ALL_PERIPH, IS_USART_BAUDRATE, IS_USART_HARDWARE_FLOW_CONTROL, IS_USART_MODE, IS_USART_PARITY, IS_USART_STOPBITS, IS_USART_WORD_LENGTH, RCC_ClocksTypeDef::PCLK1_Frequency, RCC_ClocksTypeDef::PCLK2_Frequency, RCC_GetClocksFreq(), USART1_BASE, USART_InitTypeDef::USART_BaudRate, USART_InitTypeDef::USART_HardwareFlowControl, USART_HardwareFlowControl_None, USART_InitTypeDef::USART_Mode, USART_InitTypeDef::USART_Parity, USART_InitTypeDef::USART_StopBits, and USART_InitTypeDef::USART_WordLength.
void USART_StructInit | ( | USART_InitTypeDef * | USART_InitStruct | ) |
Fills each USART_InitStruct member with its default value.
USART_InitStruct,: | pointer to a USART_InitTypeDef structure which will be initialized. |
None |
References USART_InitTypeDef::USART_BaudRate, USART_InitTypeDef::USART_HardwareFlowControl, USART_HardwareFlowControl_None, USART_InitTypeDef::USART_Mode, USART_Mode_Rx, USART_Mode_Tx, USART_InitTypeDef::USART_Parity, USART_Parity_No, USART_InitTypeDef::USART_StopBits, USART_StopBits_1, USART_InitTypeDef::USART_WordLength, and USART_WordLength_8b.
void USART_ClockInit | ( | USART_TypeDef * | USARTx, |
USART_ClockInitTypeDef * | USART_ClockInitStruct | ||
) |
Initializes the USARTx peripheral Clock according to the specified parameters in the USART_ClockInitStruct .
USARTx,: | where x can be 1, 2, 3 to select the USART peripheral. |
USART_ClockInitStruct,: | pointer to a USART_ClockInitTypeDef structure that contains the configuration information for the specified USART peripheral. |
None |
References assert_param, USART_TypeDef::CR2, CR2_CLOCK_CLEAR_Mask, IS_USART_123_PERIPH, IS_USART_CLOCK, IS_USART_CPHA, IS_USART_CPOL, IS_USART_LASTBIT, USART_ClockInitTypeDef::USART_Clock, USART_ClockInitTypeDef::USART_CPHA, USART_ClockInitTypeDef::USART_CPOL, and USART_ClockInitTypeDef::USART_LastBit.
void USART_ClockStructInit | ( | USART_ClockInitTypeDef * | USART_ClockInitStruct | ) |
Fills each USART_ClockInitStruct member with its default value.
USART_ClockInitStruct,: | pointer to a USART_ClockInitTypeDef structure which will be initialized. |
None |
References USART_ClockInitTypeDef::USART_Clock, USART_Clock_Disable, USART_ClockInitTypeDef::USART_CPHA, USART_CPHA_1Edge, USART_ClockInitTypeDef::USART_CPOL, USART_CPOL_Low, USART_ClockInitTypeDef::USART_LastBit, and USART_LastBit_Disable.
void USART_Cmd | ( | USART_TypeDef * | USARTx, |
FunctionalState | NewState | ||
) |
Enables or disables the specified USART peripheral.
USARTx,: | Select the USART or the UART peripheral. This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5. |
NewState,: | new state of the USARTx peripheral. This parameter can be: ENABLE or DISABLE. |
None |
References assert_param, USART_TypeDef::CR1, CR1_UE_Reset, CR1_UE_Set, DISABLE, IS_FUNCTIONAL_STATE, and IS_USART_ALL_PERIPH.
void USART_ITConfig | ( | USART_TypeDef * | USARTx, |
uint16_t | USART_IT, | ||
FunctionalState | NewState | ||
) |
Enables or disables the specified USART interrupts.
USARTx,: | Select the USART or the UART peripheral. This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5. |
USART_IT,: | specifies the USART interrupt sources to be enabled or disabled. This parameter can be one of the following values:
|
NewState,: | new state of the specified USARTx interrupts. This parameter can be: ENABLE or DISABLE. |
None |
References __IO, assert_param, DISABLE, IS_FUNCTIONAL_STATE, IS_USART_123_PERIPH, IS_USART_ALL_PERIPH, IS_USART_CONFIG_IT, IT_Mask, and USART_IT_CTS.
void USART_DMACmd | ( | USART_TypeDef * | USARTx, |
uint16_t | USART_DMAReq, | ||
FunctionalState | NewState | ||
) |
Enables or disables the USART’s DMA interface.
USARTx,: | Select the USART or the UART peripheral. This parameter can be one of the following values: USART1, USART2, USART3 or UART4. |
USART_DMAReq,: | specifies the DMA request. This parameter can be any combination of the following values:
|
NewState,: | new state of the DMA Request sources. This parameter can be: ENABLE or DISABLE. |
None |
References assert_param, USART_TypeDef::CR3, DISABLE, IS_FUNCTIONAL_STATE, IS_USART_1234_PERIPH, and IS_USART_DMAREQ.
void USART_SetAddress | ( | USART_TypeDef * | USARTx, |
uint8_t | USART_Address | ||
) |
Sets the address of the USART node.
USARTx,: | Select the USART or the UART peripheral. This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5. |
USART_Address,: | Indicates the address of the USART node. |
None |
References assert_param, USART_TypeDef::CR2, CR2_Address_Mask, IS_USART_ADDRESS, and IS_USART_ALL_PERIPH.
void USART_WakeUpConfig | ( | USART_TypeDef * | USARTx, |
uint16_t | USART_WakeUp | ||
) |
Selects the USART WakeUp method.
USARTx,: | Select the USART or the UART peripheral. This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5. |
USART_WakeUp,: | specifies the USART wakeup method. This parameter can be one of the following values:
|
None |
References assert_param, USART_TypeDef::CR1, CR1_WAKE_Mask, IS_USART_ALL_PERIPH, and IS_USART_WAKEUP.
void USART_ReceiverWakeUpCmd | ( | USART_TypeDef * | USARTx, |
FunctionalState | NewState | ||
) |
Determines if the USART is in mute mode or not.
USARTx,: | Select the USART or the UART peripheral. This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5. |
NewState,: | new state of the USART mute mode. This parameter can be: ENABLE or DISABLE. |
None |
References assert_param, USART_TypeDef::CR1, CR1_RWU_Reset, CR1_RWU_Set, DISABLE, IS_FUNCTIONAL_STATE, and IS_USART_ALL_PERIPH.
void USART_LINBreakDetectLengthConfig | ( | USART_TypeDef * | USARTx, |
uint16_t | USART_LINBreakDetectLength | ||
) |
Sets the USART LIN Break detection length.
USARTx,: | Select the USART or the UART peripheral. This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5. |
USART_LINBreakDetectLength,: | specifies the LIN break detection length. This parameter can be one of the following values:
|
None |
References assert_param, USART_TypeDef::CR2, CR2_LBDL_Mask, IS_USART_ALL_PERIPH, and IS_USART_LIN_BREAK_DETECT_LENGTH.
void USART_LINCmd | ( | USART_TypeDef * | USARTx, |
FunctionalState | NewState | ||
) |
Enables or disables the USART’s LIN mode.
USARTx,: | Select the USART or the UART peripheral. This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5. |
NewState,: | new state of the USART LIN mode. This parameter can be: ENABLE or DISABLE. |
None |
References assert_param, USART_TypeDef::CR2, CR2_LINEN_Reset, CR2_LINEN_Set, DISABLE, IS_FUNCTIONAL_STATE, and IS_USART_ALL_PERIPH.
void USART_SendData | ( | USART_TypeDef * | USARTx, |
uint16_t | Data | ||
) |
Transmits single data through the USARTx peripheral.
USARTx,: | Select the USART or the UART peripheral. This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5. |
Data,: | the data to transmit. |
None |
References assert_param, USART_TypeDef::DR, IS_USART_ALL_PERIPH, and IS_USART_DATA.
uint16_t USART_ReceiveData | ( | USART_TypeDef * | USARTx | ) |
Returns the most recent received data by the USARTx peripheral.
USARTx,: | Select the USART or the UART peripheral. This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5. |
The | received data. |
References assert_param, USART_TypeDef::DR, and IS_USART_ALL_PERIPH.
void USART_SendBreak | ( | USART_TypeDef * | USARTx | ) |
Transmits break characters.
USARTx,: | Select the USART or the UART peripheral. This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5. |
None |
References assert_param, USART_TypeDef::CR1, CR1_SBK_Set, and IS_USART_ALL_PERIPH.
void USART_SetGuardTime | ( | USART_TypeDef * | USARTx, |
uint8_t | USART_GuardTime | ||
) |
Sets the specified USART guard time.
USARTx,: | where x can be 1, 2 or 3 to select the USART peripheral. |
USART_GuardTime,: | specifies the guard time. |
None |
References assert_param, USART_TypeDef::GTPR, GTPR_LSB_Mask, and IS_USART_123_PERIPH.
void USART_SetPrescaler | ( | USART_TypeDef * | USARTx, |
uint8_t | USART_Prescaler | ||
) |
Sets the system clock prescaler.
USARTx,: | Select the USART or the UART peripheral. This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5. |
USART_Prescaler,: | specifies the prescaler clock. |
None |
References assert_param, USART_TypeDef::GTPR, GTPR_MSB_Mask, and IS_USART_ALL_PERIPH.
void USART_SmartCardCmd | ( | USART_TypeDef * | USARTx, |
FunctionalState | NewState | ||
) |
Enables or disables the USART’s Smart Card mode.
USARTx,: | where x can be 1, 2 or 3 to select the USART peripheral. |
NewState,: | new state of the Smart Card mode. This parameter can be: ENABLE or DISABLE. |
None |
References assert_param, USART_TypeDef::CR3, CR3_SCEN_Reset, CR3_SCEN_Set, DISABLE, IS_FUNCTIONAL_STATE, and IS_USART_123_PERIPH.
void USART_SmartCardNACKCmd | ( | USART_TypeDef * | USARTx, |
FunctionalState | NewState | ||
) |
Enables or disables NACK transmission.
USARTx,: | where x can be 1, 2 or 3 to select the USART peripheral. |
NewState,: | new state of the NACK transmission. This parameter can be: ENABLE or DISABLE. |
None |
References assert_param, USART_TypeDef::CR3, CR3_NACK_Reset, CR3_NACK_Set, DISABLE, IS_FUNCTIONAL_STATE, and IS_USART_123_PERIPH.
void USART_HalfDuplexCmd | ( | USART_TypeDef * | USARTx, |
FunctionalState | NewState | ||
) |
Enables or disables the USART’s Half Duplex communication.
USARTx,: | Select the USART or the UART peripheral. This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5. |
NewState,: | new state of the USART Communication. This parameter can be: ENABLE or DISABLE. |
None |
References assert_param, USART_TypeDef::CR3, CR3_HDSEL_Reset, CR3_HDSEL_Set, DISABLE, IS_FUNCTIONAL_STATE, and IS_USART_ALL_PERIPH.
void USART_OverSampling8Cmd | ( | USART_TypeDef * | USARTx, |
FunctionalState | NewState | ||
) |
Enables or disables the USART's 8x oversampling mode.
USARTx,: | Select the USART or the UART peripheral. This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5. |
NewState,: | new state of the USART one bit sampling methode. This parameter can be: ENABLE or DISABLE. |
None |
References assert_param, USART_TypeDef::CR1, CR1_OVER8_Reset, CR1_OVER8_Set, DISABLE, IS_FUNCTIONAL_STATE, and IS_USART_ALL_PERIPH.
void USART_OneBitMethodCmd | ( | USART_TypeDef * | USARTx, |
FunctionalState | NewState | ||
) |
Enables or disables the USART's one bit sampling methode.
USARTx,: | Select the USART or the UART peripheral. This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5. |
NewState,: | new state of the USART one bit sampling methode. This parameter can be: ENABLE or DISABLE. |
None |
References assert_param, USART_TypeDef::CR3, CR3_ONEBITE_Reset, CR3_ONEBITE_Set, DISABLE, IS_FUNCTIONAL_STATE, and IS_USART_ALL_PERIPH.
void USART_IrDAConfig | ( | USART_TypeDef * | USARTx, |
uint16_t | USART_IrDAMode | ||
) |
Configures the USART’s IrDA interface.
USARTx,: | Select the USART or the UART peripheral. This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5. |
USART_IrDAMode,: | specifies the IrDA mode. This parameter can be one of the following values:
|
None |
References assert_param, USART_TypeDef::CR3, CR3_IRLP_Mask, IS_USART_ALL_PERIPH, and IS_USART_IRDA_MODE.
void USART_IrDACmd | ( | USART_TypeDef * | USARTx, |
FunctionalState | NewState | ||
) |
Enables or disables the USART’s IrDA interface.
USARTx,: | Select the USART or the UART peripheral. This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5. |
NewState,: | new state of the IrDA mode. This parameter can be: ENABLE or DISABLE. |
None |
References assert_param, USART_TypeDef::CR3, CR3_IREN_Reset, CR3_IREN_Set, DISABLE, IS_FUNCTIONAL_STATE, and IS_USART_ALL_PERIPH.
FlagStatus USART_GetFlagStatus | ( | USART_TypeDef * | USARTx, |
uint16_t | USART_FLAG | ||
) |
Checks whether the specified USART flag is set or not.
USARTx,: | Select the USART or the UART peripheral. This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5. |
USART_FLAG,: | specifies the flag to check. This parameter can be one of the following values:
|
The | new state of USART_FLAG (SET or RESET). |
References assert_param, IS_USART_123_PERIPH, IS_USART_ALL_PERIPH, IS_USART_FLAG, RESET, SET, USART_TypeDef::SR, and USART_FLAG_CTS.
void USART_ClearFlag | ( | USART_TypeDef * | USARTx, |
uint16_t | USART_FLAG | ||
) |
Clears the USARTx's pending flags.
USARTx,: | Select the USART or the UART peripheral. This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5. |
USART_FLAG,: | specifies the flag to clear. This parameter can be any combination of the following values:
|
None |
References assert_param, IS_USART_123_PERIPH, IS_USART_ALL_PERIPH, IS_USART_CLEAR_FLAG, USART_TypeDef::SR, and USART_FLAG_CTS.
ITStatus USART_GetITStatus | ( | USART_TypeDef * | USARTx, |
uint16_t | USART_IT | ||
) |
Checks whether the specified USART interrupt has occurred or not.
USARTx,: | Select the USART or the UART peripheral. This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5. |
USART_IT,: | specifies the USART interrupt source to check. This parameter can be one of the following values:
|
The | new state of USART_IT (SET or RESET). |
References assert_param, USART_TypeDef::CR1, USART_TypeDef::CR2, USART_TypeDef::CR3, IS_USART_123_PERIPH, IS_USART_ALL_PERIPH, IS_USART_GET_IT, IT_Mask, RESET, SET, USART_TypeDef::SR, and USART_IT_CTS.
void USART_ClearITPendingBit | ( | USART_TypeDef * | USARTx, |
uint16_t | USART_IT | ||
) |
Clears the USARTx’s interrupt pending bits.
USARTx,: | Select the USART or the UART peripheral. This parameter can be one of the following values: USART1, USART2, USART3, UART4 or UART5. |
USART_IT,: | specifies the interrupt pending bit to clear. This parameter can be one of the following values:
|
None |
References assert_param, IS_USART_123_PERIPH, IS_USART_ALL_PERIPH, IS_USART_CLEAR_IT, USART_TypeDef::SR, and USART_IT_CTS.