2021-10-20 20:12:08 +08:00
|
|
|
#pragma once
|
2023-03-02 11:49:32 +08:00
|
|
|
#include "esp_timer.h"
|
|
|
|
#include "esp_event.h"
|
2021-10-20 20:12:08 +08:00
|
|
|
#include "driver/gpio.h"
|
|
|
|
#include "esp_log.h"
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
KEY_SHORT_PRESS = 1,
|
|
|
|
KEY_LONG_PRESS,
|
|
|
|
KEY_DOUBLE_CLICK,
|
|
|
|
} key_state_t;
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
|
2021-10-26 17:01:27 +08:00
|
|
|
/**
|
2021-10-20 20:12:08 +08:00
|
|
|
* @brief initialize gpio button
|
|
|
|
*
|
|
|
|
* @param key_io_num the gpio number of the button
|
|
|
|
* @param key_state_o the queue to send the button state
|
|
|
|
*/
|
2021-10-26 17:01:27 +08:00
|
|
|
void register_button(const gpio_num_t key_io_num, const QueueHandle_t key_state_o);
|
2021-10-20 20:12:08 +08:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|