InputEvents v1.4.0
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
PinMixerAdapter Class Reference

Description

This is the default PinAdapter for regular GPIO pins.

#include <PinMixerAdapter.h>

Inheritance diagram for PinMixerAdapter:
Inheritance graph
[legend]

Public Member Functions

 PinMixerAdapter (PinAdapter *pin1, PinAdapter *pin2)
 Takes two PinAdapter classes and mixes their read() calls. Initial state is taken from pin1. More...
 
void begin ()
 Initialise the pin adapter. Must be safe for repeated calls (Idempotent) More...
 
bool read ()
 Read the current state of the pin. 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

◆ PinMixerAdapter()

PinMixerAdapter::PinMixerAdapter ( PinAdapter pin1,
PinAdapter pin2 
)
inline

Takes two PinAdapter classes and mixes their read() calls. Initial state is taken from pin1.

The mixed read() state will only change when either PinAdapter changes its read() state. ie if pin1 state changes from HIGH to LOW the read() state will change to LOW, even if pin2 state is currently HIGH. The read() state will remain LOW until either pin changes state again (eg pin1 changes to HIGH or pin2 state changes from HIGH->LOW->HIGH

Parameters
pin1A reference to a PinAdapter
pin2A reference to a PinAdapter

Member Function Documentation

◆ begin()

void PinMixerAdapter::begin ( )
inlinevirtual

Initialise the pin adapter. Must be safe for repeated calls (Idempotent)

Implements PinAdapter.

◆ read()

bool PinMixerAdapter::read ( )
inlinevirtual

Read the current state of the pin.

Returns
true/HIGH
false/LOW

Implements PinAdapter.


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