InputEvents v1.5.2
An easy to use but comprehensive Event Library for Buttons, Encoders, Encoder Buttons, Analog Inputs, Joysticks and Switches.
Public Member Functions | List of all members
ExpanderPinAdapter Class Reference

Description

Implementation of a PinAdapter that reads from a GpioExpanderAdapter.

#include <ExpanderPinAdapter.h>

Inheritance diagram for ExpanderPinAdapter:
Inheritance graph
[legend]

Public Member Functions

 ExpanderPinAdapter (byte pin, GpioExpanderAdapter *expander, int mode=INPUT_PULLUP)
 Construct a new ExpanderPinAdapter with a GpioExpanderAdapter and optional pin mode (default INPUT_PULLUP) More...
 
void begin () override
 Attach the pin to the GpioExpanderAdapter which will set the pinMode if required/possible. More...
 
bool read () override
 Return the state of this pin. If the GpioPinAdapter does not exist will return 'OFF' state (this should never happen!) More...
 
virtual void begin ()=0
 Initialise the pin adapter. Must be safe for repeated calls (Idempotent) More...
 
virtual bool read ()=0
 Read the current state of the pin. More...
 

Constructor & Destructor Documentation

◆ ExpanderPinAdapter()

ExpanderPinAdapter::ExpanderPinAdapter ( byte  pin,
GpioExpanderAdapter expander,
int  mode = INPUT_PULLUP 
)
inline

Construct a new ExpanderPinAdapter with a GpioExpanderAdapter and optional pin mode (default INPUT_PULLUP)

Parameters
pinThe pin number
expanderA reference to a GpioExpanderAdapter
modeThe pin mode. Not all GpioExpanderAdapters support setting pinMode but should be set to reflect the physical wiring on the pin.

Member Function Documentation

◆ begin()

void ExpanderPinAdapter::begin ( )
inlineoverridevirtual

Attach the pin to the GpioExpanderAdapter which will set the pinMode if required/possible.

Returns
* void

Implements PinAdapter.

◆ read()

bool ExpanderPinAdapter::read ( )
inlineoverridevirtual

Return the state of this pin. If the GpioPinAdapter does not exist will return 'OFF' state (this should never happen!)

Returns
true Actual pin state aka HIGH
false Actual pin state aka LOW

Implements PinAdapter.


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