Functions
Collaboration diagram for SPI_Exported_Functions:

Functions

void I2S_Cmd (SPI_TypeDef *SPIx, FunctionalState NewState)
 Enables or disables the specified SPI peripheral (in I2S mode). More...
 
void I2S_Init (SPI_TypeDef *SPIx, I2S_InitTypeDef *I2S_InitStruct)
 Initializes the SPIx peripheral according to the specified parameters in the I2S_InitStruct. More...
 
void I2S_StructInit (I2S_InitTypeDef *I2S_InitStruct)
 Fills each I2S_InitStruct member with its default value. More...
 
void SPI_BiDirectionalLineConfig (SPI_TypeDef *SPIx, uint16_t SPI_Direction)
 Selects the data transfer direction in bidirectional mode for the specified SPI. More...
 
void SPI_CalculateCRC (SPI_TypeDef *SPIx, FunctionalState NewState)
 Enables or disables the CRC value calculation of the transferred bytes. More...
 
void SPI_Cmd (SPI_TypeDef *SPIx, FunctionalState NewState)
 Enables or disables the specified SPI peripheral. More...
 
void SPI_DataSizeConfig (SPI_TypeDef *SPIx, uint16_t SPI_DataSize)
 Configures the data size for the selected SPI. More...
 
uint16_t SPI_GetCRC (SPI_TypeDef *SPIx, uint8_t SPI_CRC)
 Returns the transmit or the receive CRC register value for the specified SPI. More...
 
uint16_t SPI_GetCRCPolynomial (SPI_TypeDef *SPIx)
 Returns the CRC Polynomial register value for the specified SPI. More...
 
void SPI_I2S_ClearFlag (SPI_TypeDef *SPIx, uint16_t SPI_I2S_FLAG)
 Clears the SPIx CRC Error (CRCERR) flag. More...
 
void SPI_I2S_ClearITPendingBit (SPI_TypeDef *SPIx, uint8_t SPI_I2S_IT)
 Clears the SPIx CRC Error (CRCERR) interrupt pending bit. More...
 
void SPI_I2S_DeInit (SPI_TypeDef *SPIx)
 De-initialize the SPIx peripheral registers to their default reset values. More...
 
void SPI_I2S_DMACmd (SPI_TypeDef *SPIx, uint16_t SPI_I2S_DMAReq, FunctionalState NewState)
 Enables or disables the SPIx/I2Sx DMA interface. More...
 
FlagStatus SPI_I2S_GetFlagStatus (SPI_TypeDef *SPIx, uint16_t SPI_I2S_FLAG)
 Checks whether the specified SPIx/I2Sx flag is set or not. More...
 
ITStatus SPI_I2S_GetITStatus (SPI_TypeDef *SPIx, uint8_t SPI_I2S_IT)
 Checks whether the specified SPIx/I2Sx interrupt has occurred or not. More...
 
void SPI_I2S_ITConfig (SPI_TypeDef *SPIx, uint8_t SPI_I2S_IT, FunctionalState NewState)
 Enables or disables the specified SPI/I2S interrupts. More...
 
uint16_t SPI_I2S_ReceiveData (SPI_TypeDef *SPIx)
 Returns the most recent received data by the SPIx/I2Sx peripheral. More...
 
void SPI_I2S_SendData (SPI_TypeDef *SPIx, uint16_t Data)
 Transmits a Data through the SPIx/I2Sx peripheral. 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_NSSInternalSoftwareConfig (SPI_TypeDef *SPIx, uint16_t SPI_NSSInternalSoft)
 Configures internally by software the NSS pin for the selected SPI. More...
 
void SPI_SSOutputCmd (SPI_TypeDef *SPIx, FunctionalState NewState)
 Enables or disables the SS output for the selected SPI. More...
 
void SPI_StructInit (SPI_InitTypeDef *SPI_InitStruct)
 Fills each SPI_InitStruct member with its default value. More...
 
void SPI_TransmitCRC (SPI_TypeDef *SPIx)
 Transmit the SPIx CRC value. More...
 

Detailed Description

Function Documentation

void I2S_Cmd ( SPI_TypeDef SPIx,
FunctionalState  NewState 
)

Enables or disables the specified SPI peripheral (in I2S mode).

Parameters
SPIxwhere x can be 2 or 3 to select the SPI peripheral (or I2Sxext for full duplex mode).
NewStatenew state of the SPIx peripheral. This parameter can be: ENABLE or DISABLE.
Return values
None
Parameters
SPIx:Toselect the SPIx peripheral, where x can be: 2 or 3 in I2S mode or I2Sxext for I2S full duplex mode.
NewStatenew state of the SPIx peripheral. This parameter can be: ENABLE or DISABLE.
Return values
None
Parameters
SPIxwhere x can be 2 or 3 to select the SPI peripheral.
NewStatenew state of the SPIx peripheral. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 562 of file stm32f4xx_spi.c.

void I2S_Init ( SPI_TypeDef SPIx,
I2S_InitTypeDef I2S_InitStruct 
)

Initializes the SPIx peripheral according to the specified parameters in the I2S_InitStruct.

Parameters
SPIxwhere x can be 2 or 3 to select the SPI peripheral (configured in I2S mode).
I2S_InitStructpointer to an I2S_InitTypeDef structure that contains the configuration information for the specified SPI peripheral configured in I2S mode.
Note
The function calculates the optimal prescaler needed to obtain the most accurate audio frequency (depending on the I2S clock source, the PLL values and the product configuration). But in case the prescaler value is greater than 511, the default value (0x02) will be configured instead.
if an external clock is used as source clock for the I2S, then the define I2S_EXTERNAL_CLOCK_VAL in file stm32f4xx_conf.h should be enabled and set to the value of the the source clock frequency (in Hz).
Return values
None
Parameters
SPIx:Toselect the SPIx peripheral, where x can be: 2 or 3 in I2S mode.
I2S_InitStructpointer to an I2S_InitTypeDef structure that contains the configuration information for the specified SPI peripheral configured in I2S mode.
Note
The function calculates the optimal prescaler needed to obtain the most accurate audio frequency (depending on the I2S clock source, the PLL values and the product configuration). But in case the prescaler value is greater than 511, the default value (0x02) will be configured instead.
Return values
None
Parameters
SPIxwhere x can be 2 or 3 to select the SPI peripheral (configured in I2S mode).
I2S_InitStructpointer to an I2S_InitTypeDef structure that contains the configuration information for the specified SPI peripheral configured in I2S mode.
Note
The function calculates the optimal prescaler needed to obtain the most accurate audio frequency (depending on the I2S clock source, the PLL values and the product configuration). But in case the prescaler value is greater than 511, the default value (0x02) will be configured instead. *
Return values
None

Definition at line 348 of file stm32f4xx_spi.c.

void I2S_StructInit ( I2S_InitTypeDef I2S_InitStruct)

Fills each I2S_InitStruct member with its default value.

Parameters
I2S_InitStructpointer to a I2S_InitTypeDef structure which will be initialized.
Return values
None
Parameters
I2S_InitStruct: pointer to a I2S_InitTypeDef structure which will be initialized.
Return values
None
Parameters
I2S_InitStruct: pointer to a I2S_InitTypeDef structure which will be initialized.
Return values
None

Definition at line 508 of file stm32f4xx_spi.c.

void SPI_BiDirectionalLineConfig ( SPI_TypeDef SPIx,
uint16_t  SPI_Direction 
)

Selects the data transfer direction in bidirectional mode for the specified SPI.

Parameters
SPIxwhere x can be 1, 2, 3, 4, 5 or 6 to select the SPI peripheral.
SPI_Directionspecifies the data transfer direction in bidirectional mode. This parameter can be one of the following values:
  • SPI_Direction_Tx: Selects Tx transmission direction
  • SPI_Direction_Rx: Selects Rx receive direction
Return values
None
Parameters
SPIxwhere x can be 1, 2 or 3 to select the SPI peripheral.
SPI_Directionspecifies the data transfer direction in bidirectional mode. This parameter can be one of the following values:
  • SPI_Direction_Tx: Selects Tx transmission direction
  • SPI_Direction_Rx: Selects Rx receive direction
Return values
NoneSelects the data transfer direction in bidirectional mode for the specified SPI.
Parameters
SPIxwhere x can be 1, 2 or 3 to select the SPI peripheral.
SPI_Directionspecifies the data transfer direction in bi-directional mode. This parameter can be one of the following values:
  • SPI_Direction_Tx: Selects Tx transmission direction
  • SPI_Direction_Rx: Selects Rx receive direction
Return values
None

Definition at line 609 of file stm32f4xx_spi.c.

void SPI_CalculateCRC ( SPI_TypeDef SPIx,
FunctionalState  NewState 
)

Enables or disables the CRC value calculation of the transferred bytes.

Parameters
SPIxwhere x can be 1, 2, 3, 4, 5 or 6 to select the SPI peripheral.
NewStatenew state of the SPIx CRC value calculation. This parameter can be: ENABLE or DISABLE.
Return values
None
Parameters
SPIxwhere x can be 1, 2 or 3 to select the SPI peripheral.
NewStatenew state of the SPIx CRC value calculation. This parameter can be: ENABLE or DISABLE.
Return values
None
Parameters
SPIxwhere x can be 1, 2 or 3 to select the SPI peripheral.
NewStatenew state of the SPIx CRC value calculation. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 907 of file stm32f4xx_spi.c.

void SPI_Cmd ( SPI_TypeDef SPIx,
FunctionalState  NewState 
)

Enables or disables the specified SPI peripheral.

Parameters
SPIxwhere x can be 1, 2, 3, 4, 5 or 6 to select the SPI peripheral.
NewStatenew state of the SPIx peripheral. This parameter can be: ENABLE or DISABLE.
Return values
None
Parameters
SPIxwhere x can be 1, 2 or 3 to select the SPI peripheral.
NewStatenew state of the SPIx peripheral. This parameter can be: ENABLE or DISABLE.
Return values
None
Parameters
SPIxwhere x can be 1, 2 or 3 to select the SPI peripheral.
NewStatenew state of the SPIx peripheral. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 537 of file stm32f4xx_spi.c.

void SPI_DataSizeConfig ( SPI_TypeDef SPIx,
uint16_t  SPI_DataSize 
)

Configures the data size for the selected SPI.

Parameters
SPIxwhere x can be 1, 2, 3, 4, 5 or 6 to select the SPI peripheral.
SPI_DataSizespecifies the SPI data size. This parameter can be one of the following values:
  • SPI_DataSize_16b: Set data frame format to 16bit
  • SPI_DataSize_8b: Set data frame format to 8bit
Return values
None
Parameters
SPIxwhere x can be 1, 2 or 3 to select the SPI peripheral.
SPI_DataSizespecifies the SPI data size. For the SPIx peripheral this parameter can be one of the following values:
  • SPI_DataSize_4b: Set data size to 4 bits
  • SPI_DataSize_5b: Set data size to 5 bits
  • SPI_DataSize_6b: Set data size to 6 bits
  • SPI_DataSize_7b: Set data size to 7 bits
  • SPI_DataSize_8b: Set data size to 8 bits
  • SPI_DataSize_9b: Set data size to 9 bits
  • SPI_DataSize_10b: Set data size to 10 bits
  • SPI_DataSize_11b: Set data size to 11 bits
  • SPI_DataSize_12b: Set data size to 12 bits
  • SPI_DataSize_13b: Set data size to 13 bits
  • SPI_DataSize_14b: Set data size to 14 bits
  • SPI_DataSize_15b: Set data size to 15 bits
  • SPI_DataSize_16b: Set data size to 16 bits
Return values
None
Parameters
SPIxwhere x can be 1, 2 or 3 to select the SPI peripheral.
SPI_DataSizespecifies the SPI data size. This parameter can be one of the following values:
  • SPI_DataSize_16b: Set data frame format to 16bit
  • SPI_DataSize_8b: Set data frame format to 8bit
Return values
None

Definition at line 589 of file stm32f4xx_spi.c.

uint16_t SPI_GetCRC ( SPI_TypeDef SPIx,
uint8_t  SPI_CRC 
)

Returns the transmit or the receive CRC register value for the specified SPI.

Parameters
SPIxwhere x can be 1, 2, 3, 4, 5 or 6 to select the SPI peripheral.
SPI_CRCspecifies the CRC register to be read. This parameter can be one of the following values:
  • SPI_CRC_Tx: Selects Tx CRC register
  • SPI_CRC_Rx: Selects Rx CRC register
Return values
Theselected CRC register value..
Parameters
SPIxwhere x can be 1, 2 or 3 to select the SPI peripheral.
SPI_CRCspecifies the CRC register to be read. This parameter can be one of the following values:
  • SPI_CRC_Tx: Selects Tx CRC register
  • SPI_CRC_Rx: Selects Rx CRC register
Return values
Theselected CRC register value..
Parameters
SPIxwhere x can be 1, 2 or 3 to select the SPI peripheral.
SPI_CRCspecifies the CRC register to be read. This parameter can be one of the following values:
  • SPI_CRC_Tx: Selects Tx CRC register
  • SPI_CRC_Rx: Selects Rx CRC register
Return values
Theselected CRC register value..

Definition at line 947 of file stm32f4xx_spi.c.

uint16_t SPI_GetCRCPolynomial ( SPI_TypeDef SPIx)

Returns the CRC Polynomial register value for the specified SPI.

Parameters
SPIxwhere x can be 1, 2, 3, 4, 5 or 6 to select the SPI peripheral.
Return values
TheCRC Polynomial register value.
Parameters
SPIxwhere x can be 1, 2 or 3 to select the SPI peripheral.
Return values
TheCRC Polynomial register value.
Parameters
SPIxwhere x can be 1, 2 or 3 to select the SPI peripheral.
Return values
TheCRC Polynomial register value.

Definition at line 972 of file stm32f4xx_spi.c.

void SPI_I2S_ClearFlag ( SPI_TypeDef SPIx,
uint16_t  SPI_I2S_FLAG 
)

Clears the SPIx CRC Error (CRCERR) flag.

Parameters
SPIxTo select the SPIx/I2Sx peripheral, where x can be: 1, 2, 3, 4, 5 or 6 in SPI mode or 2 or 3 in I2S mode or I2Sxext for I2S full duplex mode.
SPI_I2S_FLAGspecifies the SPI flag to clear. This function clears only CRCERR flag.
  • SPI_FLAG_CRCERR: CRC Error flag.
Note
OVR (OverRun error) flag is cleared by software sequence: a read operation to SPI_DR register (SPI_I2S_ReceiveData()) followed by a read operation to SPI_SR register (SPI_I2S_GetFlagStatus()).
UDR (UnderRun error) flag is cleared by a read operation to SPI_SR register (SPI_I2S_GetFlagStatus()).
MODF (Mode Fault) flag is cleared by software sequence: a read/write operation to SPI_SR register (SPI_I2S_GetFlagStatus()) followed by a write operation to SPI_CR1 register (SPI_Cmd() to enable the SPI).
Return values
None
Parameters
SPIxTo select the SPIx/I2Sx peripheral, where x can be: 1, 2 or 3 in SPI mode or 2 or 3 in I2S mode or I2Sxext for I2S full duplex mode.
SPI_I2S_FLAGspecifies the SPI flag to clear. This function clears only CRCERR flag.
Note
OVR (OverRun error) flag is cleared by software sequence: a read operation to SPI_DR register (SPI_I2S_ReceiveData()) followed by a read operation to SPI_SR register (SPI_I2S_GetFlagStatus()).
MODF (Mode Fault) flag is cleared by software sequence: a read/write operation to SPI_SR register (SPI_I2S_GetFlagStatus()) followed by a write operation to SPI_CR1 register (SPI_Cmd() to enable the SPI).
Return values
None
Parameters
SPIxwhere x can be
  • 1, 2 or 3 in SPI mode
SPI_I2S_FLAGspecifies the SPI flag to clear. This function clears only CRCERR flag.
Note
Return values
None

Definition at line 1202 of file stm32f4xx_spi.c.

void SPI_I2S_ClearITPendingBit ( SPI_TypeDef SPIx,
uint8_t  SPI_I2S_IT 
)

Clears the SPIx CRC Error (CRCERR) interrupt pending bit.

Parameters
SPIxTo select the SPIx/I2Sx peripheral, where x can be: 1, 2, 3, 4, 5 or 6 in SPI mode or 2 or 3 in I2S mode or I2Sxext for I2S full duplex mode.
SPI_I2S_ITspecifies the SPI interrupt pending bit to clear. This function clears only CRCERR interrupt pending bit.
  • SPI_IT_CRCERR: CRC Error interrupt.
Note
OVR (OverRun Error) interrupt pending bit is cleared by software sequence: a read operation to SPI_DR register (SPI_I2S_ReceiveData()) followed by a read operation to SPI_SR register (SPI_I2S_GetITStatus()).
UDR (UnderRun Error) interrupt pending bit is cleared by a read operation to SPI_SR register (SPI_I2S_GetITStatus()).
MODF (Mode Fault) interrupt pending bit is cleared by software sequence: a read/write operation to SPI_SR register (SPI_I2S_GetITStatus()) followed by a write operation to SPI_CR1 register (SPI_Cmd() to enable the SPI).
Return values
None
Parameters
SPIxwhere x can be
  • 1, 2 or 3 in SPI mode
SPI_I2S_ITspecifies the SPI interrupt pending bit to clear. This function clears only CRCERR interrupt pending bit.
Note
  • OVR (OverRun Error) interrupt pending bit is cleared by software sequence: a read operation to SPI_DR register (SPI_I2S_ReceiveData()) followed by a read operation to SPI_SR register (SPI_I2S_GetITStatus()).
  • UDR (UnderRun Error) interrupt pending bit is cleared by a read operation to SPI_SR register (SPI_I2S_GetITStatus()).
  • MODF (Mode Fault) interrupt pending bit is cleared by software sequence: a read/write operation to SPI_SR register (SPI_I2S_GetITStatus()) followed by a write operation to SPI_CR1 register (SPI_Cmd() to enable the SPI).
Return values
None

Definition at line 1282 of file stm32f4xx_spi.c.

void SPI_I2S_DeInit ( SPI_TypeDef SPIx)

De-initialize the SPIx peripheral registers to their default reset values.

Deinitializes the SPIx peripheral registers to their default reset values.

Parameters
SPIxTo select the SPIx/I2Sx peripheral, where x can be: 1, 2, 3, 4, 5 or 6 in SPI mode or 2 or 3 in I2S mode.
Note
The extended I2S blocks (ie. I2S2ext and I2S3ext blocks) are de-initialized when the relative I2S peripheral is de-initialized (the extended block's clock is managed by the I2S peripheral clock).
Return values
None
Parameters
SPIxTo select the SPIx peripheral, where x can be: 1, 2 or 3 in SPI mode.
Return values
NoneDe-initialize the SPIx peripheral registers to their default reset values.

Deinitializes the SPIx peripheral registers to their default reset values.

Parameters
SPIxwhere x can be 1, 2 or 3 to select the SPI peripheral.
Return values
None

Definition at line 224 of file stm32f4xx_spi.c.

void SPI_I2S_DMACmd ( SPI_TypeDef SPIx,
uint16_t  SPI_I2S_DMAReq,
FunctionalState  NewState 
)

Enables or disables the SPIx/I2Sx DMA interface.

Parameters
SPIxTo select the SPIx/I2Sx peripheral, where x can be: 1, 2, 3, 4, 5 or 6 in SPI mode or 2 or 3 in I2S mode or I2Sxext for I2S full duplex mode.
SPI_I2S_DMAReqspecifies the SPI DMA transfer request to be enabled or disabled. This parameter can be any combination of the following values:
  • SPI_I2S_DMAReq_Tx: Tx buffer DMA transfer request
  • SPI_I2S_DMAReq_Rx: Rx buffer DMA transfer request
NewStatenew state of the selected SPI DMA transfer request. This parameter can be: ENABLE or DISABLE.
Return values
None
Parameters
SPIx:Toselect the SPIx/I2Sx peripheral, where x can be: 1, 2 or 3 in SPI mode or 2 or 3 in I2S mode or I2Sxext for I2S full duplex mode.
SPI_I2S_DMAReqspecifies the SPI DMA transfer request to be enabled or disabled. This parameter can be any combination of the following values:
  • SPI_I2S_DMAReq_Tx: Tx buffer DMA transfer request
  • SPI_I2S_DMAReq_Rx: Rx buffer DMA transfer request
NewStatenew state of the selected SPI DMA transfer request. This parameter can be: ENABLE or DISABLE.
Return values
None
Parameters
SPIxwhere x can be
  • 1, 2 or 3 in SPI mode
  • 2 or 3 in I2S mode
SPI_I2S_DMAReqspecifies the SPI/I2S DMA transfer request to be enabled or disabled. This parameter can be any combination of the following values:
  • SPI_I2S_DMAReq_Tx: Tx buffer DMA transfer request
  • SPI_I2S_DMAReq_Rx: Rx buffer DMA transfer request
NewStatenew state of the selected SPI/I2S DMA transfer request. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 1009 of file stm32f4xx_spi.c.

FlagStatus SPI_I2S_GetFlagStatus ( SPI_TypeDef SPIx,
uint16_t  SPI_I2S_FLAG 
)

Checks whether the specified SPIx/I2Sx flag is set or not.

Checks whether the specified SPI flag is set or not.

Parameters
SPIxTo select the SPIx/I2Sx peripheral, where x can be: 1, 2, 3, 4, 5 or 6 in SPI mode or 2 or 3 in I2S mode or I2Sxext for I2S full duplex mode.
SPI_I2S_FLAGspecifies the SPI flag to check. This parameter can be one of the following values:
  • SPI_I2S_FLAG_TXE: Transmit buffer empty flag.
  • SPI_I2S_FLAG_RXNE: Receive buffer not empty flag.
  • SPI_I2S_FLAG_BSY: Busy flag.
  • SPI_I2S_FLAG_OVR: Overrun flag.
  • SPI_FLAG_MODF: Mode Fault flag.
  • SPI_FLAG_CRCERR: CRC Error flag.
  • SPI_I2S_FLAG_TIFRFE: Format Error.
  • I2S_FLAG_UDR: Underrun Error flag.
  • I2S_FLAG_CHSIDE: Channel Side flag.
Return values
Thenew state of SPI_I2S_FLAG (SET or RESET).
Parameters
SPIxTo select the SPIx/I2Sx peripheral, where x can be: 1, 2 or 3 in SPI mode or 2 or 3 in I2S mode or I2Sxext for I2S full duplex mode.
SPI_I2S_FLAGspecifies the SPI flag to check. This parameter can be one of the following values:
  • SPI_I2S_FLAG_TXE: Transmit buffer empty flag.
  • SPI_I2S_FLAG_RXNE: Receive buffer not empty flag.
  • SPI_I2S_FLAG_BSY: Busy flag.
  • SPI_I2S_FLAG_OVR: Overrun flag.
  • SPI_I2S_FLAG_MODF: Mode Fault flag.
  • SPI_I2S_FLAG_CRCERR: CRC Error flag.
  • SPI_I2S_FLAG_FRE: TI frame format error flag.
  • I2S_FLAG_UDR: Underrun Error flag.
  • I2S_FLAG_CHSIDE: Channel Side flag.
Return values
Thenew state of SPI_I2S_FLAG (SET or RESET).

Checks whether the specified SPIx/I2Sx flag is set or not.

Checks whether the specified SPI flag is set or not.

Parameters
SPIxwhere x can be
  • 1, 2 or 3 in SPI mode
  • 2 or 3 in I2S mode
SPI_I2S_FLAGspecifies the SPI/I2S flag to check. This parameter can be one of the following values:
  • SPI_I2S_FLAG_TXE: Transmit buffer empty flag.
  • SPI_I2S_FLAG_RXNE: Receive buffer not empty flag.
  • SPI_I2S_FLAG_BSY: Busy flag.
  • SPI_I2S_FLAG_OVR: Overrun flag.
  • SPI_FLAG_MODF: Mode Fault flag.
  • SPI_FLAG_CRCERR: CRC Error flag.
  • I2S_FLAG_UDR: Underrun Error flag.
  • I2S_FLAG_CHSIDE: Channel Side flag.
Return values
Thenew state of SPI_I2S_FLAG (SET or RESET).

Definition at line 1161 of file stm32f4xx_spi.c.

ITStatus SPI_I2S_GetITStatus ( SPI_TypeDef SPIx,
uint8_t  SPI_I2S_IT 
)

Checks whether the specified SPIx/I2Sx interrupt has occurred or not.

Checks whether the specified SPI/I2S interrupt has occurred or not.

Parameters
SPIxTo select the SPIx/I2Sx peripheral, where x can be: 1, 2, 3, 4, 5 or 6 in SPI mode or 2 or 3 in I2S mode or I2Sxext for I2S full duplex mode.
SPI_I2S_ITspecifies the SPI interrupt source to check. This parameter can be one of the following values:
  • SPI_I2S_IT_TXE: Transmit buffer empty interrupt.
  • SPI_I2S_IT_RXNE: Receive buffer not empty interrupt.
  • SPI_I2S_IT_OVR: Overrun interrupt.
  • SPI_IT_MODF: Mode Fault interrupt.
  • SPI_IT_CRCERR: CRC Error interrupt.
  • I2S_IT_UDR: Underrun interrupt.
  • SPI_I2S_IT_TIFRFE: Format Error interrupt.
Return values
Thenew state of SPI_I2S_IT (SET or RESET).
Parameters
SPIxTo select the SPIx/I2Sx peripheral, where x can be: 1, 2 or 3 in SPI mode or 2 or 3 in I2S mode or I2Sxext for I2S full duplex mode.
SPI_I2S_ITspecifies the SPI interrupt source to check. This parameter can be one of the following values:
  • SPI_I2S_IT_TXE: Transmit buffer empty interrupt.
  • SPI_I2S_IT_RXNE: Receive buffer not empty interrupt.
  • SPI_IT_MODF: Mode Fault interrupt.
  • SPI_I2S_IT_OVR: Overrun interrupt.
  • I2S_IT_UDR: Underrun interrupt.
  • SPI_I2S_IT_FRE: Format Error interrupt.
Return values
Thenew state of SPI_I2S_IT (SET or RESET).

Checks whether the specified SPIx/I2Sx interrupt has occurred or not.

Parameters
SPIxwhere x can be
  • 1, 2 or 3 in SPI mode
  • 2 or 3 in I2S mode
SPI_I2S_ITspecifies the SPI/I2S interrupt source to check. This parameter can be one of the following values:
  • SPI_I2S_IT_TXE: Transmit buffer empty interrupt.
  • SPI_I2S_IT_RXNE: Receive buffer not empty interrupt.
  • SPI_I2S_IT_OVR: Overrun interrupt.
  • SPI_IT_MODF: Mode Fault interrupt.
  • SPI_IT_CRCERR: CRC Error interrupt.
  • I2S_IT_UDR: Underrun Error interrupt.
Return values
Thenew state of SPI_I2S_IT (SET or RESET).

Definition at line 1227 of file stm32f4xx_spi.c.

void SPI_I2S_ITConfig ( SPI_TypeDef SPIx,
uint8_t  SPI_I2S_IT,
FunctionalState  NewState 
)

Enables or disables the specified SPI/I2S interrupts.

Parameters
SPIxTo select the SPIx/I2Sx peripheral, where x can be: 1, 2, 3, 4, 5 or 6 in SPI mode or 2 or 3 in I2S mode or I2Sxext for I2S full duplex mode.
SPI_I2S_ITspecifies the SPI interrupt source to be enabled or disabled. This parameter can be one of the following values:
  • SPI_I2S_IT_TXE: Tx buffer empty interrupt mask
  • SPI_I2S_IT_RXNE: Rx buffer not empty interrupt mask
  • SPI_I2S_IT_ERR: Error interrupt mask
NewStatenew state of the specified SPI interrupt. This parameter can be: ENABLE or DISABLE.
Return values
None
Parameters
SPIxTo select the SPIx/I2Sx peripheral, where x can be: 1, 2 or 3 in SPI mode or 2 or 3 in I2S mode or I2Sxext for I2S full duplex mode.
SPI_I2S_ITspecifies the SPI interrupt source to be enabled or disabled. This parameter can be one of the following values:
  • SPI_I2S_IT_TXE: Tx buffer empty interrupt mask
  • SPI_I2S_IT_RXNE: Rx buffer not empty interrupt mask
  • SPI_I2S_IT_ERR: Error interrupt mask
NewStatenew state of the specified SPI interrupt. This parameter can be: ENABLE or DISABLE.
Return values
None
Parameters
SPIxwhere x can be
  • 1, 2 or 3 in SPI mode
  • 2 or 3 in I2S mode
SPI_I2S_ITspecifies the SPI/I2S interrupt source to be enabled or disabled. This parameter can be one of the following values:
  • SPI_I2S_IT_TXE: Tx buffer empty interrupt mask
  • SPI_I2S_IT_RXNE: Rx buffer not empty interrupt mask
  • SPI_I2S_IT_ERR: Error interrupt mask
NewStatenew state of the specified SPI/I2S interrupt. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 1117 of file stm32f4xx_spi.c.

uint16_t SPI_I2S_ReceiveData ( SPI_TypeDef SPIx)

Returns the most recent received data by the SPIx/I2Sx peripheral.

Parameters
SPIxTo select the SPIx/I2Sx peripheral, where x can be: 1, 2, 3, 4, 5 or 6 in SPI mode or 2 or 3 in I2S mode or I2Sxext for I2S full duplex mode.
Return values
Thevalue of the received data.
Parameters
SPIxwhere x can be
  • 1, 2 or 3 in SPI mode
  • 2 or 3 in I2S mode
Return values
Thevalue of the received data.

Definition at line 801 of file stm32f4xx_spi.c.

void SPI_I2S_SendData ( SPI_TypeDef SPIx,
uint16_t  Data 
)

Transmits a Data through the SPIx/I2Sx peripheral.

Parameters
SPIxTo select the SPIx/I2Sx peripheral, where x can be: 1, 2, 3, 4, 5 or 6 in SPI mode or 2 or 3 in I2S mode or I2Sxext for I2S full duplex mode.
DataData to be transmitted.
Return values
None
Parameters
SPIxwhere x can be
  • 1, 2 or 3 in SPI mode
  • 2 or 3 in I2S mode
Data: Data to be transmitted.
Return values
None

Definition at line 817 of file stm32f4xx_spi.c.

void SPI_Init ( SPI_TypeDef SPIx,
SPI_InitTypeDef SPI_InitStruct 
)

Initializes the SPIx peripheral according to the specified parameters in the SPI_InitStruct.

Parameters
SPIxwhere x can be 1, 2, 3, 4, 5 or 6 to select the SPI peripheral.
SPI_InitStructpointer to a SPI_InitTypeDef structure that contains the configuration information for the specified SPI peripheral.
Return values
None
Parameters
SPIxwhere x can be 1, 2 or 3 to select the SPI peripheral.
SPI_InitStructpointer to a SPI_InitTypeDef structure that contains the configuration information for the specified SPI peripheral.
Return values
None
Parameters
SPIxwhere x can be 1, 2 or 3 to select the SPI peripheral.
SPI_InitStructpointer to a SPI_InitTypeDef structure that contains the configuration information for the specified SPI peripheral.
Return values
None

Definition at line 284 of file stm32f4xx_spi.c.

void SPI_NSSInternalSoftwareConfig ( SPI_TypeDef SPIx,
uint16_t  SPI_NSSInternalSoft 
)

Configures internally by software the NSS pin for the selected SPI.

Parameters
SPIxwhere x can be 1, 2, 3, 4, 5 or 6 to select the SPI peripheral.
SPI_NSSInternalSoftspecifies the SPI NSS internal state. This parameter can be one of the following values:
  • SPI_NSSInternalSoft_Set: Set NSS pin internally
  • SPI_NSSInternalSoft_Reset: Reset NSS pin internally
Return values
None
Note
This function can be called only after the SPI_Init() function has been called.
Parameters
SPIxwhere x can be 1, 2 or 3 to select the SPI peripheral.
SPI_NSSInternalSoftspecifies the SPI NSS internal state. This parameter can be one of the following values:
  • SPI_NSSInternalSoft_Set: Set NSS pin internally
  • SPI_NSSInternalSoft_Reset: Reset NSS pin internally
Return values
None
Parameters
SPIxwhere x can be 1, 2 or 3 to select the SPI peripheral.
SPI_NSSInternalSoftspecifies the SPI NSS internal state. This parameter can be one of the following values:
  • SPI_NSSInternalSoft_Set: Set NSS pin internally
  • SPI_NSSInternalSoft_Reset: Reset NSS pin internally
Return values
None

Definition at line 635 of file stm32f4xx_spi.c.

void SPI_SSOutputCmd ( SPI_TypeDef SPIx,
FunctionalState  NewState 
)

Enables or disables the SS output for the selected SPI.

Parameters
SPIxwhere x can be 1, 2, 3, 4, 5 or 6 to select the SPI peripheral.
NewStatenew state of the SPIx SS output. This parameter can be: ENABLE or DISABLE.
Return values
None
Note
This function can be called only after the SPI_Init() function has been called and the NSS hardware management mode is selected.
Parameters
SPIxwhere x can be 1, 2 or 3 to select the SPI peripheral.
NewStatenew state of the SPIx SS output. This parameter can be: ENABLE or DISABLE.
Return values
None
Parameters
SPIxwhere x can be 1, 2 or 3 to select the SPI peripheral.
NewStatenew state of the SPIx SS output. This parameter can be: ENABLE or DISABLE.
Return values
None

Definition at line 659 of file stm32f4xx_spi.c.

void SPI_StructInit ( SPI_InitTypeDef SPI_InitStruct)

Fills each SPI_InitStruct member with its default value.

Parameters
SPI_InitStructpointer to a SPI_InitTypeDef structure which will be initialized.
Return values
None
Parameters
SPI_InitStruct: pointer to a SPI_InitTypeDef structure which will be initialized.
Return values
None

Definition at line 480 of file stm32f4xx_spi.c.

void SPI_TransmitCRC ( SPI_TypeDef SPIx)

Transmit the SPIx CRC value.

Transmits the SPIx CRC value.

Parameters
SPIxwhere x can be 1, 2, 3, 4, 5 or 6 to select the SPI peripheral.
Return values
None
Parameters
SPIxwhere x can be 1, 2 or 3 to select the SPI peripheral.
Return values
NoneTransmits the SPIx CRC value.
Parameters
SPIxwhere x can be 1, 2 or 3 to select the SPI peripheral.
Return values
None

Definition at line 929 of file stm32f4xx_spi.c.



rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Oct 24 2019 03:17:23