Files
ESP32C3-0.42OLED-OS/components/sys_input/include/os_input.h
T

33 lines
901 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_TRIPLE_CLICK, /* Triple click (Global Home / Launcher) */
INPUT_ACTION_LONG_PRESS, /* Hold > 380ms (Select / Confirm / Open) */
INPUT_ACTION_HOLD_HOME, /* Hold > 1400ms (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