Configuration
The first step in using spi is to configure and bring up the interface. The spi hal provides a configuration structure with the standard spi options. This structure should be filled out according to the project's spi configuration and then it may be used to initialize the interface in use.
Reading
Reading from spi is a pretty simple operation, a buffer and length is passed in. The buffer is filled and the number of characters read are passed back.
Note - you will need to manually pull down the appropriate chip select pin before reading.
Writing
Writing to spi is also a simple operation, a buffer and length are passed in. The buffer is read from and the number of characters written are passed back.
Note - you will need to manually pull down the appropriate chip select pin before reading.
API Docs
More detailed information on the HAL's spi functions and parameters can be found here - SPI