Button Driver for XRCU.
More...
#include <Buttons.h>
|
| | Button (const uint32_t pin) |
| | Creates a new button at a certain pin.
|
| |
|
| ~Button () |
| | Destroys this button and release the resources it occupied.
|
| |
| void | begin () |
| | Activates this button.
|
| |
| void | end () |
| | Deactivates this button.
|
| |
| bool | isClicked () |
| | Checks whether this button is clicked.
|
| |
| void | setSingleClickTransitionEdge (TransitionEdge edge) |
| | Sets the edge of voltage level transition where a button should be deemed single clicked.
|
| |
| void | setPulseClickEnabled (const bool enabled) |
| | Sets whether pulse click is enabled.
|
| |
| void | setPulseDelayStartPeriod (const unsigned long period) |
| | Sets the time delay between the button being "pressed and held" and the pulse click starts.
|
| |
| void | setPulseClicksMinimumInterval (const unsigned long minInterval) |
| | Sets the minimum time separation between 2 consecutive pulse clicks.
|
| |
| void | setSecureModeEnabled (const bool enabled) |
| | Sets whether secure mode is enabled.
|
| |
| void | attachInterrupt (void(*callback)(void)) |
| | Attaches an interrupt function to the button whenever its status is possibly changed.
|
| |
| void | detachInterrupt () |
| | Detaches the interrupt function from this button as set in attachInterrupt(...).
|
| |
|
| static void | scheduledAllButtonsCallback () |
| | The interrupt service routine to be run by JM9 XRCU System Callback at fixed intervals only.
|
| |
Button Driver for XRCU.
- Author
- YH Choi @ JM9
◆ TransitionEdge
The edge of voltage level transition where a button should be deemed single clicked.
| Enumerator |
|---|
| PRESSING | The button is deemed single clicked when the button is pressed.
|
| RELEASING | The button is deemed single clicked when the button is released after pressed.
|
◆ Button()
| Button::Button |
( |
const uint32_t | pin | ) |
|
Creates a new button at a certain pin.
- Parameters
-
| pin | The pin connected to this button. |
◆ attachInterrupt()
| void Button::attachInterrupt |
( |
void(* | callback )(void) | ) |
|
Attaches an interrupt function to the button whenever its status is possibly changed.
Note that only 1 interrupt function could be attached to each button at a time. Attaching a new interrupt function will discard the older one.
- Parameters
-
| callback | The function that is run when the button status is possibly changed. |
- See also
- detachInterrupt(...)
◆ begin()
Activates this button.
No need to call this function if the button is one of the buttons soldered on XRCU PCB.
◆ detachInterrupt()
| void Button::detachInterrupt |
( |
| ) |
|
Detaches the interrupt function from this button as set in attachInterrupt(...).
- See also
- attachInterrupt(...)
◆ end()
Deactivates this button.
Only call this function on buttons that are externally connected to XRCU PCB.
◆ isClicked()
| bool Button::isClicked |
( |
| ) |
|
Checks whether this button is clicked.
- Returns
- true if this button is deemed clicked under the current mode, false otherwise.
◆ scheduledAllButtonsCallback()
| void Button::scheduledAllButtonsCallback |
( |
| ) |
|
|
static |
The interrupt service routine to be run by JM9 XRCU System Callback at fixed intervals only.
Do not call this function in your application.
◆ setPulseClickEnabled()
| void Button::setPulseClickEnabled |
( |
const bool | enabled | ) |
|
Sets whether pulse click is enabled.
If pulse click is enabled, holding the button pressed will give continuous clicks.
- Parameters
-
| enabled | true to enable pulse click, false to disable pulse click. |
- Warning
- The behaviour is undefined if the button is pressed or released during this function call.
◆ setPulseClicksMinimumInterval()
| void Button::setPulseClicksMinimumInterval |
( |
const unsigned long | minInterval | ) |
|
Sets the minimum time separation between 2 consecutive pulse clicks.
Set this to 0 to disable this feature.
- Parameters
-
| minInterval | The minimum time separation between 2 consecutive pulse clicks (in milliseconds). |
- Warning
- The behaviour is undefined if the button is pressed or released during this function call.
◆ setPulseDelayStartPeriod()
| void Button::setPulseDelayStartPeriod |
( |
const unsigned long | period | ) |
|
Sets the time delay between the button being "pressed and held" and the pulse click starts.
- Parameters
-
| period | The time delay between the button being "pressed and held" and the pulse click starts (in milliseconds). |
- Warning
- The behaviour is undefined if the button is pressed or released during this function call.
◆ setSecureModeEnabled()
| void Button::setSecureModeEnabled |
( |
const bool | enabled | ) |
|
Sets whether secure mode is enabled.
Secure mode prevents user accidental misclicking other buttons by treating all buttons as not clicked when 2 or more buttons are pressed at the same time.
- Parameters
-
| enabled | true to enable secure mode, false to disable secure mode. |
- Warning
- The behaviour is undefined if any button is pressed or released during this function call.
◆ setSingleClickTransitionEdge()
Sets the edge of voltage level transition where a button should be deemed single clicked.
- Parameters
-
| edge | The edge of voltage level transition where a button should be deemed single clicked. |
- Warning
- The behaviour is undefined if the button is pressed or released during this function call.
The documentation for this class was generated from the following files:
- Buttons/src/Buttons.h
- Buttons/src/Buttons.cpp