芯片解密|单片机解密|IC解密|芯片破解|芯片复制| PCB抄板|软件开发

飞芯科技-芯片解密|单片机解密|IC解密|芯片破解|芯片复制| PCB抄板|软件开发

芯片解密单片机矩阵键盘扫描驱动程序

  1. 芯片解密#ifndef __Key_matrix_H
  2. 芯片解密#define __Key_matrix_H

  3. 芯片解密#include "gpio.h"
  4. #include "gpio_bool.h"

  5. /*务必把这4个输出IO设置为上拉输入*/
  6. #define KEY_HOR1 PAin(7)
  7. #define KEY_HOR2 PAin(6)
  8. #define KEY_HOR3 PAin(5)
  9. #define KEY_HOR4 PAin(4)
  10. /*务必把这4个输出IO设置为开漏*/
  11. #define KEY_LON1 PBout(0)
  12. #define KEY_LON2 PCout(5)
  13. #define KEY_LON3 PCout(4)
  14. #define KEY_LON4 PCout(3)

  15. #define KEY_PRESS_TIME 20//消抖常数
  16. #define KEY_LONG_PRESS_TIME 3000//单个按键长按阈值3s
  17. /*通过读取(只读)这三个变量即可获得按键的单按、长按和组合键信息*/
  18. extern volatile uint16_t Key_Phy_Num;
  19. extern volatile uint8_t Key_Pulse_Num;
  20. extern volatile uint16_t Key_LP_Num;

  21. typedef enum
  22. {
  23.         KPL_DISABLE=0,
  24.         KPL_ENABLE
  25. }K_L_P;//按键的长按状态
  26. typedef struct
  27. {
  28.         K_L_P KEY_LONG_PRESS;
  29.         uint16_t KeyOpenCount;
  30.         uint8_t KOC_EN;
  31.         uint16_t KeyCloseCount;
  32.         uint8_t KCC_EN;
  33. }Key_Para;

  34. exter Key_Par Key_1,Key_2,Key_3,Key_4,Key_5,Key_6,Key_7,Key_8,Key_9,Key_10,Key_11,Key_12,Key_13,Key_14,Key_15,Key_16;

  35. void Clear_Key_Pulse_Num(void);//当读取完Key_Pulse_Num后调用
  36. void KeyCount_Run(void);//在1ms滴答里调用
  37. void Key_Scan(void);//大循环或者滴答里边都行

  38. #endif



联系方式

地址:石家庄市新华区民族路77号华强广场D座2009
电话:0311-88816616/87087811
手机:13315190088
传真:0311-67901001
联系人:张工
网址:www.feixindz.com
邮箱:feixindz@163.com
微信:xinpianjiemi
QQ:527263666/568069805

在线客服
热线电话

企业微信