STM8S/A Standard Peripherals Drivers
|
Functions | |
void | UART1_ClearFlag (UART1_Flag_TypeDef UART1_FLAG) |
Clears the UART1 flags. | |
void | UART1_ClearITPendingBit (UART1_IT_TypeDef UART1_IT) |
Clears the UART1 pending flags. | |
void | UART1_Cmd (FunctionalState NewState) |
Enable the UART1 peripheral. | |
void | UART1_DeInit (void) |
Deinitializes the UART peripheral. | |
FlagStatus | UART1_GetFlagStatus (UART1_Flag_TypeDef UART1_FLAG) |
Checks whether the specified UART1 flag is set or not. | |
ITStatus | UART1_GetITStatus (UART1_IT_TypeDef UART1_IT) |
Checks whether the specified UART1 interrupt has occurred or not. | |
void | UART1_HalfDuplexCmd (FunctionalState NewState) |
Enables or disables the UART�s Half Duplex communication. | |
void | UART1_Init (uint32_t BaudRate, UART1_WordLength_TypeDef WordLength, UART1_StopBits_TypeDef StopBits, UART1_Parity_TypeDef Parity, UART1_SyncMode_TypeDef SyncMode, UART1_Mode_TypeDef Mode) |
Initializes the UART1 according to the specified parameters. | |
void | UART1_IrDACmd (FunctionalState NewState) |
Enables or disables the UART�s IrDA interface. | |
void | UART1_IrDAConfig (UART1_IrDAMode_TypeDef UART1_IrDAMode) |
Configures the UART�s IrDA interface. | |
void | UART1_ITConfig (UART1_IT_TypeDef UART1_IT, FunctionalState NewState) |
Enables or disables the specified USART interrupts. | |
void | UART1_LINBreakDetectionConfig (UART1_LINBreakDetectionLength_TypeDef UART1_LINBreakDetectionLength) |
Sets the UART1 LIN Break detection length. | |
void | UART1_LINCmd (FunctionalState NewState) |
Enables or disables the UART1�s LIN mode. | |
uint8_t | UART1_ReceiveData8 (void) |
Returns the most recent received data by the UART1 peripheral. | |
uint16_t | UART1_ReceiveData9 (void) |
Returns the most recent received data by the UART1 peripheral. | |
void | UART1_ReceiverWakeUpCmd (FunctionalState NewState) |
Determines if the UART1 is in mute mode or not. | |
void | UART1_SendBreak (void) |
Transmits break characters. | |
void | UART1_SendData8 (uint8_t Data) |
Transmits 8 bit data through the UART1 peripheral. | |
void | UART1_SendData9 (uint16_t Data) |
Transmits 9 bit data through the UART peripheral. | |
void | UART1_SetAddress (uint8_t UART1_Address) |
Sets the address of the UART1 node. | |
void | UART1_SetGuardTime (uint8_t UART1_GuardTime) |
Sets the specified UART guard time. | |
void | UART1_SetPrescaler (uint8_t UART1_Prescaler) |
Sets the system clock prescaler. | |
void | UART1_SmartCardCmd (FunctionalState NewState) |
Enables or disables the UART1 Smart Card mode. | |
void | UART1_SmartCardNACKCmd (FunctionalState NewState) |
Enables or disables NACK transmission. | |
void | UART1_WakeUpConfig (UART1_WakeUp_TypeDef UART1_WakeUp) |
Selects the UART1 WakeUp method. |
Function Documentation
void UART1_ClearFlag | ( | UART1_Flag_TypeDef | UART1_FLAG | ) |
Clears the UART1 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 UART1_SR register (UART1_GetFlagStatus())followed by a read operation to UART1_DR register(UART1_ReceiveData8() or UART1_ReceiveData9()).
- RXNE flag can be also cleared by a read to the UART1_DR register (UART1_ReceiveData8()or UART1_ReceiveData9()).
- TC flag can be also cleared by software sequence: a read operation to UART1_SR register (UART1_GetFlagStatus()) followed by a write operation to UART1_DR register (UART1_SendData8() or UART1_SendData9()).
- TXE flag is cleared only by a write to the UART1_DR register (UART1_SendData8() or UART1_SendData9()).
- SBK flag is cleared during the stop bit of break.
- Return values:
-
None
Definition at line 646 of file stm8s_uart1.c.
References IS_UART1_CLEAR_FLAG_OK, UART1_CR4_LBDF, UART1_FLAG_RXNE, and UART1_SR_RXNE.
void UART1_ClearITPendingBit | ( | UART1_IT_TypeDef | UART1_IT | ) |
Clears the UART1 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 UART1_SR register (UART1_GetITStatus()) followed by a read operation to UART1_DR register (UART1_ReceiveData8() or UART1_ReceiveData9()).
- RXNE pending bit can be also cleared by a read to the UART1_DR register (UART1_ReceiveData8() or UART1_ReceiveData9()).
- TC (Transmit complete) pending bit can be cleared by software sequence: a read operation to UART1_SR register (UART1_GetITStatus()) followed by a write operation to UART1_DR register (UART1_SendData8() or UART1_SendData9()).
- TXE pending bit is cleared only by a write to the UART1_DR register (UART1_SendData8() or UART1_SendData9()).
- Return values:
-
None
Definition at line 775 of file stm8s_uart1.c.
References IS_UART1_CLEAR_IT_OK, UART1_CR4_LBDF, UART1_IT_RXNE, and UART1_SR_RXNE.
void UART1_Cmd | ( | FunctionalState | NewState | ) |
Enable the UART1 peripheral.
Definition at line 184 of file stm8s_uart1.c.
References DISABLE, and UART1_CR1_UARTD.
void UART1_DeInit | ( | void | ) |
Deinitializes the UART peripheral.
Definition at line 53 of file stm8s_uart1.c.
References UART1_BRR1_RESET_VALUE, UART1_BRR2_RESET_VALUE, UART1_CR1_RESET_VALUE, UART1_CR2_RESET_VALUE, UART1_CR3_RESET_VALUE, UART1_CR4_RESET_VALUE, UART1_CR5_RESET_VALUE, UART1_GTR_RESET_VALUE, and UART1_PSCR_RESET_VALUE.
FlagStatus UART1_GetFlagStatus | ( | UART1_Flag_TypeDef | UART1_FLAG | ) |
Checks whether the specified UART1 flag is set or not.
Definition at line 568 of file stm8s_uart1.c.
References IS_UART1_FLAG_OK, RESET, SET, UART1_FLAG_LBDF, and UART1_FLAG_SBK.
ITStatus UART1_GetITStatus | ( | UART1_IT_TypeDef | UART1_IT | ) |
Checks whether the specified UART1 interrupt has occurred or not.
Definition at line 675 of file stm8s_uart1.c.
References IS_UART1_GET_IT_OK, RESET, SET, UART1_IT_LBDF, and UART1_IT_PE.
void UART1_HalfDuplexCmd | ( | FunctionalState | NewState | ) |
Enables or disables the UART�s Half Duplex communication.
< UART1 Half Duplex Enable
< UART1 Half Duplex Disable
Definition at line 265 of file stm8s_uart1.c.
References DISABLE, IS_FUNCTIONALSTATE_OK, and UART1_CR5_HDSEL.
void UART1_Init | ( | uint32_t | BaudRate, |
UART1_WordLength_TypeDef | WordLength, | ||
UART1_StopBits_TypeDef | StopBits, | ||
UART1_Parity_TypeDef | Parity, | ||
UART1_SyncMode_TypeDef | SyncMode, | ||
UART1_Mode_TypeDef | Mode | ||
) |
Initializes the UART1 according to the specified parameters.
- Note:
- Configure in Push Pull or Open Drain mode the Tx pin by setting the correct I/O Port register according the product package and line configuration
Definition at line 90 of file stm8s_uart1.c.
References CLK_GetClockFreq(), IS_UART1_BAUDRATE_OK, IS_UART1_MODE_OK, IS_UART1_PARITY_OK, IS_UART1_STOPBITS_OK, IS_UART1_SYNCMODE_OK, IS_UART1_WORDLENGTH_OK, UART1_BRR1_DIVM, UART1_BRR2_DIVF, UART1_BRR2_DIVM, UART1_CR1_M, UART1_CR1_PCEN, UART1_CR1_PS, UART1_CR2_REN, UART1_CR2_TEN, UART1_CR3_CKEN, UART1_CR3_CPHA, UART1_CR3_CPOL, UART1_CR3_LBCL, UART1_CR3_STOP, UART1_MODE_RX_ENABLE, UART1_MODE_TX_ENABLE, and UART1_SYNCMODE_CLOCK_DISABLE.
void UART1_IrDACmd | ( | FunctionalState | NewState | ) |
Enables or disables the UART�s IrDA interface.
Definition at line 305 of file stm8s_uart1.c.
References DISABLE, IS_FUNCTIONALSTATE_OK, and UART1_CR5_IREN.
void UART1_IrDAConfig | ( | UART1_IrDAMode_TypeDef | UART1_IrDAMode | ) |
Configures the UART�s IrDA interface.
Definition at line 285 of file stm8s_uart1.c.
References IS_UART1_IRDAMODE_OK, UART1_CR5_IRLP, and UART1_IRDAMODE_NORMAL.
void UART1_ITConfig | ( | UART1_IT_TypeDef | UART1_IT, |
FunctionalState | NewState | ||
) |
Enables or disables the specified USART interrupts.
< Enable the Interrupt bits according to UART1_IT mask
< Disable the interrupt bits according to UART1_IT mask
Definition at line 211 of file stm8s_uart1.c.
References DISABLE, IS_FUNCTIONALSTATE_OK, and IS_UART1_CONFIG_IT_OK.
void UART1_LINBreakDetectionConfig | ( | UART1_LINBreakDetectionLength_TypeDef | UART1_LINBreakDetectionLength | ) |
Sets the UART1 LIN Break detection length.
Definition at line 329 of file stm8s_uart1.c.
References IS_UART1_LINBREAKDETECTIONLENGTH_OK, UART1_CR4_LBDL, and UART1_LINBREAKDETECTIONLENGTH_10BITS.
void UART1_LINCmd | ( | FunctionalState | NewState | ) |
Enables or disables the UART1�s LIN mode.
Definition at line 349 of file stm8s_uart1.c.
References DISABLE, IS_FUNCTIONALSTATE_OK, and UART1_CR3_LINEN.
uint8_t UART1_ReceiveData8 | ( | void | ) |
Returns the most recent received data by the UART1 peripheral.
Definition at line 451 of file stm8s_uart1.c.
uint16_t UART1_ReceiveData9 | ( | void | ) |
Returns the most recent received data by the UART1 peripheral.
Definition at line 461 of file stm8s_uart1.c.
References UART1_CR1_R8.
void UART1_ReceiverWakeUpCmd | ( | FunctionalState | NewState | ) |
Determines if the UART1 is in mute mode or not.
Definition at line 430 of file stm8s_uart1.c.
References DISABLE, IS_FUNCTIONALSTATE_OK, and UART1_CR2_RWU.
void UART1_SendBreak | ( | void | ) |
void UART1_SendData8 | ( | uint8_t | Data | ) |
Transmits 8 bit data through the UART1 peripheral.
Definition at line 474 of file stm8s_uart1.c.
void UART1_SendData9 | ( | uint16_t | Data | ) |
Transmits 9 bit data through the UART peripheral.
< Clear the transmit data bit 8 [8]
< Write the transmit data bit [8]
< Write the transmit data bit [0:7]
Definition at line 486 of file stm8s_uart1.c.
References UART1_CR1_T8.
void UART1_SetAddress | ( | uint8_t | UART1_Address | ) |
Sets the address of the UART1 node.
Definition at line 511 of file stm8s_uart1.c.
References IS_UART1_ADDRESS_OK, and UART1_CR4_ADD.
void UART1_SetGuardTime | ( | uint8_t | UART1_GuardTime | ) |
Sets the specified UART guard time.
- Note:
- SmartCard Mode should be Enabled
Definition at line 528 of file stm8s_uart1.c.
void UART1_SetPrescaler | ( | uint8_t | UART1_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 556 of file stm8s_uart1.c.
void UART1_SmartCardCmd | ( | FunctionalState | NewState | ) |
Enables or disables the UART1 Smart Card mode.
Definition at line 371 of file stm8s_uart1.c.
References DISABLE, IS_FUNCTIONALSTATE_OK, and UART1_CR5_SCEN.
void UART1_SmartCardNACKCmd | ( | FunctionalState | NewState | ) |
Enables or disables NACK transmission.
- Note:
- This function is valid only for UART1 because is related to SmartCard mode.
Definition at line 394 of file stm8s_uart1.c.
References DISABLE, IS_FUNCTIONALSTATE_OK, and UART1_CR5_NACK.
void UART1_WakeUpConfig | ( | UART1_WakeUp_TypeDef | UART1_WakeUp | ) |
Selects the UART1 WakeUp method.
Definition at line 416 of file stm8s_uart1.c.
References IS_UART1_WAKEUP_OK, and UART1_CR1_WAKE.