18#define DIGITAL_IN_DEFAULT_DEBOUNCE_MS 50
19#define MAX_NUM_BUTTONS 20
22#define BUTTON_MODE_STANDARD 0
23#define BUTTON_MODE_TOGGLE 1
24#define BUTTON_NON_INVERTED 0
25#define BUTTON_INVERTED 1
27#define BUTTON_STATE_RELEASED 0
28#define BUTTON_STATE_PRESSED 1
29#define BUTTON_CHANGED 1
34class ButtonKilohertzPlugin :
public Plugin{
36 ButtonKilohertzPlugin();
125 static Button* registered_buttons[MAX_NUM_BUTTONS];
126 static uint8_t num_registered_buttons;
127 static ButtonKilohertzPlugin kilohertz_plugin;
128 void begin(uint8_t pin, uint8_t mode);
130 void enroll(
RPC *rpc,
const String& instance_name);
135 uint8_t invert = BUTTON_NON_INVERTED;
136 uint16_t debounce_period_ms = DIGITAL_IN_DEFAULT_DEBOUNCE_MS;
137 uint8_t button_mode = BUTTON_MODE_STANDARD;
138 volatile uint16_t debounce_blackout_remaining_ms = 0;
139 volatile uint8_t button_state = 0;
140 volatile uint8_t change_flag = 0;
141 volatile uint8_t last_raw_pin_state = 0;
142 void (*callback_on_toggle)() =
nullptr;
143 void (*callback_on_press)() =
nullptr;
144 void (*callback_on_release)() =
nullptr;
RPC class for handling remote procedure calls over serial streams.
Definition rpc.hpp:35