5022| 5
|
STM32F407中断问题求解,类似于一个按键序列检测 |
1金钱
最佳答案定义目标顺序数组g_targetArr [4]= {1, 2, 3, 4}
定义实时检测到的按键值数组s_currentKeyArr[4] = {0};
static u8 i = 0;
按键按下后给数组s_currentKeyArr赋值(KEY0赋值1,KEY1赋值2,KEY2赋值3,WKUP赋值4),比较s_currentKeyArr跟g_targetArr的前i个元素,一致则继续直到4个按键顺序都对则点灯;不一致则i清零;
这样子处理,按键初始化的时候没有谁是有优先级的,另外只要你改了目标顺序数组g_targetArr的值,那么 ...
| ||
| ||
He who fights with monsters should look to it that he himself does not become a monster, when you gaze long into the abyss, the abyss also gazes into you.
过于执着就会陷入其中,迷失自己,困住自己。 |
||
| ||
| ||
| ||
| ||
|手机版|OpenEdv-开源电子网
( 粤ICP备12000418号-1 )
GMT+8, 2025-2-24 17:35
Powered by OpenEdv-开源电子网
© 2001-2030 OpenEdv-开源电子网