STM8L15x Standard Peripherals Drivers
|
SPI driver modules. More...
Modules | |
SPI_Exported_Types | |
SPI_Exported_Macros | |
Macros used by the assert_param function to check the different functions parameters. | |
SPI_Private_Functions | |
Functions | |
void | SPI_BiDirectionalLineConfig (SPI_TypeDef *SPIx, SPI_Direction_TypeDef SPI_Direction) |
Selects the data transfer direction in Bi-directional mode. | |
void | SPI_CalculateCRCCmd (SPI_TypeDef *SPIx, FunctionalState NewState) |
Enables or disables the CRC value calculation of the transferred bytes. | |
void | SPI_ClearFlag (SPI_TypeDef *SPIx, SPI_FLAG_TypeDef SPI_FLAG) |
Clears the SPI flags. | |
void | SPI_ClearITPendingBit (SPI_TypeDef *SPIx, SPI_IT_TypeDef SPI_IT) |
Clears the interrupt pending bits. | |
void | SPI_Cmd (SPI_TypeDef *SPIx, FunctionalState NewState) |
Enables or disables the SPI peripheral. | |
void | SPI_DeInit (SPI_TypeDef *SPIx) |
Deinitializes the SPI peripheral registers to their default reset values. | |
void | SPI_DMACmd (SPI_TypeDef *SPIx, SPI_DMAReq_TypeDef SPI_DMAReq, FunctionalState NewState) |
Enables or disables the SPI DMA interface. | |
uint8_t | SPI_GetCRC (SPI_TypeDef *SPIx, SPI_CRC_TypeDef SPI_CRC) |
Returns the transmit or the receive CRC register value. | |
uint8_t | SPI_GetCRCPolynomial (SPI_TypeDef *SPIx) |
Returns the CRC Polynomial register value. | |
FlagStatus | SPI_GetFlagStatus (SPI_TypeDef *SPIx, SPI_FLAG_TypeDef SPI_FLAG) |
Checks whether the specified SPI flag is set or not. | |
ITStatus | SPI_GetITStatus (SPI_TypeDef *SPIx, SPI_IT_TypeDef SPI_IT) |
Checks whether the specified interrupt has occurred or not. | |
void | SPI_Init (SPI_TypeDef *SPIx, SPI_FirstBit_TypeDef SPI_FirstBit, SPI_BaudRatePrescaler_TypeDef SPI_BaudRatePrescaler, SPI_Mode_TypeDef SPI_Mode, SPI_CPOL_TypeDef SPI_CPOL, SPI_CPHA_TypeDef SPI_CPHA, SPI_DirectionMode_TypeDef SPI_Data_Direction, SPI_NSS_TypeDef SPI_Slave_Management, uint8_t CRCPolynomial) |
Initializes the SPI according to the specified parameters. | |
void | SPI_ITConfig (SPI_TypeDef *SPIx, SPI_IT_TypeDef SPI_IT, FunctionalState NewState) |
Enables or disables the specified interrupts. | |
void | SPI_NSSInternalSoftwareCmd (SPI_TypeDef *SPIx, FunctionalState NewState) |
Configures internally by software the NSS pin. | |
uint8_t | SPI_ReceiveData (SPI_TypeDef *SPIx) |
Returns the most recent received data by the SPI peripheral. | |
void | SPI_ResetCRC (SPI_TypeDef *SPIx) |
Reset the Rx CRCR and Tx CRCR registers. | |
void | SPI_SendData (SPI_TypeDef *SPIx, uint8_t Data) |
Transmits a Data through the SPI peripheral. | |
void | SPI_TransmitCRC (SPI_TypeDef *SPIx) |
Enables the transmit of the CRC value. |
Detailed Description
SPI driver modules.
Function Documentation
void SPI_BiDirectionalLineConfig | ( | SPI_TypeDef * | SPIx, |
SPI_Direction_TypeDef | SPI_Direction | ||
) |
Selects the data transfer direction in Bi-directional mode.
Definition at line 265 of file stm8l15x_spi.c.
References SPI_struct::CR2, IS_SPI_DIRECTION, SPI_CR2_BDOE, and SPI_Direction_Rx.
void SPI_CalculateCRCCmd | ( | SPI_TypeDef * | SPIx, |
FunctionalState | NewState | ||
) |
Enables or disables the CRC value calculation of the transferred bytes.
Definition at line 420 of file stm8l15x_spi.c.
References SPI_struct::CR2, DISABLE, IS_FUNCTIONAL_STATE, SPI1, SPI_Cmd(), and SPI_CR2_CRCEN.
Referenced by SPI_ResetCRC().
void SPI_ClearFlag | ( | SPI_TypeDef * | SPIx, |
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 690 of file stm8l15x_spi.c.
References IS_SPI_CLEAR_FLAG, and SPI_struct::SR.
void SPI_ClearITPendingBit | ( | SPI_TypeDef * | SPIx, |
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 758 of file stm8l15x_spi.c.
References IS_SPI_CLEAR_IT, and SPI_struct::SR.
void SPI_Cmd | ( | SPI_TypeDef * | SPIx, |
FunctionalState | NewState | ||
) |
Enables or disables the SPI peripheral.
Definition at line 219 of file stm8l15x_spi.c.
References SPI_struct::CR1, DISABLE, IS_FUNCTIONAL_STATE, and SPI_CR1_SPE.
Referenced by SPI_CalculateCRCCmd(), and SPI_ResetCRC().
void SPI_DeInit | ( | SPI_TypeDef * | SPIx | ) |
Deinitializes the SPI peripheral registers to their default reset values.
Definition at line 122 of file stm8l15x_spi.c.
References SPI_struct::CR1, SPI_struct::CR2, SPI_struct::CR3, SPI_struct::CRCPR, SPI_CR1_RESET_VALUE, SPI_CR2_RESET_VALUE, SPI_CR3_RESET_VALUE, SPI_CRCPR_RESET_VALUE, SPI_SR_RESET_VALUE, and SPI_struct::SR.
void SPI_DMACmd | ( | SPI_TypeDef * | SPIx, |
SPI_DMAReq_TypeDef | SPI_DMAReq, | ||
FunctionalState | NewState | ||
) |
Enables or disables the SPI DMA interface.
Definition at line 519 of file stm8l15x_spi.c.
References SPI_struct::CR3, DISABLE, IS_FUNCTIONAL_STATE, and IS_SPI_DMAREQ.
uint8_t SPI_GetCRC | ( | SPI_TypeDef * | SPIx, |
SPI_CRC_TypeDef | SPI_CRC | ||
) |
Returns the transmit or the receive CRC register value.
Definition at line 447 of file stm8l15x_spi.c.
References IS_SPI_CRC, SPI_struct::RXCRCR, SPI_CRC_RX, and SPI_struct::TXCRCR.
uint8_t SPI_GetCRCPolynomial | ( | SPI_TypeDef * | SPIx | ) |
Returns the CRC Polynomial register value.
Definition at line 487 of file stm8l15x_spi.c.
References SPI_struct::CRCPR.
FlagStatus SPI_GetFlagStatus | ( | SPI_TypeDef * | SPIx, |
SPI_FLAG_TypeDef | SPI_FLAG | ||
) |
Checks whether the specified SPI flag is set or not.
Definition at line 655 of file stm8l15x_spi.c.
References IS_SPI_FLAG, RESET, SET, and SPI_struct::SR.
ITStatus SPI_GetITStatus | ( | SPI_TypeDef * | SPIx, |
SPI_IT_TypeDef | SPI_IT | ||
) |
Checks whether the specified interrupt has occurred or not.
Definition at line 711 of file stm8l15x_spi.c.
References __IO, SPI_struct::CR3, IS_SPI_GET_IT, RESET, SET, and SPI_struct::SR.
void SPI_Init | ( | SPI_TypeDef * | SPIx, |
SPI_FirstBit_TypeDef | SPI_FirstBit, | ||
SPI_BaudRatePrescaler_TypeDef | SPI_BaudRatePrescaler, | ||
SPI_Mode_TypeDef | SPI_Mode, | ||
SPI_CPOL_TypeDef | SPI_CPOL, | ||
SPI_CPHA_TypeDef | SPI_CPHA, | ||
SPI_DirectionMode_TypeDef | SPI_Data_Direction, | ||
SPI_NSS_TypeDef | SPI_Slave_Management, | ||
uint8_t | CRCPolynomial | ||
) |
Initializes the SPI according to the specified parameters.
Definition at line 171 of file stm8l15x_spi.c.
References SPI_struct::CR1, SPI_struct::CR2, SPI_struct::CRCPR, IS_SPI_BAUDRATE_PRESCALER, IS_SPI_CRC_POLYNOMIAL, IS_SPI_DATA_DIRECTION, IS_SPI_FIRSTBIT, IS_SPI_MODE, IS_SPI_PHASE, IS_SPI_POLARITY, IS_SPI_SLAVEMANAGEMENT, SPI_CR2_SSI, and SPI_Mode_Master.
void SPI_ITConfig | ( | SPI_TypeDef * | SPIx, |
SPI_IT_TypeDef | SPI_IT, | ||
FunctionalState | NewState | ||
) |
Enables or disables the specified interrupts.
Definition at line 620 of file stm8l15x_spi.c.
References SPI_struct::CR3, DISABLE, IS_FUNCTIONAL_STATE, and IS_SPI_CONFIG_IT.
void SPI_NSSInternalSoftwareCmd | ( | SPI_TypeDef * | SPIx, |
FunctionalState | NewState | ||
) |
Configures internally by software the NSS pin.
Definition at line 241 of file stm8l15x_spi.c.
References SPI_struct::CR2, DISABLE, IS_FUNCTIONAL_STATE, and SPI_CR2_SSI.
uint8_t SPI_ReceiveData | ( | SPI_TypeDef * | SPIx | ) |
Returns the most recent received data by the SPI peripheral.
Definition at line 323 of file stm8l15x_spi.c.
References SPI_struct::DR.
void SPI_ResetCRC | ( | SPI_TypeDef * | SPIx | ) |
Reset the Rx CRCR and Tx CRCR registers.
Definition at line 472 of file stm8l15x_spi.c.
References ENABLE, SPI_CalculateCRCCmd(), and SPI_Cmd().
void SPI_SendData | ( | SPI_TypeDef * | SPIx, |
uint8_t | Data | ||
) |
Transmits a Data through the SPI peripheral.
Definition at line 313 of file stm8l15x_spi.c.
References SPI_struct::DR.
void SPI_TransmitCRC | ( | SPI_TypeDef * | SPIx | ) |
Enables the transmit of the CRC value.
Definition at line 408 of file stm8l15x_spi.c.
References SPI_struct::CR2, and SPI_CR2_CRCNEXT.