|
Lamp-Da 0.1
A compact lantern project
|
Handle the button inputs and multiple click detection. More...
Classes | |
| struct | ButtonStateTy |
| Store the button status and characteristics. More... | |
Functions | |
| platform::gpio::DigitalPin::GPIO | get_button_pin () |
| Return the pin used for the button. | |
| int | get_button_pin_RAW () |
| get the button pin index in system. USE WITH CAUTION | |
| void | set_button_pin (const platform::gpio::DigitalPin::GPIO buttonPin) |
| Only on system start, set the pin where the button is wired. | |
| ButtonStateTy | get_button_state () |
| Get a copy of the raw internal button state. | |
| bool | is_button_pressed () |
| void | button_state_interrupt () |
| void | init (const bool isSystemStartedFromButton) |
| void | handle_events (const std::function< void(uint8_t)> &clickSerieCallback, const std::function< void(uint8_t, uint32_t)> &clickHoldSerieCallback) |
| handle the button clicked events | |
| bool | is_system_start_click () |
| Indicates that this click is the one triggered by the system start It is set to false after the click chain stops. | |
Variables | |
| platform::gpio::DigitalPin::GPIO | _buttonPin = platform::gpio::DigitalPin::GPIO::gpio3 |
| platform::gpio::DigitalPin | _buttonGpio (_buttonPin) |
| static ButtonStateTy | buttonState = ButtonStateTy() |
| static bool | isSystemStartClick = true |
| static volatile bool | wasButtonPressedDetected = false |
Handle the button inputs and multiple click detection.
| void lampda::physical::button::handle_events | ( | const std::function< void(uint8_t)> & | clickSerieCallback, |
| const std::function< void(uint8_t, uint32_t)> & | clickHoldSerieCallback | ||
| ) |
handle the button clicked events
| [in] | clickSerieCallback | A callback for a seri of clicks. Parameter is the number of consequtive clicks detected |
| [in] | clickHoldSerieCallback | A callback for a seri of clicks followed by a long hold. Parameter is the number of consequtive clicks detected and the time of the old event (in milliseconds). Called at until the button is released |