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

Class for coded rotary switches. More...

#include <InputHardware.hpp>

Public Member Functions

 RotaryCodedSwitchInput (const RotaryCodedSwitch &spec, const InputGPIOCollection &pins, bool complementaryCode)
 Construct a new Rotary Coded Switch Input object.
 
virtual uint64_t read (uint64_t lastState) override
 Read the current state of the inputs (pressed or released)
 
- Public Member Functions inherited from DigitalInput

Additional Inherited Members

- Public Attributes inherited from DigitalInput
uint64_t mask = ~0ULL
 Input mask. For read-only.
 
- Protected Member Functions inherited from DigitalInput
void addToMask (uint64_t bitmap)
 Add an input bitmap to the current mask.
 

Detailed Description

Class for coded rotary switches.

Definition at line 283 of file InputHardware.hpp.

Constructor & Destructor Documentation

◆ RotaryCodedSwitchInput()

RotaryCodedSwitchInput::RotaryCodedSwitchInput ( const RotaryCodedSwitch & spec,
const InputGPIOCollection & pins,
bool complementaryCode )

Construct a new Rotary Coded Switch Input object.

Parameters
specSpecification of input numbers assigned to switch positions
pinsCollection of input pins for the binary encoding
complementaryCodeIf true, the input pins work in complementary binary encoding

Member Function Documentation

◆ read()

virtual uint64_t RotaryCodedSwitchInput::read ( uint64_t lastState)
overridevirtual

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).

Implements DigitalInput.


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