pref: 优化长短按判断

This commit is contained in:
2024-01-06 16:47:15 +08:00
parent 8f0a04b962
commit abca5d603c
3 changed files with 17 additions and 23 deletions

View File

@@ -4,12 +4,15 @@
#include "stdio.h"
#include "ch32v30x.h"
typedef enum rotate_button_event{
#define LONG_PRESS_THRESHOLD_MS (300ULL)
#define LONG_PRESS_THRESHOLD_TICK (LONG_PRESS_THRESHOLD_MS * 18000ULL)
typedef enum rotate_button_event {
rotate_button_press_short = 1,
rotate_button_press_long = 2,
rotate_button_forward = 3,
rotate_button_backward = 4,
}rotate_button_event;
rotate_button_press_long = 2,
rotate_button_forward = 3,
rotate_button_backward = 4,
} rotate_button_event;
extern uint8_t rotate_button;