Treehopper C++ API
|
Represents a peripheral on the SPI bus. More...
#include <SpiDevice.h>
Public Member Functions | |
SpiDevice (Spi &spiModule, SpiChipSelectPin *chipSelect, ChipSelectMode chipSelectMode=ChipSelectMode::SpiActiveLow, double speedMhz=1, SpiMode mode=SpiMode::Mode00) | |
Construct an SPI device attached to a particular module More... | |
std::vector< uint8_t > | sendReceive (std::vector< uint8_t > dataToSend, SpiBurstMode burst) |
Starts an SPI send/receive transaction. More... | |
This class is essentially used to "save your settings" (chip select, clock rate, SPI mode, etc) when it comes to multi-peripheral projects. It was more useful before all these settings ended up as params in Spi.sendReceive, but it's still nice to use this as a container; SPI peripheral drivers can pass values directly from the constructor to this class's constructor, and never worry about that stuff again.
|
inline |
spiModule | The module this device is attached to |
chipSelect | The chip select pin used by this device |
chipSelectMode | The ChipSelectMode to use with this device |
speedMhz | The speed to operate this device at |
mode | The SpiMode of this device |
|
inline |
[in] | dataToSend | The transmit buffer where the data is |
[in] | burst | The SPI burst mode to use when performing this transaction |