You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
499 B

3 years ago
  1. #pragma once
  2. #include "esp_event_loop.h"
  3. #include "driver/gpio.h"
  4. #include "esp_log.h"
  5. typedef enum
  6. {
  7. KEY_SHORT_PRESS = 1,
  8. KEY_LONG_PRESS,
  9. KEY_DOUBLE_CLICK,
  10. } key_state_t;
  11. #ifdef __cplusplus
  12. extern "C"
  13. {
  14. #endif
  15. /**
  16. * @brief initialize gpio button
  17. *
  18. * @param key_io_num the gpio number of the button
  19. * @param key_state_o the queue to send the button state
  20. */
  21. void register_button(const gpio_num_t key_io_num, const QueueHandle_t key_state_o);
  22. #ifdef __cplusplus
  23. }
  24. #endif