按键处理原则上必须遵循:
1,不可以有硬延时,消抖用变量++或者硬件处理掉!
2,多按键预防卡键,有一个按键不好使了,不能影响其它按键工作!
#ifnde- f __KEY_H_
- #define __KEY_H_
- #include "stm32f10x.h"
- #ifndef __KEY_C_
- #define __KEY_C_ extern
- #else
- #define __KEY_C_
- #endif
- #define KeySmartConfigDown 0 //0- 低电平认为是按下 1-高电平认为是按下
- #define SmartConfigKeyPinIn PBin(5) //检测的按键引脚
- __KEY_C_ int KeySmartConfig[7];//消抖变量 按下标记 松开标记 按下标记拷贝 松开标记拷贝 按下时间(Ms) 松开时间(Ms)
- void SmartConfigKey(void);
-
- #endif
二,添加文件到工程



二,.h 包含





|