STM8S/A Standard Peripherals Drivers
|
Functions | |
void | UART2_ClearFlag (UART2_Flag_TypeDef UART2_FLAG) |
Clears the UART2 flags. | |
void | UART2_ClearITPendingBit (UART2_IT_TypeDef UART2_IT) |
Clears the UART2 pending flags. | |
void | UART2_Cmd (FunctionalState NewState) |
Enable the UART2 peripheral. | |
void | UART2_DeInit (void) |
Deinitializes the UART peripheral. | |
FlagStatus | UART2_GetFlagStatus (UART2_Flag_TypeDef UART2_FLAG) |
Checks whether the specified UART2 flag is set or not. | |
ITStatus | UART2_GetITStatus (UART2_IT_TypeDef UART2_IT) |
Checks whether the specified UART2 interrupt has occurred or not. | |
void | UART2_Init (uint32_t BaudRate, UART2_WordLength_TypeDef WordLength, UART2_StopBits_TypeDef StopBits, UART2_Parity_TypeDef Parity, UART2_SyncMode_TypeDef SyncMode, UART2_Mode_TypeDef Mode) |
Initializes the UART2 according to the specified parameters. | |
void | UART2_IrDACmd (FunctionalState NewState) |
Enables or disables the UART2�s IrDA interface. | |
void | UART2_IrDAConfig (UART2_IrDAMode_TypeDef UART2_IrDAMode) |
Configures the UART2�s IrDA interface. | |
void | UART2_ITConfig (UART2_IT_TypeDef UART2_IT, FunctionalState NewState) |
Enables or disables the specified UART2 interrupts. | |
void | UART2_LINBreakDetectionConfig (UART2_LINBreakDetectionLength_TypeDef UART2_LINBreakDetectionLength) |
Sets the UART2 LIN Break detection length. | |
void | UART2_LINCmd (FunctionalState NewState) |
Enables or disables the UART2 LIN mode. | |
void | UART2_LINConfig (UART2_LinMode_TypeDef UART2_Mode, UART2_LinAutosync_TypeDef UART2_Autosync, UART2_LinDivUp_TypeDef UART2_DivUp) |
Configure the UART2 peripheral. | |
uint8_t | UART2_ReceiveData8 (void) |
Returns the most recent received data by the UART2 peripheral. | |
uint16_t | UART2_ReceiveData9 (void) |
Returns the most recent received data by the UART2 peripheral. | |
void | UART2_ReceiverWakeUpCmd (FunctionalState NewState) |
Determines if the UART2 is in mute mode or not. | |
void | UART2_SendBreak (void) |
Transmits break characters. | |
void | UART2_SendData8 (uint8_t Data) |
Transmits 8 bit data through the UART2 peripheral. | |
void | UART2_SendData9 (uint16_t Data) |
Transmits 9 bit data through the UART2 peripheral. | |
void | UART2_SetAddress (uint8_t UART2_Address) |
Sets the address of the UART2 node. | |
void | UART2_SetGuardTime (uint8_t UART2_GuardTime) |
Sets the specified UART2 guard time. | |
void | UART2_SetPrescaler (uint8_t UART2_Prescaler) |
Sets the system clock prescaler. | |
void | UART2_SmartCardCmd (FunctionalState NewState) |
Enables or disables the UART2 Smart Card mode. | |
void | UART2_SmartCardNACKCmd (FunctionalState NewState) |
Enables or disables NACK transmission. | |
void | UART2_WakeUpConfig (UART2_WakeUp_TypeDef UART2_WakeUp) |
Selects the UART2 WakeUp method. |
Function Documentation
void UART2_ClearFlag | ( | UART2_Flag_TypeDef | UART2_FLAG | ) |
Clears the UART2 flags.
- Note:
- :
- PE (Parity error), FE (Framing error), NE (Noise error), OR (OverRun error) and IDLE (Idle line detected) flags are cleared by software sequence: a read operation to UART2_SR register (UART2_GetFlagStatus())followed by a read operation to UART2_DR register(UART2_ReceiveData8() or UART2_ReceiveData9()).
- RXNE flag can be also cleared by a read to the UART2_DR register (UART2_ReceiveData8()or UART2_ReceiveData9()).
- TC flag can be also cleared by software sequence: a read operation to UART2_SR register (UART2_GetFlagStatus()) followed by a write operation to UART2_DR register (UART2_SendData8() or UART2_SendData9()).
- TXE flag is cleared only by a write to the UART2_DR register (UART2_SendData8() or UART2_SendData9()).
- SBK flag is cleared during the stop bit of break.
- Return values:
-
None
Definition at line 699 of file stm8s_uart2.c.
References IS_UART2_CLEAR_FLAG_OK, UART2_CR4_LBDF, UART2_CR6_LHDF, UART2_CR6_LSF, UART2_FLAG_LBDF, UART2_FLAG_LHDF, UART2_FLAG_RXNE, and UART2_SR_RXNE.
void UART2_ClearITPendingBit | ( | UART2_IT_TypeDef | UART2_IT | ) |
Clears the UART2 pending flags.
- Note:
- PE (Parity error), FE (Framing error), NE (Noise error), OR (OverRun error) and IDLE (Idle line detected) pending bits are cleared by software sequence: a read operation to UART2_SR register (UART2_GetITStatus()) followed by a read operation to UART2_DR register (UART2_ReceiveData8() or UART2_ReceiveData9()).
- RXNE pending bit can be also cleared by a read to the UART2_DR register (UART2_ReceiveData8() or UART2_ReceiveData9()).
- TC (Transmit complete) pending bit can be cleared by software sequence: a read operation to UART2_SR register (UART2_GetITStatus()) followed by a write operation to UART2_DR register (UART2_SendData8()or UART2_SendData9()).
- TXE pending bit is cleared only by a write to the UART2_DR register (UART2_SendData8() or UART2_SendData9()).
- Return values:
-
None
Definition at line 852 of file stm8s_uart2.c.
References IS_UART2_CLEAR_IT_OK, UART2_CR4_LBDF, UART2_CR6_LHDF, UART2_IT_LBDF, UART2_IT_RXNE, and UART2_SR_RXNE.
void UART2_Cmd | ( | FunctionalState | NewState | ) |
Enable the UART2 peripheral.
Definition at line 181 of file stm8s_uart2.c.
References DISABLE, and UART2_CR1_UARTD.
void UART2_DeInit | ( | void | ) |
Deinitializes the UART peripheral.
Definition at line 53 of file stm8s_uart2.c.
References UART2_BRR1_RESET_VALUE, UART2_BRR2_RESET_VALUE, UART2_CR1_RESET_VALUE, UART2_CR2_RESET_VALUE, UART2_CR3_RESET_VALUE, UART2_CR4_RESET_VALUE, UART2_CR5_RESET_VALUE, and UART2_CR6_RESET_VALUE.
FlagStatus UART2_GetFlagStatus | ( | UART2_Flag_TypeDef | UART2_FLAG | ) |
Checks whether the specified UART2 flag is set or not.
Definition at line 606 of file stm8s_uart2.c.
References IS_UART2_FLAG_OK, RESET, SET, UART2_FLAG_LBDF, UART2_FLAG_LHDF, UART2_FLAG_LSF, and UART2_FLAG_SBK.
ITStatus UART2_GetITStatus | ( | UART2_IT_TypeDef | UART2_IT | ) |
Checks whether the specified UART2 interrupt has occurred or not.
Definition at line 738 of file stm8s_uart2.c.
References IS_UART2_GET_IT_OK, RESET, SET, UART2_IT_LBDF, UART2_IT_LHDF, and UART2_IT_PE.
void UART2_Init | ( | uint32_t | BaudRate, |
UART2_WordLength_TypeDef | WordLength, | ||
UART2_StopBits_TypeDef | StopBits, | ||
UART2_Parity_TypeDef | Parity, | ||
UART2_SyncMode_TypeDef | SyncMode, | ||
UART2_Mode_TypeDef | Mode | ||
) |
Initializes the UART2 according to the specified parameters.
Definition at line 85 of file stm8s_uart2.c.
References CLK_GetClockFreq(), IS_UART2_BAUDRATE_OK, IS_UART2_MODE_OK, IS_UART2_PARITY_OK, IS_UART2_STOPBITS_OK, IS_UART2_SYNCMODE_OK, IS_UART2_WORDLENGTH_OK, UART2_BRR1_DIVM, UART2_BRR2_DIVF, UART2_BRR2_DIVM, UART2_CR1_M, UART2_CR1_PCEN, UART2_CR1_PS, UART2_CR2_REN, UART2_CR2_TEN, UART2_CR3_CKEN, UART2_CR3_CPHA, UART2_CR3_CPOL, UART2_CR3_LBCL, UART2_CR3_STOP, UART2_MODE_RX_ENABLE, UART2_MODE_TX_ENABLE, and UART2_SYNCMODE_CLOCK_DISABLE.
void UART2_IrDACmd | ( | FunctionalState | NewState | ) |
Enables or disables the UART2�s IrDA interface.
Definition at line 292 of file stm8s_uart2.c.
References DISABLE, IS_FUNCTIONALSTATE_OK, and UART2_CR5_IREN.
void UART2_IrDAConfig | ( | UART2_IrDAMode_TypeDef | UART2_IrDAMode | ) |
Configures the UART2�s IrDA interface.
Definition at line 272 of file stm8s_uart2.c.
References IS_UART2_IRDAMODE_OK, UART2_CR5_IRLP, and UART2_IRDAMODE_NORMAL.
void UART2_ITConfig | ( | UART2_IT_TypeDef | UART2_IT, |
FunctionalState | NewState | ||
) |
Enables or disables the specified UART2 interrupts.
Definition at line 210 of file stm8s_uart2.c.
References DISABLE, IS_FUNCTIONALSTATE_OK, and IS_UART2_CONFIG_IT_OK.
void UART2_LINBreakDetectionConfig | ( | UART2_LINBreakDetectionLength_TypeDef | UART2_LINBreakDetectionLength | ) |
Sets the UART2 LIN Break detection length.
Definition at line 316 of file stm8s_uart2.c.
References IS_UART2_LINBREAKDETECTIONLENGTH_OK, UART2_CR4_LBDL, and UART2_LINBREAKDETECTIONLENGTH_10BITS.
void UART2_LINCmd | ( | FunctionalState | NewState | ) |
Enables or disables the UART2 LIN mode.
Definition at line 384 of file stm8s_uart2.c.
References DISABLE, IS_FUNCTIONALSTATE_OK, and UART2_CR3_LINEN.
void UART2_LINConfig | ( | UART2_LinMode_TypeDef | UART2_Mode, |
UART2_LinAutosync_TypeDef | UART2_Autosync, | ||
UART2_LinDivUp_TypeDef | UART2_DivUp | ||
) |
Configure the UART2 peripheral.
Definition at line 341 of file stm8s_uart2.c.
References IS_UART2_AUTOSYNC_OK, IS_UART2_DIVUP_OK, IS_UART2_SLAVE_OK, UART2_CR6_LASE, UART2_CR6_LDUM, UART2_CR6_LSLV, UART2_LIN_AUTOSYNC_DISABLE, UART2_LIN_DIVUP_LBRR1, and UART2_LIN_MODE_MASTER.
uint8_t UART2_ReceiveData8 | ( | void | ) |
Returns the most recent received data by the UART2 peripheral.
Definition at line 487 of file stm8s_uart2.c.
uint16_t UART2_ReceiveData9 | ( | void | ) |
Returns the most recent received data by the UART2 peripheral.
Definition at line 497 of file stm8s_uart2.c.
References UART2_CR1_R8.
void UART2_ReceiverWakeUpCmd | ( | FunctionalState | NewState | ) |
Determines if the UART2 is in mute mode or not.
Definition at line 466 of file stm8s_uart2.c.
References DISABLE, IS_FUNCTIONALSTATE_OK, and UART2_CR2_RWU.
void UART2_SendBreak | ( | void | ) |
void UART2_SendData8 | ( | uint8_t | Data | ) |
Transmits 8 bit data through the UART2 peripheral.
Definition at line 511 of file stm8s_uart2.c.
void UART2_SendData9 | ( | uint16_t | Data | ) |
Transmits 9 bit data through the UART2 peripheral.
Definition at line 522 of file stm8s_uart2.c.
References UART2_CR1_T8.
void UART2_SetAddress | ( | uint8_t | UART2_Address | ) |
Sets the address of the UART2 node.
Definition at line 549 of file stm8s_uart2.c.
References IS_UART2_ADDRESS_OK, and UART2_CR4_ADD.
void UART2_SetGuardTime | ( | uint8_t | UART2_GuardTime | ) |
Sets the specified UART2 guard time.
- Note:
- SmartCard Mode should be Enabled
Definition at line 566 of file stm8s_uart2.c.
void UART2_SetPrescaler | ( | uint8_t | UART2_Prescaler | ) |
Sets the system clock prescaler.
- Note:
- IrDA Low Power mode or smartcard mode should be enabled
- This function is related to SmartCard and IrDa mode.
Definition at line 594 of file stm8s_uart2.c.
void UART2_SmartCardCmd | ( | FunctionalState | NewState | ) |
Enables or disables the UART2 Smart Card mode.
Definition at line 406 of file stm8s_uart2.c.
References DISABLE, IS_FUNCTIONALSTATE_OK, and UART2_CR5_SCEN.
void UART2_SmartCardNACKCmd | ( | FunctionalState | NewState | ) |
Enables or disables NACK transmission.
Definition at line 429 of file stm8s_uart2.c.
References DISABLE, IS_FUNCTIONALSTATE_OK, and UART2_CR5_NACK.
void UART2_WakeUpConfig | ( | UART2_WakeUp_TypeDef | UART2_WakeUp | ) |
Selects the UART2 WakeUp method.
Definition at line 452 of file stm8s_uart2.c.
References IS_UART2_WAKEUP_OK, and UART2_CR1_WAKE.