RSeries astromech firmware
ResistorLadderButtons< kButtonPin, buttonVal > Class Template Reference

#include <core/ResistorLadderButtons.h>

Detailed Description

template<byte kButtonPin, unsigned int... buttonVal>
class ResistorLadderButtons< kButtonPin, buttonVal >

Push buttons connected using a resistor ladder.

Reads a group of buttons through a single pin attached via a resistor ladder.

BoardButtons boardButtons;
+ Inheritance diagram for ResistorLadderButtons< kButtonPin, buttonVal >:
+ Collaboration diagram for ResistorLadderButtons< kButtonPin, buttonVal >:

Public Member Functions

virtual void setup () override
 Subclasses must implement this function to perform any necessary setup that cannot happen in the constructor. More...
 
virtual void buttonPressed (unsigned buttonNum, unsigned buttonTime)
 
virtual void animate () override
 Subclasses must implement this function to run through a single frame of animation/activity. More...
 
- Public Member Functions inherited from AnimatedEvent
 AnimatedEvent ()
 Default Constructor. More...
 
void setLoopDoneCallback (AnimatedLoopDone loopProc)
 
- Public Member Functions inherited from SetupEvent
 SetupEvent ()
 Default Constructor. More...
 

Protected Member Functions

unsigned getButtonValue (unsigned i)
 

Static Protected Member Functions

static bool inRange (int val, int minimum, int maximum)
 

Protected Attributes

unsigned fPrevButtonValue
 
bool fButtonState [kNumberOfButtons]
 
bool fPrevButtonState [kNumberOfButtons]
 
uint32_t fButtonTime [kNumberOfButtons+1]
 

Static Protected Attributes

static constexpr unsigned kButtonVariance = 200
 
static constexpr unsigned kNumberOfButtons = sizeof...(buttonVal)
 

Additional Inherited Members

- Static Public Member Functions inherited from AnimatedEvent
static void process ()
 Calls animate() for each created AnimatedEvent subclass. More...
 
- Static Public Member Functions inherited from SetupEvent
static void ready ()
 Calls setup() for each created AnimatedEvent subclass. More...
 

Member Function Documentation

◆ animate()

template<byte kButtonPin, unsigned int... buttonVal>
virtual void ResistorLadderButtons< kButtonPin, buttonVal >::animate ( )
inlineoverridevirtual

Subclasses must implement this function to run through a single frame of animation/activity.

Subclasses should not call delay() or otherwise block.

Implements AnimatedEvent.

◆ buttonPressed()

template<byte kButtonPin, unsigned int... buttonVal>
virtual void ResistorLadderButtons< kButtonPin, buttonVal >::buttonPressed ( unsigned  buttonNum,
unsigned  buttonTime 
)
inlinevirtual

◆ getButtonValue()

template<byte kButtonPin, unsigned int... buttonVal>
unsigned ResistorLadderButtons< kButtonPin, buttonVal >::getButtonValue ( unsigned  i)
inlineprotected

◆ inRange()

template<byte kButtonPin, unsigned int... buttonVal>
static bool ResistorLadderButtons< kButtonPin, buttonVal >::inRange ( int  val,
int  minimum,
int  maximum 
)
inlinestaticprotected

◆ setup()

template<byte kButtonPin, unsigned int... buttonVal>
virtual void ResistorLadderButtons< kButtonPin, buttonVal >::setup ( )
inlineoverridevirtual

Subclasses must implement this function to perform any necessary setup that cannot happen in the constructor.

Implements SetupEvent.

Member Data Documentation

◆ fButtonState

template<byte kButtonPin, unsigned int... buttonVal>
bool ResistorLadderButtons< kButtonPin, buttonVal >::fButtonState[kNumberOfButtons]
protected

◆ fButtonTime

template<byte kButtonPin, unsigned int... buttonVal>
uint32_t ResistorLadderButtons< kButtonPin, buttonVal >::fButtonTime[kNumberOfButtons+1]
protected

◆ fPrevButtonState

template<byte kButtonPin, unsigned int... buttonVal>
bool ResistorLadderButtons< kButtonPin, buttonVal >::fPrevButtonState[kNumberOfButtons]
protected

◆ fPrevButtonValue

template<byte kButtonPin, unsigned int... buttonVal>
unsigned ResistorLadderButtons< kButtonPin, buttonVal >::fPrevButtonValue
protected

◆ kButtonVariance

template<byte kButtonPin, unsigned int... buttonVal>
constexpr unsigned ResistorLadderButtons< kButtonPin, buttonVal >::kButtonVariance = 200
staticconstexprprotected

◆ kNumberOfButtons

template<byte kButtonPin, unsigned int... buttonVal>
constexpr unsigned ResistorLadderButtons< kButtonPin, buttonVal >::kNumberOfButtons = sizeof...(buttonVal)
staticconstexprprotected

The documentation for this class was generated from the following file:
ResistorLadderButtons
Push buttons connected using a resistor ladder.
Definition: ResistorLadderButtons.h:21