STM8S/A Standard Peripherals Drivers
|
Functions | |
void | SPI_BiDirectionalLineConfig (SPI_Direction_TypeDef SPI_Direction) |
Selects the data transfer direction in bi-directional mode. | |
void | SPI_CalculateCRCCmd (FunctionalState NewState) |
Enables or disables the CRC value calculation of the transferred bytes. | |
void | SPI_ClearFlag (SPI_Flag_TypeDef SPI_FLAG) |
Clears the SPI flags. | |
void | SPI_ClearITPendingBit (SPI_IT_TypeDef SPI_IT) |
Clears the interrupt pending bits. | |
void | SPI_Cmd (FunctionalState NewState) |
Enables or disables the SPI peripheral. | |
void | SPI_DeInit (void) |
Deinitializes the SPI peripheral registers to their default reset values. | |
uint8_t | SPI_GetCRC (SPI_CRC_TypeDef SPI_CRC) |
Returns the transmit or the receive CRC register value. | |
uint8_t | SPI_GetCRCPolynomial (void) |
Returns the CRC Polynomial register value. | |
FlagStatus | SPI_GetFlagStatus (SPI_Flag_TypeDef SPI_FLAG) |
Checks whether the specified SPI flag is set or not. | |
ITStatus | SPI_GetITStatus (SPI_IT_TypeDef SPI_IT) |
Checks whether the specified interrupt has occurred or not. | |
void | SPI_Init (SPI_FirstBit_TypeDef FirstBit, SPI_BaudRatePrescaler_TypeDef BaudRatePrescaler, SPI_Mode_TypeDef Mode, SPI_ClockPolarity_TypeDef ClockPolarity, SPI_ClockPhase_TypeDef ClockPhase, SPI_DataDirection_TypeDef Data_Direction, SPI_NSS_TypeDef Slave_Management, uint8_t CRCPolynomial) |
Initializes the SPI according to the specified parameters. | |
void | SPI_ITConfig (SPI_IT_TypeDef SPI_IT, FunctionalState NewState) |
Enables or disables the specified interrupts. | |
void | SPI_NSSInternalSoftwareCmd (FunctionalState NewState) |
Configures internally by software the NSS pin. | |
uint8_t | SPI_ReceiveData (void) |
Returns the most recent received data by the SPI peripheral. | |
void | SPI_ResetCRC (void) |
Reset the Rx CRCR and Tx CRCR registers. | |
void | SPI_SendData (uint8_t Data) |
Transmits a Data through the SPI peripheral. | |
void | SPI_TransmitCRC (void) |
Enables the transmit of the CRC value. |
Function Documentation
void SPI_BiDirectionalLineConfig | ( | SPI_Direction_TypeDef | SPI_Direction | ) |
Selects the data transfer direction in bi-directional mode.
Definition at line 288 of file stm8s_spi.c.
References IS_SPI_DIRECTION_OK, SPI, SPI_CR2_BDOE, and SPI_DIRECTION_RX.
void SPI_CalculateCRCCmd | ( | FunctionalState | NewState | ) |
Enables or disables the CRC value calculation of the transferred bytes.
Definition at line 218 of file stm8s_spi.c.
References DISABLE, IS_FUNCTIONALSTATE_OK, SPI, and SPI_CR2_CRCEN.
Referenced by SPI_ResetCRC().
void SPI_ClearFlag | ( | SPI_Flag_TypeDef | SPI_FLAG | ) |
Clears the SPI flags.
- Note:
- - OVR (OverRun Error) interrupt pending bit is cleared by software sequence: a read operation to SPI_DR register (SPI_ReceiveData()) followed by a read operation to SPI_SR register (SPI_GetFlagStatus()).
- MODF (Mode Fault) interrupt pending bit is cleared by software sequence: a read/write operation to SPI_SR register (SPI_GetFlagStatus()) followed by a write operation to SPI_CR1 register (SPI_Cmd() to enable the SPI).
Definition at line 346 of file stm8s_spi.c.
References IS_SPI_CLEAR_FLAGS_OK, and SPI.
void SPI_ClearITPendingBit | ( | SPI_IT_TypeDef | SPI_IT | ) |
Clears the interrupt pending bits.
- Note:
- - OVR (OverRun Error) interrupt pending bit is cleared by software sequence: a read operation to SPI_DR register (SPI_ReceiveData()) followed by a read operation to SPI_SR register (SPI_GetITStatus()).
- MODF (Mode Fault) interrupt pending bit is cleared by software sequence: a read/write operation to SPI_SR register (SPI_GetITStatus()) followed by a write operation to SPI_CR1 register (SPI_Cmd() to enable the SPI).
Definition at line 412 of file stm8s_spi.c.
References IS_SPI_CLEAR_IT_OK, and SPI.
void SPI_Cmd | ( | FunctionalState | NewState | ) |
Enables or disables the SPI peripheral.
Definition at line 119 of file stm8s_spi.c.
References DISABLE, IS_FUNCTIONALSTATE_OK, SPI, and SPI_CR1_SPE.
Referenced by SPI_ResetCRC().
void SPI_DeInit | ( | void | ) |
Deinitializes the SPI peripheral registers to their default reset values.
Definition at line 50 of file stm8s_spi.c.
References SPI, SPI_CR1_RESET_VALUE, SPI_CR2_RESET_VALUE, SPI_CRCPR_RESET_VALUE, SPI_ICR_RESET_VALUE, and SPI_SR_RESET_VALUE.
uint8_t SPI_GetCRC | ( | SPI_CRC_TypeDef | SPI_CRC | ) |
Returns the transmit or the receive CRC register value.
Definition at line 238 of file stm8s_spi.c.
References IS_SPI_CRC_OK, SPI, and SPI_CRC_RX.
uint8_t SPI_GetCRCPolynomial | ( | void | ) |
Returns the CRC Polynomial register value.
Definition at line 278 of file stm8s_spi.c.
References SPI.
FlagStatus SPI_GetFlagStatus | ( | SPI_Flag_TypeDef | SPI_FLAG | ) |
Checks whether the specified SPI flag is set or not.
Definition at line 311 of file stm8s_spi.c.
References IS_SPI_FLAGS_OK, RESET, SET, and SPI.
ITStatus SPI_GetITStatus | ( | SPI_IT_TypeDef | SPI_IT | ) |
Checks whether the specified interrupt has occurred or not.
Definition at line 366 of file stm8s_spi.c.
References IS_SPI_GET_IT_OK, RESET, SET, and SPI.
void SPI_Init | ( | SPI_FirstBit_TypeDef | FirstBit, |
SPI_BaudRatePrescaler_TypeDef | BaudRatePrescaler, | ||
SPI_Mode_TypeDef | Mode, | ||
SPI_ClockPolarity_TypeDef | ClockPolarity, | ||
SPI_ClockPhase_TypeDef | ClockPhase, | ||
SPI_DataDirection_TypeDef | Data_Direction, | ||
SPI_NSS_TypeDef | Slave_Management, | ||
uint8_t | CRCPolynomial | ||
) |
Initializes the SPI according to the specified parameters.
Definition at line 78 of file stm8s_spi.c.
References IS_SPI_BAUDRATE_PRESCALER_OK, IS_SPI_CRC_POLYNOMIAL_OK, IS_SPI_DATA_DIRECTION_OK, IS_SPI_FIRSTBIT_OK, IS_SPI_MODE_OK, IS_SPI_PHASE_OK, IS_SPI_POLARITY_OK, IS_SPI_SLAVEMANAGEMENT_OK, SPI, SPI_CR2_SSI, and SPI_MODE_MASTER.
void SPI_ITConfig | ( | SPI_IT_TypeDef | SPI_IT, |
FunctionalState | NewState | ||
) |
Enables or disables the specified interrupts.
Definition at line 141 of file stm8s_spi.c.
References DISABLE, IS_FUNCTIONALSTATE_OK, IS_SPI_CONFIG_IT_OK, and SPI.
void SPI_NSSInternalSoftwareCmd | ( | FunctionalState | NewState | ) |
Configures internally by software the NSS pin.
Definition at line 187 of file stm8s_spi.c.
References DISABLE, IS_FUNCTIONALSTATE_OK, SPI, and SPI_CR2_SSI.
uint8_t SPI_ReceiveData | ( | void | ) |
Returns the most recent received data by the SPI peripheral.
Definition at line 176 of file stm8s_spi.c.
References SPI.
void SPI_ResetCRC | ( | void | ) |
Reset the Rx CRCR and Tx CRCR registers.
Definition at line 263 of file stm8s_spi.c.
References ENABLE, SPI_CalculateCRCCmd(), and SPI_Cmd().
void SPI_SendData | ( | uint8_t | Data | ) |
Transmits a Data through the SPI peripheral.
Definition at line 166 of file stm8s_spi.c.
References SPI.
void SPI_TransmitCRC | ( | void | ) |
Enables the transmit of the CRC value.
Definition at line 207 of file stm8s_spi.c.
References SPI, and SPI_CR2_CRCNEXT.