mraa
2.0.0
Low Level Skeleton Library for Communication on GNU/Linux platforms
|
This file defines the SPI interface for libmraa
Public Member Functions | |
Spi (int bus) | |
Spi (int bus, int cs) | |
Spi (void *spi_context) | |
~Spi () | |
Result | mode (Spi_Mode mode) |
Result | frequency (int hz) |
int | writeByte (uint8_t data) |
int | writeWord (uint16_t data) |
uint8_t * | write (uint8_t *txBuf, int length) |
uint16_t * | writeWord (uint16_t *txBuf, int length) |
Result | transfer (uint8_t *txBuf, uint8_t *rxBuf, int length) |
Result | transfer_word (uint16_t *txBuf, uint16_t *rxBuf, int length) |
Result | lsbmode (bool lsb) |
Result | bitPerWord (unsigned int bits) |
|
inline |
Initialise SPI object using the board mapping to set muxes
bus | to use, as listed in the platform definition, normally 0 |
|
inline |
Initialise SPI object using 'raw' mode. Mraa will go and grab the spidev device lablled /dev/spidev[bus].[cs]
bus | to use |
cs | to use |
|
inline |
Spi Constructor, takes a pointer to a SPI context and initialises the SPI class
spi_context | void * to SPI context |
|
inline |
Closes spi bus
Set the SPI device mode. see spidev0-3
mode | the mode. See Linux spidev doc |
|
inline |
Set the SPI device operating clock frequency
hz | the frequency to set in hz |
|
inline |
Write single byte to the SPI device
data | the byte to send |
|
inline |
Write single byte to the SPI device
data | the byte to send |
|
inline |
Write buffer of bytes to SPI device The pointer return has to be free'd by the caller. It will return a NULL pointer in cases of error
txBuf | buffer to send |
length | size of buffer to send |
|
inline |
Write buffer of bytes to SPI device The pointer return has to be free'd by the caller. It will return a NULL pointer in cases of error
txBuf | buffer to send |
length | size of buffer (in bytes) to send |
|
inline |
Transfer data to and from SPI device Receive pointer may be null if return data is not needed.
txBuf | buffer to send |
rxBuf | buffer to optionally receive data from spi device |
length | size of buffer to send |
|
inline |
Transfer data to and from SPI device Receive pointer may be null if return data is not needed.
txBuf | buffer to send |
rxBuf | buffer to optionally receive data from spi device |
length | size of buffer to send |
|
inline |
Change the SPI lsb mode
lsb | Use least significant bit transmission - 0 for msbi |
|
inline |
Set bits per mode on transaction, default is 8
bits | bits per word |