|
Doxygen with github
|
A component that implements reset button functionality. More...
#include <ksResetButton.h>
Inheritance diagram for ksf::comps::ksResetButton:Public Member Functions | |
| virtual std::size_t | getInstanceType () const |
| Retrieves type ID of the object. | |
| virtual bool | isA (const std::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. | |
| virtual | ~ksResetButton () |
| Destructs ksResetButton, restoring INPUT pin state. | |
| 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. | |
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 | |
| virtual | ~ksRtti ()=default |
| Destructor. | |
| 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 std::size_t | getClassType () |
Static Public Member Functions inherited from ksf::ksComponent | |
| static std::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 } |
| Holds current state of the component. | |
A component that implements reset button functionality.
On a short press, the component loop returns false, prompting ksAppRotator to switch to the next application. On a long press, it performs a factory reset by erasing user data.
The component also includes built-in debounce handling.
| 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). |
|
inlinevirtual |
|
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.