Doxygen with github
|
A component that implements reset button functionality. More...
#include <ksResetButton.h>
Public Member Functions | |
virtual const size_t | getInstanceType () const |
Retrieves type ID of the object. | |
virtual bool | isA (const size_t id) const |
Checks whether object is of given type. | |
ksResetButton (uint8_t pin, uint8_t triggerState, uint8_t mode) | |
Constructs the reset button component. | |
bool | init (ksApplication *app) override |
Initializes the reset button component. | |
bool | loop (ksApplication *app) override |
Handles the reset button component logic. | |
uint8_t | getPin () const |
Retrieves pin number assigned to the button. | |
virtual | ~ksResetButton () |
Destructs ksResetButton, restoring INPUT pin state. | |
Public Member Functions inherited from ksf::ksComponent | |
virtual bool | postInit (ksApplication *app) |
Method called after component initialization, used to setup references to other components. | |
Public Member Functions inherited from ksf::ksRtti | |
template<typename TType> | |
TType * | as () |
Tries to cast object to the type provided as a template parameter. | |
template<typename TType> | |
const TType * | as () const |
Tries to cast object to the type provided as a template parameter (const version). | |
Static Public Member Functions | |
static const size_t | getClassType () |
Static Public Member Functions inherited from ksf::ksComponent | |
static const size_t | getClassType () |
Protected Attributes | |
uint8_t | pin {0} |
Cached pin number. | |
uint8_t | triggerState {0} |
State that triggers reset logic. | |
uint8_t | lastState {0} |
Previous state (for debouncing). | |
uint8_t | mode {INPUT} |
Cached pin mode. | |
uint32_t | pressedTime {0} |
Press timestamp (milliseconds since boot). | |
uint32_t | releasedTime {0} |
Release timestamp (milliseconds since boot). | |
Protected Attributes inherited from ksf::ksComponent | |
ksComponentState::TYPE | componentState { ksComponentState::NotInitialized } |
A component that implements reset button functionality.
On short press, it will cause component loop to return false, then ksAppRotator will move to the next application. On long press, it will erase user data (factory reset).
The component has also built-in debounce handling logic.
ksf::comps::ksResetButton::ksResetButton | ( | uint8_t | pin, |
uint8_t | triggerState, | ||
uint8_t | mode ) |
Constructs the reset button component.
pin | Pin number assigned to the button. |
triggerState | Pin state that triggers the reset logic (LOW or HIGH). |
mode | Pin mode (INPUT / INPUT_PULLUP etc). |
References mode, pin, and triggerState.
Referenced by getInstanceType().
|
inlinevirtual |
Retrieves type ID of the object.
Reimplemented from ksf::ksComponent.
References ksResetButton().
|
inline |
Retrieves pin number assigned to the button.
References pin.
|
overridevirtual |
Initializes the reset button component.
app | Pointer to the parent ksApplication. |
Reimplemented from ksf::ksComponent.
|
inlinevirtual |
Checks whether object is of given type.
id | Type ID to check against. |
Reimplemented from ksf::ksComponent.
|
overridevirtual |
Handles the reset button component logic.
app | Pointer to the parent ksApplication. |
Reimplemented from ksf::ksComponent.
References lastState, pin, pressedTime, releasedTime, and triggerState.