19#include <piduino/board.h>
20#include <piduino/gpio.h>
79 virtual void write (
const Pin *pin,
bool v) = 0;
87 virtual bool read (
const Pin *pin)
const = 0;
125 virtual const std::map<Pin::Mode, std::string> &
modes()
const = 0;
Abstract base class for GPIO devices.
virtual ~GpioDevice()
Destructor.
virtual Pin::Pull pull(const Pin *pin) const
Gets the pull-up/pull-down configuration of a GPIO pin.
virtual void setMode(const Pin *pin, Pin::Mode m)=0
Sets the mode of a GPIO pin.
virtual bool isDebug() const
Checks if the GPIO device is in debug mode.
virtual void toggle(const Pin *pin)
Toggles the state of a GPIO pin.
virtual bool open()=0
Opens the GPIO device.
virtual const std::map< Pin::Mode, std::string > & modes() const =0
Gets the supported modes for the GPIO device.
virtual void setDebug(bool enable)
Sets the debug mode of the GPIO device.
virtual void setActiveLow(const Pin *pin, bool activeLow)
Sets the active low configuration for a GPIO pin.
virtual int drive(const Pin *pin) const
Gets the drive strength of a GPIO pin.
virtual uint32_t debounce(const Pin *pin) const
Gets the debounce period for the GPIO line.
virtual Pin::Mode mode(const Pin *pin) const =0
Gets the mode of a GPIO pin.
virtual void write(const Pin *pin, bool v)=0
Writes a boolean value to a GPIO pin.
virtual void close()=0
Closes the GPIO device.
virtual void setDrive(const Pin *pin, int d)
Sets the drive strength of a GPIO pin.
virtual bool isActiveLow(const Pin *pin) const
Checks if a GPIO pin is configured as active low.
@ useGpioMem
Use /dev/gpiomem for GPIO access.
virtual int waitForInterrupt(const Pin *pin, Pin::Edge edge, int timeout_ms)
Waits for an interrupt on a GPIO pin.
virtual bool isOpen() const
Checks if the GPIO device is open.
virtual unsigned int flags() const
Gets the capability flags of the GPIO device.
virtual void setDebounce(const Pin *pin, uint32_t debounce_ms)
Sets the debounce period for the GPIO line. The default implementation does nothing.
GpioDevice()
Public Constructor.
std::unique_ptr< Private > d_ptr
A unique pointer to the private implementation (PIMPL idiom).
virtual void setPull(const Pin *pin, Pin::Pull p)=0
Sets the pull-up/pull-down configuration of a GPIO pin.
virtual AccessLayer preferedAccessLayer() const =0
Gets the preferred access layer for the GPIO device.
virtual bool read(const Pin *pin) const =0
Reads the value of a GPIO pin.
GpioDevice(Private &dd)
Protected Constructor.
Represents a general-purpose input/output (GPIO) pin and its configuration.
Pull
Enumerates the possible pull resistor configurations.
Mode
Enumerates the possible modes for a pin.
Edge
Enumerates the possible edge detection types for interrupts.
Internal implementation class for GpioDevice.
#define PIMP_DECLARE_PRIVATE(Class)
PIMP_DECLARE_PRIVATE.
Global namespace for Piduino.
AccessLayer
Enumerates the possible hardware access layers for GPIO operations.