Key.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef __KEY_H_
  2. #define __KEY_H_
  3. //////////////////////////////////////////
  4. #define KEY_FUNC_PIN GPIO_Pin_0
  5. #define KEY_FUNC_PORT GPIOB
  6. #define KEY_INFO_PIN GPIO_Pin_1
  7. #define KEY_INFO_PORT GPIOB
  8. #define KEY_PPT_PIN GPIO_Pin_2
  9. #define KEY_PPT_PORT GPIOB
  10. #define KEY_POWER_PIN GPIO_Pin_3
  11. #define KEY_POWER_PORT GPIOB
  12. #define KeyPwrStatus (KEY_POWER_PORT->IDR & KEY_POWER_PIN)
  13. #define KEY_POWER_HIGH KEY_POWER_PORT->BSRR = KEY_POWER_PIN //BSRR
  14. #define KEY_POWER_LOW KEY_POWER_PORT->BRR = KEY_POWER_PIN //BRR
  15. #define PWR_EN_PIN GPIO_Pin_8
  16. #define PWR_EN_PORT GPIOB
  17. #define PWR_EN_HIGH PWR_EN_PORT->BSRR = PWR_EN_PIN //BSRR
  18. #define PWR_EN_LOW PWR_EN_PORT->BRR = PWR_EN_PIN //BRR
  19. #define KEY_ALL_PORTB (KEY_POWER_PIN|KEY_PPT_PIN| KEY_FUNC_PIN|KEY_INFO_PIN)
  20. //#define KEY_ALL_PORTC (KEY_PPT_PIN| KEY_FUNC_PIN|KEY_INFO_PIN)
  21. #define KEY_OPTION 0x070000 //左1 选项按键
  22. #define KEY_PPT 0x0b0000 //左1
  23. #define KEY_PANEL_OK 0xfc002a //左3
  24. #define KEY_INFO 0x0d0000 //左4 代替 原KEY_UP,vol+
  25. #define KEY_FUNC 0x0e0000 //左5 代替 原KEY_DOWN,vol-
  26. #define KEY_PANEL_MENU 0xec042a //正1
  27. #define KEY_PANEL_UP 0xdc042a //正2
  28. #define KEY_PANEL_DOWN 0xbc042a //正3
  29. #define KEY_PANEL_EXIT 0xf4042a //正4
  30. #define KEY_PPT_MIC 0xfc040a
  31. #define KEY_EXIT_DOWN_GT 0x0C0000 //侧键UP+DOWN 此值用于进入GT模式
  32. #define KEY_P1_P3_UPDATE 0xf8082e //此值用于进入对讲版本升级
  33. #define KEY_UP_DOWN_IP 0xac042a //OK+DOWN
  34. #define KEY_IDLE 0xfc042a
  35. extern unsigned char g_ucUKC;
  36. extern unsigned char g_ucKeyFree;
  37. extern unsigned char g_ucKeyMode;
  38. extern unsigned long g_ulKeyValue; //key value
  39. extern unsigned char g_ucKeyPPTPress;
  40. extern int g_iEncode;
  41. extern unsigned char PttKeyFlag;
  42. extern u32 Flashtick;
  43. void KeyInit(void);
  44. int GetKey(void);
  45. int GetKeyVBAT(void);
  46. void KeyCount(void);
  47. void CheckPwrKeyOn(void);
  48. #endif