![]() |
GaIA BIOS Library
|
SPI Peripheral Driver. More...
#include <stdint.h>Data Structures | |
| struct | spi_t |
| SPI Peripheral Descriptor. More... | |
Typedefs | |
| typedef void(* | spi_callback_t) (uint32_t event) |
| SPI callback on transfer complete or on transfer error. | |
Functions | |
| void | spi_init (uint8_t spi_id, uint32_t div, spi_callback_t callback) |
| Initializes the given SPI. | |
| void | spi_transfer (uint8_t spi_id, uint8_t *src, uint8_t *dst, uint16_t len) |
| Transfers the block of data requested. | |
SPI Peripheral Driver.
Provides functions to initialize the SPI peripheral and to initiate a transfer.
| typedef void(* spi_callback_t) (uint32_t event) |
SPI callback on transfer complete or on transfer error.
| event | type of event. It can be:
|
| void spi_init | ( | uint8_t | spi_id, |
| uint32_t | div, | ||
| spi_callback_t | callback ) |
Initializes the given SPI.
| spi_id | - SPI identifier |
| div | - Divider for the baudrate value. It can be one of: SPI_DIV_2, SPI_DIV_4, SPI_DIV_8, SPI_DIV_16, SPI_DIV_32, SPI_DIV_64, SPI_DIV_128, SPI_DIV_256. |
| callback | - function to be called at the end of the tranfer or in case of errors. |
| void spi_transfer | ( | uint8_t | spi_id, |
| uint8_t * | src, | ||
| uint8_t * | dst, | ||
| uint16_t | len ) |
Transfers the block of data requested.
| spi_id | - SPI identifier. |
| src | - source buffer. It can be NULL if it is a send-only transfer. |
| dst | - destination buffer. It can be NULL if it is a send-only transfer. |
| len | - buffers length. |