STM8S/A Standard Peripherals Firmware Library: UART3_Public_Functions

STM8S/A

STM8S/A Standard Peripherals Firmware Library
UART3_Public_Functions

Functions

void UART3_ClearFlag (UART3_Flag_TypeDef UART3_FLAG)
 Clears the UART3 flags.
void UART3_ClearITPendingBit (UART3_IT_TypeDef UART3_IT)
 Clears the UART3 pending flags.
void UART3_Cmd (FunctionalState NewState)
 Enable the UART1 peripheral.
void UART3_DeInit (void)
 Deinitializes the UART peripheral.
FlagStatus UART3_GetFlagStatus (UART3_Flag_TypeDef UART3_FLAG)
 Checks whether the specified UART3 flag is set or not.
ITStatus UART3_GetITStatus (UART3_IT_TypeDef UART3_IT)
 Checks whether the specified UART3 interrupt has occurred or not.
void UART3_Init (uint32_t BaudRate, UART3_WordLength_TypeDef WordLength, UART3_StopBits_TypeDef StopBits, UART3_Parity_TypeDef Parity, UART3_Mode_TypeDef Mode)
 Initializes the UART3 according to the specified parameters.
void UART3_ITConfig (UART3_IT_TypeDef UART3_IT, FunctionalState NewState)
 Enables or disables the specified UART3 interrupts.
void UART3_LINBreakDetectionConfig (UART3_LINBreakDetectionLength_TypeDef UART3_LINBreakDetectionLength)
 Sets the UART3 LIN Break detection length.
void UART3_LINCmd (FunctionalState NewState)
 Enables or disables the UART3 LIN mode.
void UART3_LINConfig (UART3_LinMode_TypeDef UART3_Mode, UART3_LinAutosync_TypeDef UART3_Autosync, UART3_LinDivUp_TypeDef UART3_DivUp)
 Configure the UART3 peripheral.
uint8_t UART3_ReceiveData8 (void)
 Returns the most recent received data by the UART3 peripheral.
uint16_t UART3_ReceiveData9 (void)
 Returns the most recent received data by the UART3 peripheral.
void UART3_ReceiverWakeUpCmd (FunctionalState NewState)
 Determines if the UART3 is in mute mode or not.
void UART3_SendBreak (void)
 Transmits break characters.
void UART3_SendData8 (uint8_t Data)
 Transmits 8 bit data through the UART3 peripheral.
void UART3_SendData9 (uint16_t Data)
 Transmits 9 bit data through the UART3 peripheral.
void UART3_SetAddress (uint8_t UART3_Address)
 Sets the address of the UART3 node.
void UART3_WakeUpConfig (UART3_WakeUp_TypeDef UART3_WakeUp)
 Selects the UART3 WakeUp method.

Function Documentation

void UART3_ClearFlag ( UART3_Flag_TypeDef  UART3_FLAG)

Clears the UART3 flags.

Parameters:
UART3_FLAGspecifies the flag to clear This parameter can be any combination of the following values:
  • UART3_FLAG_LBDF: LIN Break detection flag.
  • UART3_FLAG_LHDF: LIN Header detection flag.
  • UART3_FLAG_LSF: LIN synchrone field flag.
  • UART3_FLAG_RXNE: Receive data register not empty flag.
Note:
  • PE (Parity error), FE (Framing error), NF (Noise error), OR (OverRun error) and IDLE (Idle line detected) flags are cleared by software sequence: a read operation to UART3_SR register (UART3_GetFlagStatus())followed by a read operation to UART3_DR register(UART3_ReceiveData8() or UART3_ReceiveData9()).
  • SBK flag is cleared during the stop bit of break.
    Return values:
    None

Definition at line 551 of file stm8s_uart3.c.

References assert_param, IS_UART3_CLEAR_FLAG_OK, UART3_CR4_LBDF, UART3_CR6_LHDF, UART3_CR6_LSF, UART3_FLAG_LBDF, UART3_FLAG_LHDF, UART3_FLAG_RXNE, and UART3_SR_RXNE.

void UART3_ClearITPendingBit ( UART3_IT_TypeDef  UART3_IT)

Clears the UART3 pending flags.

Parameters:
UART3_ITspecifies the pending bit to clear This parameter can be one of the following values:
  • UART3_IT_LBDF: LIN Break detection interrupt
  • UART3_IT_LHDF: LIN Header detection interrupt
  • UART3_IT_RXNE: Receive Data register not empty interrupt.
Note:
  • PE (Parity error), FE (Framing error), NF (Noise error), OR (OverRun error) and IDLE (Idle line detected) pending bits are cleared by software sequence: a read operation to UART3_SR register (UART3_GetITStatus()) followed by a read operation to UART3_DR register (UART3_ReceiveData8() or UART3_ReceiveData9()).

Definition at line 706 of file stm8s_uart3.c.

References assert_param, IS_UART3_CLEAR_IT_OK, UART3_CR4_LBDF, UART3_CR6_LHDF, UART3_IT_LBDF, UART3_IT_RXNE, and UART3_SR_RXNE.

void UART3_Cmd ( FunctionalState  NewState)

Enable the UART1 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 160 of file stm8s_uart3.c.

References DISABLE, and UART3_CR1_UARTD.

void UART3_DeInit ( void  )

Deinitializes the UART peripheral.

Parameters:
None
Return values:
None

Definition at line 54 of file stm8s_uart3.c.

References UART3_BRR1_RESET_VALUE, UART3_BRR2_RESET_VALUE, UART3_CR1_RESET_VALUE, UART3_CR2_RESET_VALUE, UART3_CR3_RESET_VALUE, UART3_CR4_RESET_VALUE, and UART3_CR6_RESET_VALUE.

Referenced by UART_Config().

FlagStatus UART3_GetFlagStatus ( UART3_Flag_TypeDef  UART3_FLAG)

Checks whether the specified UART3 flag is set or not.

Parameters:
UART3_FLAGspecifies the flag to check. This parameter can be any of the UART3_Flag_TypeDef enumeration.
Return values:
FlagStatus(SET or RESET)

Definition at line 458 of file stm8s_uart3.c.

References assert_param, IS_UART3_FLAG_OK, RESET, SET, UART3_FLAG_LBDF, UART3_FLAG_LHDF, UART3_FLAG_LSF, and UART3_FLAG_SBK.

Referenced by main().

ITStatus UART3_GetITStatus ( UART3_IT_TypeDef  UART3_IT)

Checks whether the specified UART3 interrupt has occurred or not.

Parameters:
UART3_IT,:Specifies the UART3 interrupt pending bit to check. This parameter can be one of the following values:
  • UART3_IT_LBDF: LIN Break detection interrupt
  • UART3_IT_TXE: Tansmit Data Register empty interrupt
  • UART3_IT_TC: Transmission complete interrupt
  • UART3_IT_RXNE: Receive Data register not empty interrupt
  • UART3_IT_IDLE: Idle line detection interrupt
  • UART3_IT_OR: OverRun Error interrupt
  • UART3_IT_PE: Parity Error interrupt
Return values:
Thestate of UART3_IT (SET or RESET).

Definition at line 591 of file stm8s_uart3.c.

References assert_param, IS_UART3_GET_IT_OK, RESET, SET, UART3_IT_LBDF, UART3_IT_LHDF, and UART3_IT_PE.

void UART3_Init ( uint32_t  BaudRate,
UART3_WordLength_TypeDef  WordLength,
UART3_StopBits_TypeDef  StopBits,
UART3_Parity_TypeDef  Parity,
UART3_Mode_TypeDef  Mode 
)

Initializes the UART3 according to the specified parameters.

Parameters:
BaudRate,:The baudrate.
WordLength: This parameter can be any of the UART3_WordLength_TypeDef enumeration.
StopBits,:This parameter can be any of the UART3_StopBits_TypeDef enumeration.
Parity,:This parameter can be any of the UART3_Parity_TypeDef enumeration.
Mode,:This parameter can be any of the UART3_Mode_TypeDef values
Return values:
None

Definition at line 83 of file stm8s_uart3.c.

References assert_param, CLK_GetClockFreq(), IS_UART3_BAUDRATE_OK, IS_UART3_MODE_OK, IS_UART3_PARITY_OK, IS_UART3_STOPBITS_OK, IS_UART3_WORDLENGTH_OK, UART3_BRR1_DIVM, UART3_BRR2_DIVF, UART3_BRR2_DIVM, UART3_CR1_M, UART3_CR1_PCEN, UART3_CR1_PS, UART3_CR2_REN, UART3_CR2_TEN, UART3_CR3_STOP, UART3_MODE_RX_ENABLE, and UART3_MODE_TX_ENABLE.

Referenced by UART_Config().

void UART3_ITConfig ( UART3_IT_TypeDef  UART3_IT,
FunctionalState  NewState 
)

Enables or disables the specified UART3 interrupts.

Parameters:
UART3_ITspecifies the UART3 interrupt sources to be enabled or disabled. This parameter can be one of the following values:
  • UART3_IT_LBDF: LIN Break detection interrupt
  • UART3_IT_LHDF: LIN Break detection interrupt
  • UART3_IT_TXE: Tansmit Data Register empty interrupt
  • UART3_IT_TC: Transmission complete interrupt
  • UART3_IT_RXNE_OR: Receive Data register not empty/Over run error interrupt
  • UART3_IT_IDLE: Idle line detection interrupt
  • UART3_IT_PE: Parity Error interrupt
NewStatenew state of the specified UART3 interrupts. This parameter can be: ENABLE or DISABLE.
Return values:
None

Definition at line 189 of file stm8s_uart3.c.

References assert_param, DISABLE, IS_FUNCTIONALSTATE_OK, and IS_UART3_CONFIG_IT_OK.

Referenced by main(), and UART_Config().

void UART3_LINBreakDetectionConfig ( UART3_LINBreakDetectionLength_TypeDef  UART3_LINBreakDetectionLength)

Sets the UART3 LIN Break detection length.

Parameters:
UART3_LINBreakDetectionLengthspecifies the LIN break detection length. This parameter can be any of the UART3_LINBreakDetectionLength_TypeDef values.
Return values:
None

Definition at line 252 of file stm8s_uart3.c.

References assert_param, IS_UART3_LINBREAKDETECTIONLENGTH_OK, UART3_CR4_LBDL, and UART3_LINBREAKDETECTIONLENGTH_10BITS.

void UART3_LINCmd ( FunctionalState  NewState)

Enables or disables the UART3 LIN mode.

Parameters:
NewStateis new state of the UART3 LIN mode. This parameter can be ENABLE or DISABLE
Return values:
None

Definition at line 320 of file stm8s_uart3.c.

References assert_param, DISABLE, IS_FUNCTIONALSTATE_OK, and UART3_CR3_LINEN.

void UART3_LINConfig ( UART3_LinMode_TypeDef  UART3_Mode,
UART3_LinAutosync_TypeDef  UART3_Autosync,
UART3_LinDivUp_TypeDef  UART3_DivUp 
)

Configure the UART3 peripheral.

Parameters:
UART3_Modespecifies the LIN mode. This parameter can be any of the UART3_LinMode_TypeDef values.
UART3_Autosyncspecifies the LIN automatic resynchronization mode. This parameter can be any of the UART3_LinAutosync_TypeDef values.
UART3_DivUpspecifies the LIN divider update method. This parameter can be any of the UART3_LinDivUp_TypeDef values.
Return values:
None

Definition at line 277 of file stm8s_uart3.c.

References assert_param, IS_UART3_AUTOSYNC_OK, IS_UART3_DIVUP_OK, IS_UART3_SLAVE_OK, UART3_CR6_LASE, UART3_CR6_LDUM, UART3_CR6_LSLV, UART3_LIN_AUTOSYNC_DISABLE, UART3_LIN_DIVUP_LBRR1, and UART3_LIN_MODE_MASTER.

uint8_t UART3_ReceiveData8 ( void  )

Returns the most recent received data by the UART3 peripheral.

Parameters:
None
Return values:
ReceivedData

Definition at line 380 of file stm8s_uart3.c.

Referenced by main().

uint16_t UART3_ReceiveData9 ( void  )

Returns the most recent received data by the UART3 peripheral.

Parameters:
None
Return values:
ReceivedData

Definition at line 390 of file stm8s_uart3.c.

References UART3_CR1_R8.

Referenced by main().

void UART3_ReceiverWakeUpCmd ( FunctionalState  NewState)

Determines if the UART3 is in mute mode or not.

Parameters:
NewState,:new state of the UART3 mode. This parameter can be ENABLE or DISABLE
Return values:
None

Definition at line 358 of file stm8s_uart3.c.

References assert_param, DISABLE, IS_FUNCTIONALSTATE_OK, and UART3_CR2_RWU.

void UART3_SendBreak ( void  )

Transmits break characters.

Parameters:
None
Return values:
None

Definition at line 431 of file stm8s_uart3.c.

References UART3_CR2_SBK.

void UART3_SendData8 ( uint8_t  Data)

Transmits 8 bit data through the UART3 peripheral.

Parameters:
Datathe data to transmit.
Return values:
None

Definition at line 403 of file stm8s_uart3.c.

Referenced by main().

void UART3_SendData9 ( uint16_t  Data)

Transmits 9 bit data through the UART3 peripheral.

Parameters:
Data,:the data to transmit.
Return values:
None

Definition at line 414 of file stm8s_uart3.c.

References UART3_CR1_T8.

void UART3_SetAddress ( uint8_t  UART3_Address)

Sets the address of the UART3 node.

Parameters:
UART3_Address,:Indicates the address of the UART3 node.
Return values:
None

Definition at line 441 of file stm8s_uart3.c.

References assert_param, IS_UART3_ADDRESS_OK, and UART3_CR4_ADD.

Referenced by UART_Config().

void UART3_WakeUpConfig ( UART3_WakeUp_TypeDef  UART3_WakeUp)

Selects the UART3 WakeUp method.

Parameters:
UART3_WakeUp,:specifies the UART3 wakeup method. This parameter can be any of the UART3_WakeUp_TypeDef values.
Return values:
None

Definition at line 343 of file stm8s_uart3.c.

References assert_param, IS_UART3_WAKEUP_OK, and UART3_CR1_WAKE.

Referenced by UART_Config().

STM8 Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM8 8-bit Microcontrollers platform visit www.st.com