Key.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #ifndef __KEY_H_
  2. #define __KEY_H_
  3. #define ONOFF_CK_PIN GPIO_Pin_2
  4. #define ONOFF_CK_PORT GPIOD
  5. #define HC165_READ_PIN GPIO_Pin_10
  6. #define HC165_READ_PORT GPIOC
  7. #define HC165_PL_PIN GPIO_Pin_11
  8. #define HC165_PL_PORT GPIOC
  9. #define HC165_CP_PIN GPIO_Pin_12
  10. #define HC165_CP_PORT GPIOC
  11. #define HC165_DATA_READ GPIO_ReadInputDataBit(HC165_READ_PORT,HC165_READ_PIN) //9
  12. #define HC165_CP_HIGH HC165_CP_PORT->BSRR = HC165_CP_PIN
  13. #define HC165_CP_LOW HC165_CP_PORT->BRR = HC165_CP_PIN
  14. #define HC165_PL_HIGH HC165_PL_PORT->BSRR= HC165_PL_PIN
  15. #define HC165_PL_LOW HC165_PL_PORT->BRR= HC165_PL_PIN
  16. //////////////////////////////////////////
  17. #define KEY_FUNC_PIN GPIO_Pin_10
  18. #define KEY_FUNC_PORT GPIOA
  19. #define KEY_INFO_PIN GPIO_Pin_11
  20. #define KEY_INFO_PORT GPIOA
  21. #define KEY_PPT_PIN GPIO_Pin_12
  22. #define KEY_PPT_PORT GPIOA
  23. #define KEY_POWER_PIN GPIO_Pin_3
  24. #define KEY_POWER_PORT GPIOB
  25. #define KeyPwrStatus (KEY_POWER_PORT->IDR & KEY_POWER_PIN)
  26. #define KEY_ALL_IDLE 0xFFF8//0xFFFC
  27. //#define KEY_ALL_IDLE2 0xFFFB //耳机接入
  28. #define HEDESET_DET (KEY_ALL_IDLE &~(0x01<<2)) //耳机接入
  29. #define KEY_PPT_MIC (KEY_ALL_IDLE &~(0x01<<3)) //耳机PTT
  30. #define KEY_OPTION (KEY_ALL_IDLE &~(0x01<<4))//左1 选项按键
  31. #define KEY_PPT (KEY_ALL_IDLE &~(0x01<<5)) //左2
  32. #define KEY_INFO (KEY_ALL_IDLE &~(0x01<<6) ) //左3 代替 原KEY_UP,vol+
  33. #define KEY_FUNC (KEY_ALL_IDLE &~(0x01<<7)) //左4 代替 原KEY_DOWN,vol-
  34. #define KEY_PANEL_MENU (KEY_ALL_IDLE &~(0x01<<15)) //正1
  35. #define KEY_PANEL_UP (KEY_ALL_IDLE &~(0x01<<14)) //正2
  36. #define KEY_PANEL_EXIT (KEY_ALL_IDLE &~(0x01<<13) ) //正3
  37. #define KEY_PANEL_P1 (KEY_ALL_IDLE &~(0x01<<12)) //正4
  38. #define KEY_PANEL_DOWN (KEY_ALL_IDLE &~(0x01<<11)) //正5
  39. #define KEY_PANEL_P2 (KEY_ALL_IDLE &~(0x01<<10)) //正6
  40. #define KEY_PANEL_P3 (KEY_ALL_IDLE &~(0x01<<9) ) //正7
  41. #define KEY_PANEL_P4 (KEY_ALL_IDLE &~(0x01<<8)) //正8
  42. //#define KEY_PPT_MIC 0xfc040a
  43. #define KEY_EXIT_DOWN_GT (KEY_INFO&KEY_FUNC ) //侧键UP+DOWN 此值用于进入GT模式
  44. #define KEY_UP_DOWN (KEY_PANEL_UP&KEY_PANEL_DOWN) //上+下 用于查看IP
  45. /*以下所述键值暂未用到*/
  46. #define KEY_P1_P3_UPDATE 0xf8082e //此值用于进入对讲版本升级
  47. #define KEY_OK_DOWN_GPS 0xac042a //OK+DOWN
  48. //#define KEY_IDLE 0xfc042a
  49. extern unsigned char g_ucUKC;
  50. extern unsigned char g_ucKeyFree;
  51. extern unsigned char g_ucKeyMode;
  52. extern unsigned long g_ulKeyValue; //key value
  53. extern unsigned char g_ucKeyPPTPress;
  54. extern int g_iEncode;
  55. extern signed char Headsetsta;
  56. void KeyInit(void);
  57. int GetKey(void);
  58. void KeyCount(void);
  59. void SoftPwrOffCheck(void);
  60. void OnOff_Init(void);
  61. #endif