RADLib
RADical C++ application framework
RADDevice::SPIDevice Class Reference

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...
 

Detailed Description

SPI device wrapper using /dev/spidev* and SPI_IOC_MESSAGE.

Constructor & Destructor Documentation

◆ SPIDevice()

RADDevice::SPIDevice::SPIDevice ( )

Creates a closed SPI device wrapper.

◆ ~SPIDevice()

RADDevice::SPIDevice::~SPIDevice ( )

Closes the device.

Member Function Documentation

◆ close()

void RADDevice::SPIDevice::close ( )

Closes the descriptor.

◆ configure()

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.

◆ fd()

int RADDevice::SPIDevice::fd ( ) const

Returns owned file descriptor.

◆ isOpen()

bool RADDevice::SPIDevice::isOpen ( ) const

Returns true when open.

◆ open()

bool RADDevice::SPIDevice::open ( int  bus,
int  chipSelect,
const DevicePaths paths = {},
std::string *  error = nullptr 
)

Opens a SPI bus/chip-select device.

◆ transfer()

std::vector<uint8_t> RADDevice::SPIDevice::transfer ( const std::vector< uint8_t > &  tx,
std::string *  error = nullptr 
)

Full-duplex transfer.


The documentation for this class was generated from the following file: