1 /*
2  * Copyright (C) 2015-2020 Alibaba Group Holding Limited
3  */
4 
5 #ifndef K_KEY_H
6 #define K_KEY_H
7 
8 #include "stdint.h"
9 
10 #define KEY_MIN_PRESS_MS   50
11 #define KEY_SHORT_PRESS_MS 2000
12 #define KEY_LONG_PRESS_MS  6000
13 
14 typedef struct {
15     uint32_t short_press_max_ms;   // default 2000
16     uint32_t long_press_min_ms;    // default 5000
17     void (*short_press_handler)(void);
18     void (*long_press_handler)(void);
19 } key_cfg_t;
20 
21 int key_init(key_cfg_t *cfg);
22 
23 #endif
24 
25