STM8S/A Standard Peripherals Firmware Library
|
Functions | |
void | UART4_ClearFlag (UART4_Flag_TypeDef UART4_FLAG) |
Clears the UART4 flags. | |
void | UART4_ClearITPendingBit (UART4_IT_TypeDef UART4_IT) |
Clears the UART4 pending flags. | |
void | UART4_Cmd (FunctionalState NewState) |
Enable the UART4 peripheral. | |
void | UART4_DeInit (void) |
Deinitializes the UART peripheral. | |
FlagStatus | UART4_GetFlagStatus (UART4_Flag_TypeDef UART4_FLAG) |
Checks whether the specified UART4 flag is set or not. | |
ITStatus | UART4_GetITStatus (UART4_IT_TypeDef UART4_IT) |
Checks whether the specified UART4 interrupt has occurred or not. | |
void | UART4_HalfDuplexCmd (FunctionalState NewState) |
Enables or disables the UART�s Half Duplex communication. | |
void | UART4_Init (uint32_t BaudRate, UART4_WordLength_TypeDef WordLength, UART4_StopBits_TypeDef StopBits, UART4_Parity_TypeDef Parity, UART4_SyncMode_TypeDef SyncMode, UART4_Mode_TypeDef Mode) |
Initializes the UART4 according to the specified parameters. | |
void | UART4_IrDACmd (FunctionalState NewState) |
Enables or disables the UART4�s IrDA interface. | |
void | UART4_IrDAConfig (UART4_IrDAMode_TypeDef UART4_IrDAMode) |
Configures the UART4�s IrDA interface. | |
void | UART4_ITConfig (UART4_IT_TypeDef UART4_IT, FunctionalState NewState) |
Enables or disables the specified UART4 interrupts. | |
void | UART4_LINBreakDetectionConfig (UART4_LINBreakDetectionLength_TypeDef UART4_LINBreakDetectionLength) |
Sets the UART4 LIN Break detection length. | |
void | UART4_LINCmd (FunctionalState NewState) |
Enables or disables the UART4 LIN mode. | |
void | UART4_LINConfig (UART4_LinMode_TypeDef UART4_Mode, UART4_LinAutosync_TypeDef UART4_Autosync, UART4_LinDivUp_TypeDef UART4_DivUp) |
Configure the UART4 peripheral. | |
uint8_t | UART4_ReceiveData8 (void) |
Returns the most recent received data by the UART4 peripheral. | |
uint16_t | UART4_ReceiveData9 (void) |
Returns the most recent received data by the UART4 peripheral. | |
void | UART4_ReceiverWakeUpCmd (FunctionalState NewState) |
Determines if the UART4 is in mute mode or not. | |
void | UART4_SendBreak (void) |
Transmits break characters. | |
void | UART4_SendData8 (uint8_t Data) |
Transmits 8 bit data through the UART4 peripheral. | |
void | UART4_SendData9 (uint16_t Data) |
Transmits 9 bit data through the UART4 peripheral. | |
void | UART4_SetAddress (uint8_t UART4_Address) |
Sets the address of the UART4 node. | |
void | UART4_SetGuardTime (uint8_t UART4_GuardTime) |
Sets the specified UART4 guard time. | |
void | UART4_SetPrescaler (uint8_t UART4_Prescaler) |
Sets the system clock prescaler. | |
void | UART4_SmartCardCmd (FunctionalState NewState) |
Enables or disables the UART4 Smart Card mode. | |
void | UART4_SmartCardNACKCmd (FunctionalState NewState) |
Enables or disables NACK transmission. | |
void | UART4_WakeUpConfig (UART4_WakeUp_TypeDef UART4_WakeUp) |
Selects the UART4 WakeUp method. |
Function Documentation
void UART4_ClearFlag | ( | UART4_Flag_TypeDef | UART4_FLAG | ) |
Clears the UART4 flags.
- Parameters:
-
UART4_FLAG specifies the flag to clear This parameter can be any combination of the following values: - UART4_FLAG_LBDF: LIN Break detection flag.
- UART4_FLAG_LHDF: LIN Header detection flag.
- UART4_FLAG_LSF: LIN synchrone field flag.
- UART4_FLAG_RXNE: Receive data register not empty flag.
- 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 UART4_SR register (UART4_GetFlagStatus())followed by a read operation to UART4_DR register(UART4_ReceiveData8() or UART4_ReceiveData9()).
- RXNE flag can be also cleared by a read to the UART4_DR register (UART4_ReceiveData8()or UART4_ReceiveData9()).
- TC flag can be also cleared by software sequence: a read operation to UART4_SR register (UART4_GetFlagStatus()) followed by a write operation to UART4_DR register (UART4_SendData8() or UART4_SendData9()).
- TXE flag is cleared only by a write to the UART4_DR register (UART4_SendData8() or UART4_SendData9()).
- SBK flag is cleared during the stop bit of break.
- Return values:
-
None
Definition at line 719 of file stm8s_uart4.c.
References assert_param, IS_UART4_CLEAR_FLAG_OK, UART4_FLAG_LBDF, UART4_FLAG_LHDF, and UART4_FLAG_RXNE.
void UART4_ClearITPendingBit | ( | UART4_IT_TypeDef | UART4_IT | ) |
Clears the UART4 pending flags.
- Parameters:
-
UART4_IT specifies the pending bit to clear This parameter can be one of the following values: - UART4_IT_LBDF: LIN Break detection interrupt
- UART4_IT_LHDF: LIN Header detection interrupt
- UART4_IT_RXNE: Receive Data register not empty interrupt.
- 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 UART4_SR register (UART4_GetITStatus()) followed by a read operation to UART4_DR register (UART4_ReceiveData8() or UART4_ReceiveData9()).
- RXNE pending bit can be also cleared by a read to the UART4_DR register (UART4_ReceiveData8() or UART4_ReceiveData9()).
- TC (Transmit complete) pending bit can be cleared by software sequence: a read operation to UART4_SR register (UART4_GetITStatus()) followed by a write operation to UART4_DR register (UART4_SendData8()or UART4_SendData9()).
- TXE pending bit is cleared only by a write to the UART4_DR register (UART4_SendData8() or UART4_SendData9()).
- Return values:
-
None
Definition at line 872 of file stm8s_uart4.c.
References assert_param, IS_UART4_CLEAR_IT_OK, UART4_IT_LBDF, and UART4_IT_RXNE.
void UART4_Cmd | ( | FunctionalState | NewState | ) |
Enable the UART4 peripheral.
- Parameters:
-
NewState : The new state of the UART Communication. This parameter can be any of the FunctionalState enumeration.
- Return values:
-
None
Definition at line 181 of file stm8s_uart4.c.
References DISABLE.
void UART4_DeInit | ( | void | ) |
Deinitializes the UART peripheral.
- Parameters:
-
None
- Return values:
-
None
Definition at line 53 of file stm8s_uart4.c.
FlagStatus UART4_GetFlagStatus | ( | UART4_Flag_TypeDef | UART4_FLAG | ) |
Checks whether the specified UART4 flag is set or not.
- Parameters:
-
UART4_FLAG specifies the flag to check. This parameter can be any of the UART4_Flag_TypeDef enumeration.
- Return values:
-
FlagStatus (SET or RESET)
Definition at line 626 of file stm8s_uart4.c.
References assert_param, IS_UART4_FLAG_OK, RESET, SET, UART4_FLAG_LBDF, UART4_FLAG_LHDF, UART4_FLAG_LSF, and UART4_FLAG_SBK.
ITStatus UART4_GetITStatus | ( | UART4_IT_TypeDef | UART4_IT | ) |
Checks whether the specified UART4 interrupt has occurred or not.
- Parameters:
-
UART4_IT,: Specifies the UART4 interrupt pending bit to check. This parameter can be one of the following values: - UART4_IT_LBDF: LIN Break detection interrupt
- UART4_IT_TXE: Tansmit Data Register empty interrupt
- UART4_IT_TC: Transmission complete interrupt
- UART4_IT_RXNE: Receive Data register not empty interrupt
- UART4_IT_IDLE: Idle line detection interrupt
- UART4_IT_OR: OverRun Error interrupt
- UART4_IT_PE: Parity Error interrupt
- Return values:
-
The state of UART4_IT (SET or RESET).
Definition at line 758 of file stm8s_uart4.c.
References assert_param, IS_UART4_GET_IT_OK, RESET, SET, UART4_IT_LBDF, UART4_IT_LHDF, and UART4_IT_PE.
void UART4_HalfDuplexCmd | ( | FunctionalState | NewState | ) |
Enables or disables the UART�s Half Duplex communication.
- Parameters:
-
NewState new state of the UART Communication. This parameter can be: ENABLE or DISABLE.
- Return values:
-
None
< UART4 Half Duplex Enable
< UART4 Half Duplex Disable
Definition at line 272 of file stm8s_uart4.c.
References assert_param, DISABLE, and IS_FUNCTIONALSTATE_OK.
void UART4_Init | ( | uint32_t | BaudRate, |
UART4_WordLength_TypeDef | WordLength, | ||
UART4_StopBits_TypeDef | StopBits, | ||
UART4_Parity_TypeDef | Parity, | ||
UART4_SyncMode_TypeDef | SyncMode, | ||
UART4_Mode_TypeDef | Mode | ||
) |
Initializes the UART4 according to the specified parameters.
- Parameters:
-
BaudRate,: The baudrate. WordLength : This parameter can be any of the UART4_WordLength_TypeDef enumeration. StopBits,: This parameter can be any of the UART4_StopBits_TypeDef enumeration. Parity,: This parameter can be any of the UART4_Parity_TypeDef enumeration. SyncMode,: This parameter can be any of the UART4_SyncMode_TypeDef values. Mode,: This parameter can be any of the UART4_Mode_TypeDef values
- Return values:
-
None
Definition at line 85 of file stm8s_uart4.c.
References assert_param, CLK_GetClockFreq(), IS_UART4_BAUDRATE_OK, IS_UART4_MODE_OK, IS_UART4_PARITY_OK, IS_UART4_STOPBITS_OK, IS_UART4_SYNCMODE_OK, IS_UART4_WORDLENGTH_OK, UART4_MODE_RX_ENABLE, UART4_MODE_TX_ENABLE, and UART4_SYNCMODE_CLOCK_DISABLE.
void UART4_IrDACmd | ( | FunctionalState | NewState | ) |
Enables or disables the UART4�s IrDA interface.
- Parameters:
-
NewState new state of the IrDA mode. This parameter can be: ENABLE or DISABLE.
- Return values:
-
None
Definition at line 312 of file stm8s_uart4.c.
References assert_param, DISABLE, and IS_FUNCTIONALSTATE_OK.
void UART4_IrDAConfig | ( | UART4_IrDAMode_TypeDef | UART4_IrDAMode | ) |
Configures the UART4�s IrDA interface.
- Parameters:
-
UART4_IrDAMode specifies the IrDA mode. This parameter can be any of the UART4_IrDAMode_TypeDef values.
- Return values:
-
None
Definition at line 292 of file stm8s_uart4.c.
References assert_param, IS_UART4_IRDAMODE_OK, and UART4_IRDAMODE_NORMAL.
void UART4_ITConfig | ( | UART4_IT_TypeDef | UART4_IT, |
FunctionalState | NewState | ||
) |
Enables or disables the specified UART4 interrupts.
- Parameters:
-
UART4_IT specifies the UART4 interrupt sources to be enabled or disabled. This parameter can be one of the following values: - UART4_IT_LBDF: LIN Break detection interrupt
- UART4_IT_LHDF: LIN Break detection interrupt
- UART4_IT_TXE: Tansmit Data Register empty interrupt
- UART4_IT_TC: Transmission complete interrupt
- UART4_IT_RXNE_OR: Receive Data register not empty/Over run error interrupt
- UART4_IT_IDLE: Idle line detection interrupt
- UART4_IT_PE: Parity Error interrupt
NewState new state of the specified UART4 interrupts. This parameter can be: ENABLE or DISABLE.
- Return values:
-
None
Definition at line 210 of file stm8s_uart4.c.
References assert_param, DISABLE, IS_FUNCTIONALSTATE_OK, and IS_UART4_CONFIG_IT_OK.
void UART4_LINBreakDetectionConfig | ( | UART4_LINBreakDetectionLength_TypeDef | UART4_LINBreakDetectionLength | ) |
Sets the UART4 LIN Break detection length.
- Parameters:
-
UART4_LINBreakDetectionLength specifies the LIN break detection length. This parameter can be any of the UART4_LINBreakDetectionLength_TypeDef values.
- Return values:
-
None
Definition at line 336 of file stm8s_uart4.c.
References assert_param, IS_UART4_LINBREAKDETECTIONLENGTH_OK, and UART4_LINBREAKDETECTIONLENGTH_10BITS.
void UART4_LINCmd | ( | FunctionalState | NewState | ) |
Enables or disables the UART4 LIN mode.
- Parameters:
-
NewState is new state of the UART4 LIN mode. This parameter can be ENABLE or DISABLE
- Return values:
-
None
Definition at line 404 of file stm8s_uart4.c.
References assert_param, DISABLE, and IS_FUNCTIONALSTATE_OK.
void UART4_LINConfig | ( | UART4_LinMode_TypeDef | UART4_Mode, |
UART4_LinAutosync_TypeDef | UART4_Autosync, | ||
UART4_LinDivUp_TypeDef | UART4_DivUp | ||
) |
Configure the UART4 peripheral.
- Parameters:
-
UART4_Mode specifies the LIN mode. This parameter can be any of the UART4_LinMode_TypeDef values. UART4_Autosync specifies the LIN automatic resynchronization mode. This parameter can be any of the UART4_LinAutosync_TypeDef values. UART4_DivUp specifies the LIN divider update method. This parameter can be any of the UART4_LinDivUp_TypeDef values.
- Return values:
-
None
Definition at line 361 of file stm8s_uart4.c.
References assert_param, IS_UART4_AUTOSYNC_OK, IS_UART4_DIVUP_OK, IS_UART4_SLAVE_OK, UART4_LIN_AUTOSYNC_DISABLE, UART4_LIN_DIVUP_LBRR1, and UART4_LIN_MODE_MASTER.
uint8_t UART4_ReceiveData8 | ( | void | ) |
Returns the most recent received data by the UART4 peripheral.
- Parameters:
-
None
- Return values:
-
Received Data
Definition at line 507 of file stm8s_uart4.c.
uint16_t UART4_ReceiveData9 | ( | void | ) |
Returns the most recent received data by the UART4 peripheral.
- Parameters:
-
None
- Return values:
-
Received Data
Definition at line 517 of file stm8s_uart4.c.
void UART4_ReceiverWakeUpCmd | ( | FunctionalState | NewState | ) |
Determines if the UART4 is in mute mode or not.
- Parameters:
-
NewState,: new state of the UART4 mode. This parameter can be ENABLE or DISABLE
- Return values:
-
None
Definition at line 486 of file stm8s_uart4.c.
References assert_param, DISABLE, and IS_FUNCTIONALSTATE_OK.
void UART4_SendBreak | ( | void | ) |
Transmits break characters.
- Parameters:
-
None
- Return values:
-
None
Definition at line 559 of file stm8s_uart4.c.
void UART4_SendData8 | ( | uint8_t | Data | ) |
Transmits 8 bit data through the UART4 peripheral.
- Parameters:
-
Data,: the data to transmit.
- Return values:
-
None
Definition at line 531 of file stm8s_uart4.c.
void UART4_SendData9 | ( | uint16_t | Data | ) |
Transmits 9 bit data through the UART4 peripheral.
- Parameters:
-
Data,: the data to transmit.
- Return values:
-
None
Definition at line 542 of file stm8s_uart4.c.
void UART4_SetAddress | ( | uint8_t | UART4_Address | ) |
Sets the address of the UART4 node.
- Parameters:
-
UART4_Address,: Indicates the address of the UART4 node.
- Return values:
-
None
Definition at line 569 of file stm8s_uart4.c.
References assert_param, and IS_UART4_ADDRESS_OK.
void UART4_SetGuardTime | ( | uint8_t | UART4_GuardTime | ) |
Sets the specified UART4 guard time.
- Note:
- SmartCard Mode should be Enabled
- Parameters:
-
UART4_GuardTime,: specifies the guard time.
- Return values:
-
None
Definition at line 586 of file stm8s_uart4.c.
void UART4_SetPrescaler | ( | uint8_t | UART4_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.
- Parameters:
-
UART4_Prescaler,: specifies the prescaler clock. This parameter can be one of the following values:
- IrDA Low Power Mode
- The clock source is divided by the value given in the register (8 bits)
- 0000 0000 Reserved
- 0000 0001 divides the clock source by 1
- 0000 0010 divides the clock source by 2
- ...
- Smart Card Mode
- The clock source is divided by the value given in the register (5 significant bits) multiped by 2
- 0 0000 Reserved
- 0 0001 divides the clock source by 2
- 0 0010 divides the clock source by 4
- 0 0011 divides the clock source by 6
- ...
- Return values:
-
None
Definition at line 614 of file stm8s_uart4.c.
void UART4_SmartCardCmd | ( | FunctionalState | NewState | ) |
Enables or disables the UART4 Smart Card mode.
- Parameters:
-
NewState,: new state of the Smart Card mode. This parameter can be: ENABLE or DISABLE.
- Return values:
-
None
Definition at line 426 of file stm8s_uart4.c.
References assert_param, DISABLE, and IS_FUNCTIONALSTATE_OK.
void UART4_SmartCardNACKCmd | ( | FunctionalState | NewState | ) |
Enables or disables NACK transmission.
- Parameters:
-
NewState,: new state of the Smart Card mode. This parameter can be: ENABLE or DISABLE.
- Return values:
-
None
Definition at line 449 of file stm8s_uart4.c.
References assert_param, DISABLE, and IS_FUNCTIONALSTATE_OK.
void UART4_WakeUpConfig | ( | UART4_WakeUp_TypeDef | UART4_WakeUp | ) |
Selects the UART4 WakeUp method.
- Parameters:
-
UART4_WakeUp,: specifies the UART4 wakeup method. This parameter can be any of the UART4_WakeUp_TypeDef values.
- Return values:
-
None
Definition at line 472 of file stm8s_uart4.c.
References assert_param, and IS_UART4_WAKEUP_OK.