The SPI driver provides the interface to configure and use the SPI peripheral.
The Serial Peripheral Interface (SPI) circuit is a synchronous serial data link that provides communication with external devices in Master or Slave Mode.
To use the SPI, the user has to follow these few steps:
- Enable the SPI pins required by the application (see pio.h).
- Configure the SPI using the SPI_Configure(). This enables the peripheral clock. The mode register is loaded with the given value.
- Configure all the necessary chip selects with SPI_ConfigureNPCS().
- Enable the SPI by calling SPI_Enable().
- Send/receive data using SPI_Write() and SPI_Read(). Note that SPI_Read() must be called after SPI_Write() to retrieve the last value read.
- Disable the SPI by calling SPI_Disable().
For more accurate information, please look at the SPI section of the Datasheet.
Related files :
spi.c
spi.h.