Key.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 KEY_ALL_PORTB (KEY_POWER_PIN|KEY_PPT_PIN| KEY_FUNC_PIN|KEY_INFO_PIN)
  16. //#define KEY_ALL_PORTC (KEY_PPT_PIN| KEY_FUNC_PIN|KEY_INFO_PIN)
  17. #define KEY_OPTION 0x070000 //左1 选项按键
  18. #define KEY_PPT 0x0b0000 //左1
  19. #define KEY_PANEL_OK 0xfc002a //左3
  20. #define KEY_INFO 0x0d0000 //左4 代替 原KEY_UP,vol+
  21. #define KEY_FUNC 0x0e0000 //左5 代替 原KEY_DOWN,vol-
  22. #define KEY_PANEL_MENU 0xec042a //正1
  23. #define KEY_PANEL_UP 0xdc042a //正2
  24. #define KEY_PANEL_DOWN 0xbc042a //正3
  25. #define KEY_PANEL_EXIT 0xf4042a //正4
  26. #define KEY_PPT_MIC 0xfc040a
  27. #define KEY_EXIT_DOWN_GT 0x0C0000 //侧键UP+DOWN 此值用于进入GT模式
  28. #define KEY_P1_P3_UPDATE 0xf8082e //此值用于进入对讲版本升级
  29. #define KEY_UP_DOWN_IP 0xac042a //OK+DOWN
  30. #define KEY_IDLE 0xfc042a
  31. extern unsigned char g_ucUKC;
  32. extern unsigned char g_ucKeyFree;
  33. extern unsigned char g_ucKeyMode;
  34. extern unsigned long g_ulKeyValue; //key value
  35. extern unsigned char g_ucKeyPPTPress;
  36. extern int g_iEncode;
  37. extern unsigned char PttKeyFlag;
  38. void KeyInit(void);
  39. int GetKey(void);
  40. int GetKeyVBAT(void);
  41. void KeyCount(void);
  42. void SoftPwrOffCheck(void);
  43. #endif