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.

50 lines
948 B

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
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. /**
  2. * @file key.c
  3. * @author Finny (tianjialong0106@163.com)
  4. * @brief
  5. * @version 0.1
  6. * @date 2022-09-26
  7. *
  8. * @copyright Copyright (c) 2022
  9. *
  10. */
  11. #include "key.h"
  12. static T_key_structer_t *T_key_structer_s;
  13. static key_cb callback_s;
  14. void T_key_init(T_key_structer_t *T_key_structer)
  15. {
  16. T_key_structer_s = T_key_structer;
  17. }
  18. void T_key_registered_cb(key_cb cb)
  19. {
  20. callback_s = cb;
  21. }
  22. void T_key_on_event(void)
  23. {
  24. }
  25. void T_key_schedule(void)
  26. {
  27. T_key_structer_s->key_now_state = T_key_get_level();
  28. if ((T_key_structer_s->key_before_state != T_key_structer_s->key_now_state) && (T_key_structer_s->key_now_state == true))
  29. {
  30. if (callback_s())
  31. {
  32. /* 有反应板的处理 */
  33. }
  34. else
  35. {
  36. /* 没有反应板的处理(加热) */
  37. }
  38. }
  39. T_key_structer_s->key_before_state = T_key_structer_s->key_now_state;
  40. }
  41. bool T_key_get_level(void)
  42. {
  43. return false;
  44. }