From daf220600e8a719a92718140ec12d73ecf0c9b30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Fri, 3 Jan 2020 19:33:25 +0100 Subject: [PATCH] document notif api, adjust knob debouncing --- main/gui.c | 10 ++++++++++ main/knob.c | 10 +++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/main/gui.c b/main/gui.c index c0f0d58..f5fb85b 100644 --- a/main/gui.c +++ b/main/gui.c @@ -21,6 +21,16 @@ void gui_init() { assert (rv == pdPASS); } +/** + * Notification API: + * + * 0b1 - knob CW + * 0b10 - knowb CCW + * 0b100 - button released + * 0b1000 - button pressed + * + * @param arg + */ static void __attribute__((noreturn)) gui_thread(void *arg) { uint32_t pos = 20; bool btn = 0; diff --git a/main/knob.c b/main/knob.c index 18fe32e..74d85b3 100644 --- a/main/knob.c +++ b/main/knob.c @@ -8,8 +8,8 @@ const int pushPin = 5; const int wheelPin1 = 18; const int wheelPin2 = 23; -#define DEBOUNCE_WHEEL_MS 3 -#define DEBOUNCE_BTN_MS 10 +#define DEBOUNCE_WHEEL_MS 2 +#define DEBOUNCE_BTN_MS 5 static void debounce_service(void *arg); static TaskHandle_t hDebouncer; @@ -36,9 +36,9 @@ static void __attribute__((noreturn)) debounce_service(void *arg) { }; struct debo state[3] = { - {.debo_time = pdMS_TO_TICKS(DEBOUNCE_BTN_MS)}, // push - {.debo_time = pdMS_TO_TICKS(DEBOUNCE_WHEEL_MS)}, // wheel input 1 - {.debo_time = pdMS_TO_TICKS(DEBOUNCE_WHEEL_MS)} // wheel input 2 + {.debo_time = pdMS_TO_TICKS(DEBOUNCE_BTN_MS)}, // push + {.debo_time = pdMS_TO_TICKS(DEBOUNCE_WHEEL_MS), .state=1}, // wheel input 1 + {.debo_time = pdMS_TO_TICKS(DEBOUNCE_WHEEL_MS), .state=1} // wheel input 2 }; while (1) {