mraa
0.6.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 () | |
mraa_result_t | mode (Spi_Mode mode) |
mraa_result_t | frequency (int hz) |
uint8_t | writeByte (uint8_t data) |
uint8_t * | write (uint8_t *txBuf, int length) |
mraa_result_t | transfer (uint8_t *txBuf, uint8_t *rxBuf, int length) |
mraa_result_t | lsbmode (bool lsb) |
mraa_result_t | 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 |
Closes spi bus
|
inline |
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 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
@param txBuf buffer to send @param length size of buffer to send @return uint8_t* data received on the miso line. Same length as passed in
|
inline |
Transfer data to and from SPI device Receive pointer may be null if return data is not needed.
data | 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 |