libepaper 2.0.0
A C++23 library for controlling Waveshare e-paper displays on Raspberry Pi, featuring transparent sleep/wake management and a fluent builder API.
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
epaper::Device Class Reference

#include <device.hpp>

Classes

struct  Delay
 
class  HalInput
 
class  HalOutput
 
class  HalSpi
 

Public Member Functions

 Device ()
 Construct a Device with default configuration.
 
 Device (DeviceConfig config)
 Construct a Device with custom configuration.
 
 ~Device () noexcept
 Destructor. Cleans up GPIO and SPI resources.
 
 Device (const Device &)=delete
 
auto operator= (const Device &) -> Device &=delete
 
 Device (Device &&other) noexcept
 Move constructor.
 
auto operator= (Device &&other) noexcept -> Device &
 Move assignment operator.
 
auto init () -> std::expected< void, Error >
 Initialize the GPIO (libgpiod) and SPI (SPIdev) interfaces.
 
auto is_initialized () const noexcept -> bool
 
auto set_pin_output (Pin pin) -> void
 
auto set_pin_input (Pin pin) -> void
 
auto write_pin (Pin pin, bool value) -> void
 
auto read_pin (Pin pin) -> bool
 
auto spi_transfer (std::uint8_t value) const -> std::uint8_t
 
auto spi_write (std::span< const std::byte > data) const -> void
 
auto get_output (Pin pin) -> HalOutput
 
auto get_input (Pin pin) -> HalInput
 
auto get_spi () -> HalSpi
 

Static Public Member Functions

static auto delay_ms (std::uint32_t milliseconds) -> void
 
static auto delay_us (std::uint32_t microseconds) -> void
 

Constructor & Destructor Documentation

◆ Device() [1/4]

epaper::Device::Device ( )

Construct a Device with default configuration.

Uses default DeviceConfig values:

  • GPIO chip: "/dev/gpiochip0"
  • SPI device: "/dev/spidev0.0"
  • SPI speed: 1953125 Hz (~1.95MHz)
Examples
/mnt/nas/libepaper/include/epaper/core/device.hpp.

◆ Device() [2/4]

epaper::Device::Device ( DeviceConfig  config)
explicit

Construct a Device with custom configuration.

Parameters
configDevice configuration specifying paths and settings

◆ ~Device()

epaper::Device::~Device ( )
noexcept

Destructor. Cleans up GPIO and SPI resources.

Note
Exception Safety: Nothrow guarantee - never throws exceptions.
Examples
/mnt/nas/libepaper/include/epaper/core/device.hpp.

◆ Device() [3/4]

epaper::Device::Device ( const Device )
delete

◆ Device() [4/4]

epaper::Device::Device ( Device &&  other)
noexcept

Move constructor.

Parameters
otherDevice to move from
Note
Exception Safety: Nothrow guarantee.

Member Function Documentation

◆ delay_ms()

auto epaper::Device::delay_ms ( std::uint32_t  milliseconds) -> void
static
Examples
/mnt/nas/libepaper/include/epaper/core/device.hpp.
Here is the caller graph for this function:

◆ delay_us()

auto epaper::Device::delay_us ( std::uint32_t  microseconds) -> void
static

◆ get_input()

auto epaper::Device::get_input ( Pin  pin) -> HalInput
inline
Examples
/mnt/nas/libepaper/include/epaper/core/device.hpp.
Here is the call graph for this function:

◆ get_output()

auto epaper::Device::get_output ( Pin  pin) -> HalOutput
inline
Examples
/mnt/nas/libepaper/include/epaper/core/device.hpp.
Here is the call graph for this function:

◆ get_spi()

auto epaper::Device::get_spi ( ) -> HalSpi
inline

◆ init()

auto epaper::Device::init ( ) -> std::expected<void, Error>

Initialize the GPIO (libgpiod) and SPI (SPIdev) interfaces.

This must be called before any other operations on the device. Idempotent - calling init() on an already initialized device succeeds.

Returns
void on success, Error on failure
Note
Exception Safety: Strong guarantee - if initialization fails, the device remains in an uninitialized state.
Examples
/mnt/nas/libepaper/include/epaper/core/device.hpp.

◆ is_initialized()

auto epaper::Device::is_initialized ( ) const -> bool
noexcept

◆ operator=() [1/2]

auto epaper::Device::operator= ( const Device ) -> Device &=delete
delete

◆ operator=() [2/2]

auto epaper::Device::operator= ( Device &&  other) -> Device &
noexcept

Move assignment operator.

Parameters
otherDevice to move from
Returns
Reference to this device
Note
Exception Safety: Nothrow guarantee.

◆ read_pin()

auto epaper::Device::read_pin ( Pin  pin) -> bool
Examples
/mnt/nas/libepaper/include/epaper/core/device.hpp.
Here is the caller graph for this function:

◆ set_pin_input()

auto epaper::Device::set_pin_input ( Pin  pin) -> void
Examples
/mnt/nas/libepaper/include/epaper/core/device.hpp.
Here is the caller graph for this function:

◆ set_pin_output()

auto epaper::Device::set_pin_output ( Pin  pin) -> void
Examples
/mnt/nas/libepaper/include/epaper/core/device.hpp.
Here is the caller graph for this function:

◆ spi_transfer()

auto epaper::Device::spi_transfer ( std::uint8_t  value) const -> std::uint8_t
Examples
/mnt/nas/libepaper/include/epaper/core/device.hpp.
Here is the caller graph for this function:

◆ spi_write()

auto epaper::Device::spi_write ( std::span< const std::byte >  data) const -> void
Examples
/mnt/nas/libepaper/include/epaper/core/device.hpp.
Here is the caller graph for this function:

◆ write_pin()

auto epaper::Device::write_pin ( Pin  pin,
bool  value 
) -> void
Examples
/mnt/nas/libepaper/include/epaper/core/device.hpp.
Here is the caller graph for this function:

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