key.h 616 B

123456789101112131415161718192021222324252627
  1. #ifndef __KEY_H__
  2. #define __KEY_H__
  3. #include "gpio.h"
  4. typedef void (* key_function)(void);
  5. struct single_key_param {
  6. uint8 key_level;
  7. uint8 gpio_id;
  8. uint8 gpio_func;
  9. uint32 gpio_name;
  10. os_timer_t key_5s;
  11. os_timer_t key_50ms;
  12. key_function short_press;
  13. key_function long_press;
  14. };
  15. struct keys_param {
  16. uint8 key_num;
  17. struct single_key_param **single_key;
  18. };
  19. struct single_key_param *key_init_single(uint8 gpio_id, uint32 gpio_name, uint8 gpio_func, key_function long_press, key_function short_press);
  20. void key_init(struct keys_param *key);
  21. #endif