This file defines the spi interface for libmraa. A Spi object in libmraa represents a spidev device. Linux spidev devices are created per spi bus and every chip select available on that bus has another spidev 'file'. A lot more information on spidev devices is available here.
Go to the source code of this file.
Initialise SPI_context, uses board mapping. Sets the muxes
Initialise SPI_context without any board configuration, selects a bus and a mux.
Set the SPI device mode. see spidev 0-3.
Set the SPI device operating clock frequency.
Write Single Byte to the SPI device.
Write Two Bytes to the SPI device.
Write Buffer of bytes to the SPI device. The pointer return has to be free'd by the caller. It will return a NULL pointer in cases of error.
Write Buffer of uint16 to the SPI device. The pointer return has to be free'd by the caller. It will return a NULL pointer in cases of error.
Transfer Buffer of bytes to the SPI device. Both send and recv buffers are passed in
Transfer Buffer of uint16 to the SPI device. Both send and recv buffers are passed in
Change the SPI lsb mode
Set bits per mode on transaction, defaults at 8
De-inits an mraa_spi_context device
Opaque pointer definition to the internal struct _spi
MRAA SPI Modes
| Enumerator | |
|---|---|
| MRAA_SPI_MODE0 |
CPOL = 0, CPHA = 0, Clock idle low, data is clocked in on rising edge, output data (change) on falling edge |
| MRAA_SPI_MODE1 |
CPOL = 0, CPHA = 1, Clock idle low, data is clocked in on falling edge, output data (change) on rising edge |
| MRAA_SPI_MODE2 |
CPOL = 1, CPHA = 0, Clock idle low, data is clocked in on falling edge, output data (change) on rising edge |
| MRAA_SPI_MODE3 |
CPOL = 1, CPHA = 1, Clock idle low, data is clocked in on rising, edge output data (change) on falling edge |