|
RADLib
RADical C++ application framework
|
SPI device wrapper using /dev/spidev* and SPI_IOC_MESSAGE. More...
#include <RADDevice.h>
Public Member Functions | |
| SPIDevice () | |
| Creates a closed SPI device wrapper. More... | |
| ~SPIDevice () | |
| Closes the device. More... | |
| bool | open (int bus, int chipSelect, const DevicePaths &paths={}, std::string *error=nullptr) |
| Opens a SPI bus/chip-select device. More... | |
| void | close () |
| Closes the descriptor. More... | |
| bool | configure (uint8_t mode, uint8_t bitsPerWord, uint32_t speedHz, std::string *error=nullptr) |
| Configures mode, bits, and max speed through ioctl. More... | |
| std::vector< uint8_t > | transfer (const std::vector< uint8_t > &tx, std::string *error=nullptr) |
| Full-duplex transfer. More... | |
| bool | isOpen () const |
| Returns true when open. More... | |
| int | fd () const |
| Returns owned file descriptor. More... | |
SPI device wrapper using /dev/spidev* and SPI_IOC_MESSAGE.
| RADDevice::SPIDevice::SPIDevice | ( | ) |
Creates a closed SPI device wrapper.
| RADDevice::SPIDevice::~SPIDevice | ( | ) |
Closes the device.
| void RADDevice::SPIDevice::close | ( | ) |
Closes the descriptor.
| bool RADDevice::SPIDevice::configure | ( | uint8_t | mode, |
| uint8_t | bitsPerWord, | ||
| uint32_t | speedHz, | ||
| std::string * | error = nullptr |
||
| ) |
Configures mode, bits, and max speed through ioctl.
| int RADDevice::SPIDevice::fd | ( | ) | const |
Returns owned file descriptor.
| bool RADDevice::SPIDevice::isOpen | ( | ) | const |
Returns true when open.
| bool RADDevice::SPIDevice::open | ( | int | bus, |
| int | chipSelect, | ||
| const DevicePaths & | paths = {}, |
||
| std::string * | error = nullptr |
||
| ) |
Opens a SPI bus/chip-select device.
| std::vector<uint8_t> RADDevice::SPIDevice::transfer | ( | const std::vector< uint8_t > & | tx, |
| std::string * | error = nullptr |
||
| ) |
Full-duplex transfer.