MG32F10x Standard Peripherals Firmware Library
|
SPI driver modules. More...
Modules | |
SPI_Exported_Constants | |
SPI_Private_Functions | |
Data Structures | |
struct | SPI_InitTypeDef |
SPI Init structure definition. More... | |
struct | SPI_MicrowireInitTypeDef |
SPI Microwire Init structure definition. More... | |
struct | SPI_EnhancedSpiInitTypeDef |
SPI Enhanced SPI Mode Init structure definition. More... | |
Functions | |
void | SPI_DeInit (SPI_TypeDef *SPIx) |
Deinitializes the SPIx peripheral registers to their default reset values. More... | |
void | SPI_Init (SPI_TypeDef *SPIx, SPI_InitTypeDef *SPI_InitStruct) |
Initializes the SPIx peripheral according to the specified parameters in the SPI_InitStruct. More... | |
void | SPI_StructInit (SPI_InitTypeDef *SPI_InitStruct) |
Fills each SPI_InitStruct member with its default value. More... | |
void | SPI_Cmd (SPI_TypeDef *SPIx, FunctionalState NewState) |
Enables or disables the specified SPI peripheral. More... | |
void | SPI_TransferModeConfig (SPI_TypeDef *SPIx, uint16_t SPI_TransferMode) |
Configures the transfer mode. More... | |
void | SPI_SlaveOutputCmd (SPI_TypeDef *SPIx, FunctionalState NewState) |
Enables or disables the slave output (only used for SPISx). More... | |
void | SPI_NSSConfig (SPI_TypeDef *SPIx, uint32_t SPI_NSS, FunctionalState NewState) |
Enables or disables the specified slave select line (only used for SPIMx). More... | |
void | SPI_NSSToggleModeCmd (SPI_TypeDef *SPIx, FunctionalState NewState) |
Enables or disables the slave select toggle mode. More... | |
void | SPI_ReceiveDataLengthConfig (SPI_TypeDef *SPIx, uint32_t DataLength) |
Configures the number of data frames to be continuously received (only used for SPIMx). More... | |
void | SPI_MicrowireConfig (SPI_TypeDef *SPIx, SPI_MicrowireInitTypeDef *SPI_MicrowireInitStruct) |
Configures the Microwire frame format according to the specified parameters in the SPI_MicrowireInitStruct. More... | |
void | SPI_MicrowireStructInit (SPI_MicrowireInitTypeDef *SPI_MicrowireInitStruct) |
Fills each SPI_MicrowireInitStruct member with its default value. More... | |
void | SPI_SpiModeConfig (SPI_TypeDef *SPIx, uint32_t SPI_SpiMode) |
Configures the Spi Mode. More... | |
void | SPI_EnhancedSpiConfig (SPI_TypeDef *SPIx, SPI_EnhancedSpiInitTypeDef *SPI_EnhancedSpiInitStruct) |
Configures the Enhanced SPI Mode according to the specified parameters in the SPI_EnhancedSpiInitStruct (only used for QSPI). More... | |
void | SPI_EnhancedSpiStructInit (SPI_EnhancedSpiInitTypeDef *SPI_EnhancedSpiInitStruct) |
Fills each SPI_EnhancedSpiInitStruct member with its default value. More... | |
uint16_t | SPI_ReadData (SPI_TypeDef *SPIx) |
Read one data from Rx FIFO. More... | |
void | SPI_WriteData (SPI_TypeDef *SPIx, uint16_t data) |
Write one data to Tx FIFO. More... | |
FlagStatus | SPI_GetFlagStatus (SPI_TypeDef *SPIx, uint8_t SPI_FLAG) |
Checks whether the specified SPIx flag is set or not. More... | |
void | SPI_ITConfig (SPI_TypeDef *SPIx, uint8_t SPI_IT, FunctionalState NewState) |
Enables or disables the specified SPI interrupts. More... | |
ITStatus | SPI_GetRawITStatus (SPI_TypeDef *SPIx, uint8_t SPI_IT) |
Checks whether the specified SPIx raw interrupt status. More... | |
ITStatus | SPI_GetITStatus (SPI_TypeDef *SPIx, uint8_t SPI_IT) |
Checks whether the specified SPIx interrupt has occurred or not. More... | |
void | SPI_ClearITPendingBit (SPI_TypeDef *SPIx, uint8_t SPI_IT) |
Clears the SPIx's interrupt pending bits. More... | |
void | SPI_RxFIFOThresholdConfig (SPI_TypeDef *SPIx, uint8_t Threshold) |
Configures the Rx FIFO threshold. More... | |
void | SPI_TxFIFOThresholdConfig (SPI_TypeDef *SPIx, uint8_t Threshold) |
Configures the Tx FIFO threshold. More... | |
uint8_t | SPI_GetRxFIFOLevel (SPI_TypeDef *SPIx) |
Returns the number of data can be read from Rx FIFO. More... | |
uint8_t | SPI_GetTxFIFOLevel (SPI_TypeDef *SPIx) |
Returns the number of data left in Tx FIFO. More... | |
void | SPI_DMARxReqLevelConfig (SPI_TypeDef *SPIx, uint8_t DMARxReqLevel) |
Configures the DMA Rx request level. More... | |
void | SPI_DMATxReqLevelConfig (SPI_TypeDef *SPIx, uint8_t DMATxReqLevel) |
Configures the DMA Tx request level. More... | |
void | SPI_DMACmd (SPI_TypeDef *SPIx, uint32_t SPI_DMAReq, FunctionalState NewState) |
Enables or disables the SPIx's DMA interface. More... | |
void | SPI_RxdSampleDelayConfig (SPI_TypeDef *SPIx, uint8_t DelayValue) |
Configures the rxd sample delay value. More... | |
SPI driver modules.
void SPI_ClearITPendingBit | ( | SPI_TypeDef * | SPIx, |
uint8_t | SPI_IT | ||
) |
Clears the SPIx's interrupt pending bits.
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: QSPI, SPIM2, SPIS1, SPIS2. |
SPI_IT | specifies the interrupt pending bit to clear. This parameter can be a combination of the following values:
|
void SPI_Cmd | ( | SPI_TypeDef * | SPIx, |
FunctionalState | NewState | ||
) |
Enables or disables the specified SPI peripheral.
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: QSPI, SPIM2, SPIS1, SPIS2. |
NewState | new state of the SPIx peripheral. This parameter can be: ENABLE or DISABLE. |
void SPI_DeInit | ( | SPI_TypeDef * | SPIx | ) |
Deinitializes the SPIx peripheral registers to their default reset values.
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: QSPI, SPIM2, SPIS1, SPIS2. |
void SPI_DMACmd | ( | SPI_TypeDef * | SPIx, |
uint32_t | SPI_DMAReq, | ||
FunctionalState | NewState | ||
) |
Enables or disables the SPIx's DMA interface.
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: QSPI, SPIM2, SPIS1, SPIS2. |
SPI_DMAReq | specifies the DMA request. This parameter can be any combination of the following values:
|
NewState | new state of the DMA Request sources. This parameter can be: ENABLE or DISABLE. |
void SPI_DMARxReqLevelConfig | ( | SPI_TypeDef * | SPIx, |
uint8_t | DMARxReqLevel | ||
) |
Configures the DMA Rx request level.
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: QSPI, SPIM2, SPIS1, SPIS2. |
Level | The level of the DMA Rx request to set. |
void SPI_DMATxReqLevelConfig | ( | SPI_TypeDef * | SPIx, |
uint8_t | DMATxReqLevel | ||
) |
Configures the DMA Tx request level.
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: QSPI, SPIM2, SPIS1, SPIS2. |
Level | The level of the DMA Tx request to set. |
void SPI_EnhancedSpiConfig | ( | SPI_TypeDef * | SPIx, |
SPI_EnhancedSpiInitTypeDef * | SPI_EnhancedSpiInitStruct | ||
) |
Configures the Enhanced SPI Mode according to the specified parameters in the SPI_EnhancedSpiInitStruct (only used for QSPI).
SPIx | Pointer to selected SPI peripheral. This parameter must be QSPI. |
SPI_EnhancedSpiInitStruct | pointer to a SPI_EnhancedSpiInitTypeDef structure that contains the configuration information for the Enhanced SPI Mode. |
void SPI_EnhancedSpiStructInit | ( | SPI_EnhancedSpiInitTypeDef * | SPI_EnhancedSpiInitStruct | ) |
Fills each SPI_EnhancedSpiInitStruct member with its default value.
SPI_EnhancedSpiInitStruct | pointer to a SPI_EnhancedSpiInitTypeDef structure which will be initialized. |
FlagStatus SPI_GetFlagStatus | ( | SPI_TypeDef * | SPIx, |
uint8_t | SPI_FLAG | ||
) |
Checks whether the specified SPIx flag is set or not.
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: QSPI, SPIM2, SPIS1, SPIS2. |
SPI_FLAG | specifies the SPI flag to check. This parameter can be one of the following values:
|
ITStatus SPI_GetITStatus | ( | SPI_TypeDef * | SPIx, |
uint8_t | SPI_IT | ||
) |
Checks whether the specified SPIx interrupt has occurred or not.
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: QSPI, SPIM2, SPIS1, SPIS2. |
SPI_IT | specifies the SPI interrupt source to check. This parameter can be one of the following values:
|
ITStatus SPI_GetRawITStatus | ( | SPI_TypeDef * | SPIx, |
uint8_t | SPI_IT | ||
) |
Checks whether the specified SPIx raw interrupt status.
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: QSPI, SPIM2, SPIS1, SPIS2. |
SPI_IT | specifies the SPI interrupt source to check. This parameter can be one of the following values:
|
uint8_t SPI_GetRxFIFOLevel | ( | SPI_TypeDef * | SPIx | ) |
Returns the number of data can be read from Rx FIFO.
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: QSPI, SPIM2, SPIS1, SPIS2. |
uint8_t SPI_GetTxFIFOLevel | ( | SPI_TypeDef * | SPIx | ) |
Returns the number of data left in Tx FIFO.
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: QSPI, SPIM2, SPIS1, SPIS2. |
void SPI_Init | ( | SPI_TypeDef * | SPIx, |
SPI_InitTypeDef * | SPI_InitStruct | ||
) |
Initializes the SPIx peripheral according to the specified parameters in the SPI_InitStruct.
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: QSPI, SPIM2, SPIS1, SPIS2. |
SPI_InitStruct | pointer to a SPI_InitTypeDef structure that contains the configuration information for the specified SPI peripheral. |
void SPI_ITConfig | ( | SPI_TypeDef * | SPIx, |
uint8_t | SPI_IT, | ||
FunctionalState | NewState | ||
) |
Enables or disables the specified SPI interrupts.
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: QSPI, SPIM2, SPIS1, SPIS2. |
SPI_IT | specifies the SPI interrupt source to be enabled or disabled. This parameter can be a combination of the following values:
|
NewState | new state of the specified SPI interrupt. This parameter can be: ENABLE or DISABLE. |
void SPI_MicrowireConfig | ( | SPI_TypeDef * | SPIx, |
SPI_MicrowireInitTypeDef * | SPI_MicrowireInitStruct | ||
) |
Configures the Microwire frame format according to the specified parameters in the SPI_MicrowireInitStruct.
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: QSPI, SPIM2, SPIS1, SPIS2. |
SPI_MicrowireInitStruct | pointer to a SPI_MicrowireInitTypeDef structure that contains the configuration information for the Microwire frame format. |
void SPI_MicrowireStructInit | ( | SPI_MicrowireInitTypeDef * | SPI_MicrowireInitStruct | ) |
Fills each SPI_MicrowireInitStruct member with its default value.
SPI_MicrowireInitStruct | pointer to a SPI_MicrowireInitTypeDef structure which will be initialized. |
void SPI_NSSConfig | ( | SPI_TypeDef * | SPIx, |
uint32_t | SPI_NSS, | ||
FunctionalState | NewState | ||
) |
Enables or disables the specified slave select line (only used for SPIMx).
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: QSPI, SPIM2. |
SPI_NSS | specifies the slave select line to be enabled or disabled. This parameter can be one of the following values:
|
NewState | new state of the slave select line. This parameter can be: ENABLE or DISABLE. |
void SPI_NSSToggleModeCmd | ( | SPI_TypeDef * | SPIx, |
FunctionalState | NewState | ||
) |
Enables or disables the slave select toggle mode.
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: QSPI, SPIM2, SPIS1, SPIS2. |
NewState | new state of the slave select toggle mode. This parameter can be: ENABLE or DISABLE. |
uint16_t SPI_ReadData | ( | SPI_TypeDef * | SPIx | ) |
Read one data from Rx FIFO.
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: QSPI, SPIM2, SPIS1, SPIS2. |
void SPI_ReceiveDataLengthConfig | ( | SPI_TypeDef * | SPIx, |
uint32_t | DataLength | ||
) |
Configures the number of data frames to be continuously received (only used for SPIMx).
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: QSPI, SPIM2. |
DataLength | specifies the number of data frames to be continuously received. |
void SPI_RxdSampleDelayConfig | ( | SPI_TypeDef * | SPIx, |
uint8_t | DelayValue | ||
) |
Configures the rxd sample delay value.
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: QSPI, SPIM2. |
DelayValue | specifies the rxd sample delay value. |
void SPI_RxFIFOThresholdConfig | ( | SPI_TypeDef * | SPIx, |
uint8_t | Threshold | ||
) |
Configures the Rx FIFO threshold.
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: QSPI, SPIM2, SPIS1, SPIS2. |
Threshold | The Rx FIFO threshold to set. |
void SPI_SlaveOutputCmd | ( | SPI_TypeDef * | SPIx, |
FunctionalState | NewState | ||
) |
Enables or disables the slave output (only used for SPISx).
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: SPIS1, SPIS2. |
NewState | new state of the slave output. This parameter can be: ENABLE or DISABLE. |
void SPI_SpiModeConfig | ( | SPI_TypeDef * | SPIx, |
uint32_t | SPI_SpiMode | ||
) |
Configures the Spi Mode.
SPIx | Pointer to selected SPI peripheral. This parameter must be QSPI. |
SPI_SpiMode | specifies the Spi Mode. This parameter can be one of the following values:
|
void SPI_StructInit | ( | SPI_InitTypeDef * | SPI_InitStruct | ) |
Fills each SPI_InitStruct member with its default value.
SPI_InitStruct | pointer to a SPI_InitTypeDef structure which will be initialized. |
void SPI_TransferModeConfig | ( | SPI_TypeDef * | SPIx, |
uint16_t | SPI_TransferMode | ||
) |
Configures the transfer mode.
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: QSPI, SPIM2, SPIS1, SPIS2. |
SPI_TransferMode | specifies the transfer mode. This parameter can be one of the following values:
|
void SPI_TxFIFOThresholdConfig | ( | SPI_TypeDef * | SPIx, |
uint8_t | Threshold | ||
) |
Configures the Tx FIFO threshold.
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: QSPI, SPIM2, SPIS1, SPIS2. |
Threshold | The Tx FIFO threshold to set. |
void SPI_WriteData | ( | SPI_TypeDef * | SPIx, |
uint16_t | Data | ||
) |
Write one data to Tx FIFO.
SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: QSPI, SPIM2, SPIS1, SPIS2. |
Data | The data to write. |