|
| enum | Mode { MODE0 = SPI_MODE_0
, MODE1 = SPI_MODE_1
, MODE2 = SPI_MODE_2
, MODE3 = SPI_MODE_3
} |
◆ setup()
| int Spi::setup |
( |
const Settings & | settings | ) |
|
◆ transfer()
| int Spi::transfer |
( |
unsigned char * | send, |
|
|
unsigned char * | receive, |
|
|
size_t | numBytes ) |
Perform one SPI transaction.
@send: Points to the buffer containing the data to be sent @receive: Points to the buffer into which the received bytes will be stored @numBytes: length of buffers in bytes.
- Returns
- 0 on success, -1 on failure
◆ setMode()
| 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.
◆ setNumBits()
| 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.
◆ setSpeed()
| 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.
◆ cleanup()
The documentation for this class was generated from the following files:
- libraries/Spi/Spi.h
- libraries/Spi/Spi.cpp