+ // BEWARE: pins are at _zero_ when pressed!
+ if (!cur && prev) { // --- just pressed ---
+ button_start[button] = jiffies;
+ set_status_led(button, NULL);
+
+ } else if (!cur && !prev) { // --- is still pressed ---
+ uint16_t duration = jiffies - button_start[button];
+
+ if (duration > 80) {
+ set_status_led(button, on1_pattern);
+ // acknowledge long press
+ }
+ } else if (cur && !prev) { // --- just released ---
+ uint16_t duration = jiffies - button_start[button];
+
+ if (duration > 6 && duration < 30) {
+ short_press(button);
+ } else if (duration > 80) {
+ set_status_led(button, NULL);
+ long_press(button);
+ }
+ // ignore other button-press durations
+ }