32 lines
822 B
C
32 lines
822 B
C
#ifndef OS_INPUT_H
|
|
#define OS_INPUT_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include "driver/gpio.h"
|
|
#include "esp_err.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef enum {
|
|
INPUT_ACTION_NONE = 0,
|
|
INPUT_ACTION_CLICK, /* Short press (Next / Step / Advance) */
|
|
INPUT_ACTION_DOUBLE_CLICK,/* Double click (Back / Cancel) */
|
|
INPUT_ACTION_LONG_PRESS, /* Hold > 400ms (Select / Confirm / Open) */
|
|
INPUT_ACTION_HOLD_HOME, /* Hold > 1500ms (Return to App Launcher) */
|
|
} input_action_t;
|
|
|
|
typedef void (*sys_input_handler_t)(input_action_t action, void *user_arg);
|
|
|
|
esp_err_t sys_input_init(gpio_num_t button_gpio);
|
|
esp_err_t sys_input_register_handler(sys_input_handler_t handler, void *user_arg);
|
|
void sys_input_inject(input_action_t action);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // OS_INPUT_H
|