diff options
author | ConfuSomu | 2021-04-28 13:16:12 -0400 |
---|---|---|
committer | ConfuSomu | 2021-04-28 13:16:12 -0400 |
commit | 4f68147aee228631e78356c2f3e75f277023bf48 (patch) | |
tree | 33ef3ad6a1acd6853b611305e7b8d7747a6642e2 /buttons.cpp | |
parent | 377abedb66676f0102a5a939ff8e91ade75510e4 (diff) | |
download | pico-watch-4f68147aee228631e78356c2f3e75f277023bf48.tar pico-watch-4f68147aee228631e78356c2f3e75f277023bf48.tar.gz pico-watch-4f68147aee228631e78356c2f3e75f277023bf48.zip |
Add delta to app_btnpress arguments
This allows add to implement double clicking, for instance.
Diffstat (limited to 'buttons.cpp')
-rw-r--r-- | buttons.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/buttons.cpp b/buttons.cpp index ad1f1dd..7aa82e8 100644 --- a/buttons.cpp +++ b/buttons.cpp @@ -4,20 +4,22 @@ #include "buttons.hpp" #include "api.hpp" // From pico-watch.c: -extern int app_btnpressed(int app_id, uint gpio); +extern int app_btnpressed(int app_id, uint gpio, unsigned long delta); extern void app_switch_request(int); extern Api app_api; //const uint BUTTON_PINS[] = {BUTTON_HOME, BUTTON_SELECT, BUTTON_MODE, BUTTON_UP, BUTTON_DOWN}; void gpio_interrupt_cb(uint gpio, uint32_t events) { - if (button_time_since_press() > g_s.button_delay_time) { + auto delta_since_press = time_since_button_press(); + + if (delta_since_press > g_s.button_delay_time) { if (app_api.m_interpret_button_press) { if (gpio == BUTTON_HOME && (g_s.current_app != 0)) // Home app app_switch_request(0); else - app_btnpressed(g_s.current_app, gpio); + app_btnpressed(g_s.current_app, gpio, delta_since_press); } app_api.button_last_set(gpio); |