SPI driver modules.
More...
SPI driver modules.
#define CR1_CLEAR_MASK ((uint16_t)0x3040) |
#define CR1_CLEAR_MASK ((uint16_t)0x3040) |
#define CR2_LDMA_MASK ((uint16_t)0x9FFF) |
#define I2SCFGR_CLEAR_MASK ((uint16_t)0xF040) |
#define I2SCFGR_CLEAR_MASK ((uint16_t)0xF040) |
#define PLLCFGR_PPLN_MASK ((uint32_t)0x00007FC0) |
#define PLLCFGR_PPLR_MASK ((uint32_t)0x70000000) |
#define SPI_CR2_FRF ((uint16_t)0x0010) |
#define SPI_SR_TIFRFE ((uint16_t)0x0100) |
void SPI_CRCLengthConfig |
( |
SPI_TypeDef * |
SPIx, |
|
|
uint16_t |
SPI_CRCLength |
|
) |
| |
Configures the CRC calculation length for the selected SPI.
- Parameters
-
SPIx | where x can be 1, 2 or 3 to select the SPI peripheral. |
SPI_CRCLength | specifies the SPI CRC calculation length. This parameter can be one of the following values:
- SPI_CRCLength_8b: Set CRC Calculation to 8 bits
- SPI_CRCLength_16b: Set CRC Calculation to 16 bits
|
- Return values
-
Definition at line 964 of file stm32f30x_spi.c.
uint16_t SPI_GetReceptionFIFOStatus |
( |
SPI_TypeDef * |
SPIx | ) |
|
Returns the current SPIx Reception FIFO filled level.
- Parameters
-
SPIx | where x can be 1, 2 or 3 to select the SPI peripheral. |
- Return values
-
The | Reception FIFO filling state.
- SPI_ReceptionFIFOStatus_Empty: when FIFO is empty
- SPI_ReceptionFIFOStatus_1QuarterFull: if more than 1 quarter-full.
- SPI_ReceptionFIFOStatus_HalfFull: if more than 1 half-full.
- SPI_ReceptionFIFOStatus_Full: when FIFO is full.
|
Definition at line 1275 of file stm32f30x_spi.c.
uint16_t SPI_GetTransmissionFIFOStatus |
( |
SPI_TypeDef * |
SPIx | ) |
|
Returns the current SPIx Transmission FIFO filled level.
- Parameters
-
SPIx | where x can be 1, 2 or 3 to select the SPI peripheral. |
- Return values
-
The | Transmission FIFO filling state.
- SPI_TransmissionFIFOStatus_Empty: when FIFO is empty
- SPI_TransmissionFIFOStatus_1QuarterFull: if more than 1 quarter-full.
- SPI_TransmissionFIFOStatus_HalfFull: if more than 1 half-full.
- SPI_TransmissionFIFOStatus_Full: when FIFO is full.
|
Definition at line 1260 of file stm32f30x_spi.c.
void SPI_I2S_ClearITPendingBit |
( |
SPI_TypeDef * |
SPIx, |
|
|
uint8_t |
SPI_I2S_IT |
|
) |
| |
Clears the SPIx CRC Error (CRCERR) interrupt pending bit.
- Parameters
-
SPIx | To 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_IT | specifies 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
-
- Parameters
-
SPIx | where x can be
|
SPI_I2S_IT | specifies 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
-
Definition at line 1282 of file stm32f4xx_spi.c.
Returns the most recent received data by the SPIx/I2Sx peripheral.
- Parameters
-
SPIx | To 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
-
The | value of the received data. |
- Parameters
-
SPIx | where x can be
- 1, 2 or 3 in SPI mode
- 2 or 3 in I2S mode
|
- Return values
-
The | value of the received data. |
Definition at line 801 of file stm32f4xx_spi.c.
Returns the most recent received data by the SPIx peripheral.
- Parameters
-
SPIx | To 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. |
- Return values
-
The | value of the received data. |
Definition at line 882 of file stm32f30x_spi.c.
void SPI_I2S_SendData |
( |
SPI_TypeDef * |
SPIx, |
|
|
uint16_t |
Data |
|
) |
| |
Transmits a Data through the SPIx/I2Sx peripheral.
- Parameters
-
SPIx | To 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. |
Data | Data to be transmitted. |
- Return values
-
- Parameters
-
SPIx | where x can be
- 1, 2 or 3 in SPI mode
- 2 or 3 in I2S mode
|
Data | : Data to be transmitted. |
- Return values
-
Definition at line 817 of file stm32f4xx_spi.c.
void SPI_I2S_SendData16 |
( |
SPI_TypeDef * |
SPIx, |
|
|
uint16_t |
Data |
|
) |
| |
Transmits a Data through the SPIx/I2Sx peripheral.
- Parameters
-
SPIx | To 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. |
Data | Data to be transmitted. |
- Return values
-
Definition at line 850 of file stm32f30x_spi.c.
void SPI_LastDMATransferCmd |
( |
SPI_TypeDef * |
SPIx, |
|
|
uint16_t |
SPI_LastDMATransfer |
|
) |
| |
Configures the number of data to transfer type(Even/Odd) for the DMA last transfers and for the selected SPI.
- Note
- This function have a meaning only if DMA mode is selected and if the packing mode is used (data length <= 8 and DMA transfer size halfword)
- Parameters
-
SPIx | where x can be 1, 2 or 3 to select the SPI peripheral. |
SPI_LastDMATransfer | specifies the SPI last DMA transfers state. This parameter can be one of the following values:
- SPI_LastDMATransfer_TxEvenRxEven: Number of data for transmission Even and number of data for reception Even.
- SPI_LastDMATransfer_TxOddRxEven: Number of data for transmission Odd and number of data for reception Even.
- SPI_LastDMATransfer_TxEvenRxOdd: Number of data for transmission Even and number of data for reception Odd.
- SPI_LastDMATransfer_TxOddRxOdd: RNumber of data for transmission Odd and number of data for reception Odd.
|
- Return values
-
Definition at line 1125 of file stm32f30x_spi.c.
Enables or disables the NSS pulse management mode.
- Note
- This function can be called only after the SPI_Init() function has been called.
-
When TI mode is selected, the control bits NSSP is not taken into consideration and are configured by hardware respectively to the TI mode requirements.
- Parameters
-
SPIx | where x can be 1, 2 or 3 to select the SPI peripheral. |
NewState | new state of the NSS pulse management mode. This parameter can be: ENABLE or DISABLE. |
- Return values
-
Definition at line 781 of file stm32f30x_spi.c.
Returns the most recent received data by the SPIx peripheral.
- Parameters
-
SPIx | where x can be 1, 2 or 3 to select the SPI peripheral. |
- Return values
-
The | value of the received data. |
Definition at line 863 of file stm32f30x_spi.c.
void SPI_RxFIFOThresholdConfig |
( |
SPI_TypeDef * |
SPIx, |
|
|
uint16_t |
SPI_RxFIFOThreshold |
|
) |
| |
Configures the FIFO reception threshold for the selected SPI.
- Parameters
-
SPIx | where x can be 1, 2 or 3 to select the SPI peripheral. |
SPI_RxFIFOThreshold | specifies the FIFO reception threshold. This parameter can be one of the following values:
- SPI_RxFIFOThreshold_HF: RXNE event is generated if the FIFO level is greater or equal to 1/2.
- SPI_RxFIFOThreshold_QF: RXNE event is generated if the FIFO level is greater or equal to 1/4.
|
- Return values
-
Definition at line 614 of file stm32f30x_spi.c.
void SPI_SendData8 |
( |
SPI_TypeDef * |
SPIx, |
|
|
uint8_t |
Data |
|
) |
| |
Transmits a Data through the SPIx peripheral.
- Parameters
-
SPIx | where x can be 1, 2 or 3 to select the SPI peripheral. |
Data | Data to be transmitted. |
- Return values
-
Definition at line 830 of file stm32f30x_spi.c.