roo_control
API Documentation for roo_control
Loading...
Searching...
No Matches
roo_control::PushButton Class Reference

Represents a human-pressable momentary button. More...

#include <push_button.h>

Inheritance diagram for roo_control::PushButton:
[legend]
Collaboration diagram for roo_control::PushButton:
[legend]

Public Member Functions

 PushButton (BinarySelector &selector, BinaryLogicalState idle_state=BINARY_STATE_HIGH)
 
bool getState (BinaryLogicalState &result) const override
 Retrieves the current state, or returns false when it cannot be read.
 
void tick ()
 Needs to be called periodically (every 5-10 ms).
 
- Public Member Functions inherited from roo_control::Selector< BinaryLogicalState >
virtual ~Selector ()=default
 

Protected Member Functions

virtual void onDown ()
 Hooks called from tick().
 
virtual void onUp ()
 
virtual void onClick ()
 
virtual void onLongPress ()
 
virtual void onDoubleClick ()
 

Detailed Description

Represents a human-pressable momentary button.

This class implements debouncing and provides a simple form of gesture detection.

Definition at line 12 of file push_button.h.

Constructor & Destructor Documentation

◆ PushButton()

roo_control::PushButton::PushButton ( BinarySelector selector,
BinaryLogicalState  idle_state = BINARY_STATE_HIGH 
)

Definition at line 13 of file push_button.cpp.

Member Function Documentation

◆ getState()

bool roo_control::PushButton::getState ( BinaryLogicalState result) const
inlineoverridevirtual

Retrieves the current state, or returns false when it cannot be read.

Implements roo_control::Selector< BinaryLogicalState >.

Definition at line 17 of file push_button.h.

◆ onClick()

virtual void roo_control::PushButton::onClick ( )
inlineprotectedvirtual

Definition at line 34 of file push_button.h.

Referenced by tick().

◆ onDoubleClick()

virtual void roo_control::PushButton::onDoubleClick ( )
inlineprotectedvirtual

Definition at line 36 of file push_button.h.

Referenced by tick().

◆ onDown()

virtual void roo_control::PushButton::onDown ( )
inlineprotectedvirtual

Hooks called from tick().

If you call tick() from a time-sensitive context, you may want to hand off the events to a queue in the implementation of these methods.

Definition at line 32 of file push_button.h.

Referenced by tick().

◆ onLongPress()

virtual void roo_control::PushButton::onLongPress ( )
inlineprotectedvirtual

Definition at line 35 of file push_button.h.

Referenced by tick().

◆ onUp()

virtual void roo_control::PushButton::onUp ( )
inlineprotectedvirtual

Definition at line 33 of file push_button.h.

Referenced by tick().

◆ tick()

void roo_control::PushButton::tick ( )

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