OpenSourceSimWheelESP32
Open-source wireless steering wheel/button box for ESP32 boards
Loading...
Searching...
No Matches
DigitalInput Class Referenceabstract

Base class for all polled switches. More...

#include <InputHardware.hpp>

Public Member Functions

virtual uint64_t read (uint64_t lastState)=0
 Read the current state of the inputs (pressed or released)
 

Public Attributes

uint64_t mask = ~0ULL
 Input mask. For read-only.
 

Protected Member Functions

void addToMask (uint64_t bitmap)
 Add an input bitmap to the current mask.
 

Detailed Description

Base class for all polled switches.

Note
Instances of this base class are supposed to live forever.

Definition at line 31 of file InputHardware.hpp.

Constructor & Destructor Documentation

◆ ~DigitalInput()

virtual DigitalInput::~DigitalInput ( )
inlinevirtualnoexcept

Definition at line 41 of file InputHardware.hpp.

Member Function Documentation

◆ addToMask()

void DigitalInput::addToMask ( uint64_t bitmap)
inlineprotected

Add an input bitmap to the current mask.

Parameters
bitmapInput bitmap

Definition at line 64 of file InputHardware.hpp.

◆ read()

virtual uint64_t DigitalInput::read ( uint64_t lastState)
pure virtual

Read the current state of the inputs (pressed or released)

Warning
This function must not set any bit outside of the input bitmask in the return value.
Parameters
lastStateState of the same inputs as recorded in the previous iteration. Whether the current state is unknown, lastState must be returned (properly masked). Must be set to zero at first call.
Returns
uint64_t Current state of the inputs (a bit set to 1 means a pressed button).

Implemented in AnalogMultiplexerInput, ButtonMatrixInput, DigitalButton, FakeDigitalInput, MCP23017ButtonsInput, PCF8574ButtonsInput, RotaryCodedSwitchInput, RotaryEncoderInput, and ShiftRegistersInput.

Member Data Documentation

◆ mask

uint64_t DigitalInput::mask = ~0ULL

Input mask. For read-only.

Definition at line 38 of file InputHardware.hpp.


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