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.

43 lines
1.0 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. #include "key.h"
  2. #include "esp_log.h"
  3. #include "driver/gpio.h"
  4. static key_ble_cb_t s_ble_key_cb;
  5. void key_init()
  6. {
  7. gpio_config_t gpio_grb_led_structer;
  8. gpio_grb_led_structer.intr_type = GPIO_INTR_DISABLE;
  9. gpio_grb_led_structer.mode = GPIO_MODE_INPUT;
  10. gpio_grb_led_structer.pin_bit_mask = GPIO_KEY_INPUT_PIN_SEL;
  11. gpio_grb_led_structer.pull_down_en = 0;
  12. gpio_grb_led_structer.pull_up_en = 0;
  13. gpio_config(&gpio_grb_led_structer);
  14. }
  15. void key_schedule()
  16. {
  17. if (gpio_get_level(KEY_REC) == 0)
  18. {
  19. /* code */
  20. ESP_LOGI("Finny", "KEY_REC level 0");
  21. while (gpio_get_level(KEY_REC) == 0)
  22. {
  23. }
  24. s_ble_key_cb("setPosition180");
  25. ESP_LOGI("Finny", "stop");
  26. }
  27. if (gpio_get_level(KEY_MODE) == 0)
  28. {
  29. /* code */
  30. ESP_LOGI("Finny", "KEY_MODE level 0");
  31. while (gpio_get_level(KEY_MODE) == 0)
  32. {
  33. }
  34. s_ble_key_cb("setPosition360");
  35. ESP_LOGI("Finny", "stop");
  36. }
  37. }
  38. void key_ble_send_cmd_reg(key_ble_cb_t cb) { s_ble_key_cb = cb; };