|
| Adafruit_SPIDevice (int8_t cspin, uint32_t freq=1000000, BusIOBitOrder dataOrder=SPI_BITORDER_MSBFIRST, uint8_t dataMode=SPI_MODE0, SPIClass *theSPI=&SPI) |
| Create an SPI device with the given CS pin and settins.
|
|
| Adafruit_SPIDevice (int8_t cspin, int8_t sck, int8_t miso, int8_t mosi, uint32_t freq=1000000, BusIOBitOrder dataOrder=SPI_BITORDER_MSBFIRST, uint8_t dataMode=SPI_MODE0) |
| Create an SPI device with the given CS pin and settins.
|
|
| ~Adafruit_SPIDevice () |
| Release memory allocated in constructors.
|
|
bool | begin (void) |
| Initializes SPI bus and sets CS pin high.
|
|
bool | read (uint8_t *buffer, size_t len, uint8_t sendvalue=0xFF) |
|
bool | write (uint8_t *buffer, size_t len, uint8_t *prefix_buffer=NULL, size_t prefix_len=0) |
|
bool | write_then_read (uint8_t *write_buffer, size_t write_len, uint8_t *read_buffer, size_t read_len, uint8_t sendvalue=0xFF) |
|
uint8_t | transfer (uint8_t send) |
|
void | transfer (uint8_t *buffer, size_t len) |
| Transfer (send/receive) one byte over hard/soft SPI.
|
|
void | beginTransaction (void) |
|
void | endTransaction (void) |
|
! The class which defines how we will talk to this device over SPI
void Adafruit_SPIDevice::transfer |
( |
uint8_t * | buffer, |
|
|
size_t | len ) |
Transfer (send/receive) one byte over hard/soft SPI.
- Parameters
-
buffer | The buffer to send and receive at the same time |
len | The number of bytes to transfer |
Transfer (send/receive) one byte over hard/soft SPI
- Parameters
-
- Returns
- The byte received while transmitting
Manually begin a transaction (calls beginTransaction if hardware SPI)
Manually end a transaction (calls endTransaction if hardware SPI)
Write a buffer or two to the SPI device.
- Parameters
-
buffer | Pointer to buffer of data to write |
len | Number of bytes from buffer to write |
prefix_buffer | Pointer to optional array of data to write before buffer. |
prefix_len | Number of bytes from prefix buffer to write |
- Returns
- Always returns true because there's no way to test success of SPI writes
Read from SPI into a buffer from the SPI device.
- Parameters
-
buffer | Pointer to buffer of data to read into |
len | Number of bytes from buffer to read. |
sendvalue | The 8-bits of data to write when doing the data read, defaults to 0xFF |
- Returns
- Always returns true because there's no way to test success of SPI writes
Write some data, then read some data from SPI into another buffer. The buffers can point to same/overlapping locations. This does not transmit-receive at the same time!
- Parameters
-
write_buffer | Pointer to buffer of data to write from |
write_len | Number of bytes from buffer to write. |
read_buffer | Pointer to buffer of data to read into. |
read_len | Number of bytes from buffer to read. |
sendvalue | The 8-bits of data to write when doing the data read, defaults to 0xFF |
- Returns
- Always returns true because there's no way to test success of SPI writes