Key.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /********************************************************************************
  2. * File Name: Key.h
  3. * Function Describe: Header file for Key.c
  4. * Explain:
  5. * Writer: ShiLiangWen
  6. * Date: 2015-1-30
  7. *******************************************************************************/
  8. #ifndef __KEY_LED_H
  9. #define __KEY_LED_H
  10. /*********************************begin*****************************************/
  11. #define CHARGE_IC_PIN GPIO_Pin_4 //充电IC 开启
  12. #define CHARGE_IC_PORT GPIOC
  13. #define CHARGE_IC_LOW CHARGE_IC_PORT->BRR = CHARGE_IC_PIN
  14. #define CHARGE_IC_HIGH CHARGE_IC_PORT->BSRR = CHARGE_IC_PIN
  15. #define CHARGE_STATUE_PIN GPIO_Pin_15 //判饱脚
  16. #define CHARGE_STATUE_PORT GPIOA
  17. #define KEY_LED_PIN GPIO_Pin_8 //手电筒
  18. #define KEY_LED_PORT GPIOB
  19. #define KEY_LED(bit) bit?(GPIO_SetBits(KEY_LED_PORT,KEY_LED_PIN)):(GPIO_ResetBits(KEY_LED_PORT,KEY_LED_PIN))
  20. #define CHARGEChek_PIN GPIO_Pin_13 //判充脚
  21. #define CHARGEChek_PORT GPIOC //
  22. #define CHARGELED_PIN GPIO_Pin_14 //充电指示灯
  23. #define CHARGELED_PORT GPIOC //
  24. #define CHARGE_LED_LOW CHARGELED_PORT->BRR = CHARGELED_PIN
  25. #define CHARGE_LED_HIGH CHARGELED_PORT->BSRR = CHARGELED_PIN
  26. #define KEY_PANEL_MENU_PIN GPIO_Pin_4
  27. #define KEY_PANEL_MENU_PORT GPIOB
  28. #define KEY_PANEL_UP_PIN GPIO_Pin_5
  29. #define KEY_PANEL_UP_PORT GPIOB
  30. #define KEY_PANEL_DOWN_PIN GPIO_Pin_6
  31. #define KEY_PANEL_DOWN_PORT GPIOB
  32. #define KEY_PANEL_EXIT_PIN GPIO_Pin_3
  33. #define KEY_PANEL_EXIT_PORT GPIOB
  34. #define KeyPwrStatus (KEY_PANEL_EXIT_PORT->IDR & KEY_PANEL_EXIT_PIN)
  35. #define KEY_SOS_OK_PIN GPIO_Pin_7 //K1
  36. #define KEY_SOS_OK_PORT GPIOB
  37. #define KEY_PPT_PIN GPIO_Pin_3 //k2
  38. #define KEY_PPT_PORT GPIOC
  39. #define KEY_INFO_PIN GPIO_Pin_1 //K3
  40. #define KEY_INFO_PORT GPIOC
  41. #define KEY_FUNC_P1_PIN GPIO_Pin_2 //K4 p1 KEY_POWER_PIN
  42. #define KEY_FUNC_P1_PORT GPIOB //KEY_POWER_PORT
  43. #define KEY_FUNC_P2_PIN GPIO_Pin_10 //K5 p2
  44. #define KEY_FUNC_P2_PORT GPIOC
  45. // #define KEY_PPT_MIC_PIN GPIO_Pin_3
  46. // #define KEY_PPT_MIC_PORT GPIOC
  47. //////////////////////////////////////////
  48. #define KEY_ALL_PORTB (KEY_PANEL_UP_PIN|KEY_PANEL_DOWN_PIN|KEY_SOS_OK_PIN|KEY_PANEL_EXIT_PIN|KEY_PANEL_MENU_PIN|KEY_FUNC_P1_PIN)
  49. #define KEY_ALL_PORTC (KEY_PPT_PIN|KEY_FUNC_P2_PIN|KEY_INFO_PIN)
  50. #define KEY_SOS_OK 0xfc002a //上1 ////SOS
  51. #define KEY_INFO 0x7c040a // 左一
  52. #define KEY_PPT 0xfc0402 //左2
  53. #define KEY_FUNC_P2 0xfc0408 //左3
  54. #define KEY_FUNC_P3 0xf8040a //左4 ///down
  55. #define KEY_PANEL_MENU 0x00ec040a //正1
  56. #define KEY_PANEL_UP 0x00bc040a //正2
  57. #define KEY_PANEL_DOWN 0x00dc040a //正3
  58. #define KEY_PANEL_EXIT 0x00f4040a //正4
  59. //#define KEY_PPT_MIC 0xfc0422
  60. #define KEY_EXIT_DOWN_GT 0xd4040a //DOWN+EXIT 此值用于进入GT模式 //d4042a //b4042a
  61. #define KEY_P1_P3_UPDATE 0xf8082e //此值用于进入对讲版本升级
  62. #define KEY_OK_DOWN_GPS 0xac042a //OK+DOWN
  63. #define KEY_PTT_EXIT 0xf40402//0xf40422
  64. extern unsigned char g_ucDKC;
  65. extern unsigned char g_ucUKC;
  66. extern unsigned char g_ucKeyFree;
  67. extern unsigned char g_ucKeyMode;
  68. extern unsigned long g_ulKeyValue; //key value
  69. extern unsigned char g_ucKeyPPTPress;
  70. void KeyInit(void);
  71. int GetKey(void);
  72. void KeyToModem(int flag);
  73. void KeyCount(void);
  74. void OnOff_Init(void);
  75. void SoftPwrOffCheck(void);
  76. /**********************************end******************************************/
  77. #endif