|
enum | Mode { MODE0 = SPI_MODE_0,
MODE1 = SPI_MODE_1,
MODE2 = SPI_MODE_2,
MODE3 = SPI_MODE_3
} |
|
int Spi::setup |
( |
const Settings & |
settings | ) |
|
int Spi::transfer |
( |
unsigned char * |
send, |
|
|
unsigned char * |
receive, |
|
|
size_t |
numBytes |
|
) |
| |
Perform one SPI transaction.
: Points to the buffer containing the data to be sent : Points to the buffer into which the received bytes will be stored : length of buffers in bytes.
- Returns
- 0 on success, -1 on failure
- Examples:
- Communication/Spi/render.cpp.
int Spi::setMode |
( |
unsigned char |
mode | ) |
|
Set the device mode.
- Parameters
-
mode | a set of flags that will be passed to ioctl(... SPI_IOC_xx_MODE ...) |
- Returns
- 0 upon success or an error code otherwise.
int Spi::setNumBits |
( |
unsigned char |
numBits | ) |
|
Set the number of bits per word.
- Parameters
-
numBits | the number of bits. Valid values are 8, 16, 24, 32 |
- Returns
- 0 upon success or an error code otherwise.
int Spi::setSpeed |
( |
unsigned long |
speed | ) |
|
Set the clock frequency of the SPI bus.
- Parameters
-
speed | the clock frequency. |
- Returns
- 0 upon success or an error code otherwise.
The documentation for this class was generated from the following files:
- libraries/Spi/Spi.h
- libraries/Spi/Spi.cpp