|
RADLib
RADical C++ application framework
|
RADDevice covers common embedded Linux device control surfaces through file-descriptor and ioctl-friendly wrappers in the RADDevice namespace. Each class targets a standard Linux sysfs/devfs surface, and all of them accept a DevicePaths struct so real device roots can be swapped for test fixtures.
GpioPin drives sysfs GPIO export/unexport, direction (GpioDirection), edge mode (GpioEdge), and value read/write. I2CDevice opens /dev/i2c-* and selects a 7-bit address via the I2C_SLAVE ioctl for read()/write(). SPIDevice opens /dev/spidev*, applies mode/bits/speed with configure(), and runs full-duplex transfer() calls through SPI_IOC_MESSAGE. PwmChannel exports a sysfs PWM channel and sets period, duty cycle, and enable state. AdcChannel reads IIO raw, scale, and scaled samples. Watchdog opens /dev/watchdogN and issues keepAlive() pings, and Led reads and writes sysfs LED brightness. The free functions listLeds() and listIioDevices() enumerate available LED and IIO device names.
Read-style calls that can fail return RADCore::RADResult<T> (for example GpioPin::readValue(), AdcChannel::readRaw(), Led::brightness()), while setup calls take an optional std::string* error out-parameter.
GpioPin for sysfs GPIO export, direction, edge, and value.I2CDevice for /dev/i2c-* with I2C_SLAVE ioctl.SPIDevice for /dev/spidev* with SPI ioctl configuration and transfers.PwmChannel for sysfs PWM period, duty, and enable.AdcChannel for IIO raw, scale, and scaled samples.Watchdog for /dev/watchdog* keepalive ioctl.Led for sysfs LED brightness, plus listLeds()/listIioDevices().The public API is intentionally file-descriptor and ioctl friendly so future RADKernel drivers can expose the same application-facing model.
Example: