C++ wrapper of Linux's SPI userspace driver
- Easy to use
- Customizable chip selector, so you're not limited to the number of CS lines
- Built-in access lock, enables multiple process accessing one SPI controller
using namespace YukiWorkshop;
Standard usage:
SPPI s("/dev/spidev0.1");
uint8_t tx[16];
uint8_t rx[16];
s.transfer(tx, rx);
uint8_t data = s.transfer(0x00);
Custom chip selector:
// The number after "." is irrelevant, just ensure it begins with spidev0 in this case
// This MAY conflict with SPI devices that are used by kernel
SPPI s("/dev/spidev0.1", [&](bool cs_enable){
if (cs_enable) {
// Custom logic to select chip
} else {
// Custom logic to deselect chip
}
});
For more usages, read the code.
MIT