Files
JYF_STC15W4K_wireless_charge/Lib/KeyScan.c

23 lines
581 B
C

#include "KeyScan.h"
void main() {
Key_Init(); // 初始化按键模块
Timer0_Init(); // 配置1ms定时器
while(1) {
// 在定时器中断服务例程中调用Key_Scan()
if(Get_KeyEvents()) {
// 执行按键处理逻辑
uint8_t keys = Get_KeyEvents();
if(keys & 0x08) { /* KEY1处理 */ }
if(keys & 0x04) { /* KEY2处理 */ }
// ...其他按键处理
}
}
}
// // Timer0中断服务函数
// void Timer0_ISR() interrupt 1 {
// Key_Scan(); // 定时扫描按键
// }