📄 bsp_button.txt
字号:
000196 6008 STR r0,[r1,#0] ; s_BtnUserTamper
;;;340 s_BtnUserTamper.FilterTime = BUTTON_FILTER_TIME; /* 按键滤波时间 */
000198 2005 MOVS r0,#5
00019a 7148 STRB r0,[r1,#5]
;;;341 s_BtnUserTamper.LongTime = 0; /* 长按时间 */
00019c 2000 MOVS r0,#0
00019e 8108 STRH r0,[r1,#8]
;;;342 s_BtnUserTamper.Count = s_BtnUserTamper.FilterTime / 2; /* 计数器设置为滤波时间的一半 */
0001a0 7948 LDRB r0,[r1,#5] ; s_BtnUserTamper
0001a2 eb0071d0 ADD r1,r0,r0,LSR #31
0001a6 1049 ASRS r1,r1,#1
0001a8 4a18 LDR r2,|L14.524|
0001aa 7111 STRB r1,[r2,#4]
;;;343 s_BtnUserTamper.State = 0; /* 按键缺省状态,0为未按下 */
0001ac 2000 MOVS r0,#0
0001ae 4611 MOV r1,r2
0001b0 7288 STRB r0,[r1,#0xa]
;;;344 s_BtnUserTamper.KeyCodeDown = KEY_DOWN_USER_TAMPER; /* 按键按下的键值代码 */
0001b2 200e MOVS r0,#0xe
0001b4 7308 STRB r0,[r1,#0xc]
;;;345 s_BtnUserTamper.KeyCodeUp = 0; /* 按键弹起的键值代码,0表示不检测 */
0001b6 2000 MOVS r0,#0
0001b8 72c8 STRB r0,[r1,#0xb]
;;;346 s_BtnUserTamper.KeyCodeLong = 0; /* 按键被持续按下的键值代码,0表示不检测 */
0001ba 7348 STRB r0,[r1,#0xd]
;;;347 s_BtnUserTamper.RepeatSpeed = 0; /* 按键连发的速度,0表示不支持连发 */
0001bc 7388 STRB r0,[r1,#0xe]
;;;348 s_BtnUserTamper.RepeatCount = 0; /* 连发计数器 */
0001be 73c8 STRB r0,[r1,#0xf]
;;;349 }
0001c0 4770 BX lr
;;;350
ENDP
0001c2 0000 DCW 0x0000
|L14.452|
DCD s_Key
|L14.456|
DCD IsKeyDownUser
|L14.460|
DCD s_BtnUser
|L14.464|
DCD IsKeyDownTamper
|L14.468|
DCD s_BtnTamper
|L14.472|
DCD IsKeyDownWakeUp
|L14.476|
DCD s_BtnWakeUp
|L14.480|
DCD IsKeyDownUp
|L14.484|
DCD s_BtnUp
|L14.488|
DCD IsKeyDownDown
|L14.492|
DCD s_BtnDown
|L14.496|
DCD IsKeyDownLeft
|L14.500|
DCD s_BtnLeft
|L14.504|
DCD IsKeyDownRight
|L14.508|
DCD s_BtnRight
|L14.512|
DCD IsKeyDownOk
|L14.516|
DCD s_BtnOk
|L14.520|
DCD IsKeyDownUserTamper
|L14.524|
DCD s_BtnUserTamper
AREA ||i.bsp_KeyPro||, CODE, READONLY, ALIGN=2
bsp_KeyPro PROC
;;;455 */
;;;456 void bsp_KeyPro(void)
000000 b510 PUSH {r4,lr}
;;;457 {
;;;458 bsp_DetectButton(&s_BtnUser); /* USER 键 */
000002 480e LDR r0,|L15.60|
000004 f7fffffe BL bsp_DetectButton
;;;459 bsp_DetectButton(&s_BtnTamper); /* TAMPER 键 */
000008 480d LDR r0,|L15.64|
00000a f7fffffe BL bsp_DetectButton
;;;460 bsp_DetectButton(&s_BtnWakeUp); /* WAKEUP 键 */
00000e 480d LDR r0,|L15.68|
000010 f7fffffe BL bsp_DetectButton
;;;461 bsp_DetectButton(&s_BtnUp); /* 摇杆UP键 */
000014 480c LDR r0,|L15.72|
000016 f7fffffe BL bsp_DetectButton
;;;462 bsp_DetectButton(&s_BtnDown); /* 摇杆DOWN键 */
00001a 480c LDR r0,|L15.76|
00001c f7fffffe BL bsp_DetectButton
;;;463 bsp_DetectButton(&s_BtnLeft); /* 摇杆LEFT键 */
000020 480b LDR r0,|L15.80|
000022 f7fffffe BL bsp_DetectButton
;;;464 bsp_DetectButton(&s_BtnRight); /* 摇杆RIGHT键 */
000026 480b LDR r0,|L15.84|
000028 f7fffffe BL bsp_DetectButton
;;;465 bsp_DetectButton(&s_BtnOk); /* 摇杆OK键 */
00002c 480a LDR r0,|L15.88|
00002e f7fffffe BL bsp_DetectButton
;;;466 bsp_DetectButton(&s_BtnUserTamper); /* 组合键 */
000032 480a LDR r0,|L15.92|
000034 f7fffffe BL bsp_DetectButton
;;;467 }
000038 bd10 POP {r4,pc}
ENDP
00003a 0000 DCW 0x0000
|L15.60|
DCD s_BtnUser
|L15.64|
DCD s_BtnTamper
|L15.68|
DCD s_BtnWakeUp
|L15.72|
DCD s_BtnUp
|L15.76|
DCD s_BtnDown
|L15.80|
DCD s_BtnLeft
|L15.84|
DCD s_BtnRight
|L15.88|
DCD s_BtnOk
|L15.92|
DCD s_BtnUserTamper
AREA ||i.bsp_KeyState||, CODE, READONLY, ALIGN=2
bsp_KeyState PROC
;;;137 */
;;;138 uint8_t bsp_KeyState(uint8_t _ucKeyID)
000000 4601 MOV r1,r0
;;;139 {
;;;140 uint8_t ucState = 0;
000002 2000 MOVS r0,#0
;;;141
;;;142 switch (_ucKeyID)
000004 2908 CMP r1,#8
000006 d21d BCS |L16.68|
000008 e8dff001 TBB [pc,r1]
00000c 04070a0d DCB 0x04,0x07,0x0a,0x0d
000010 10131619 DCB 0x10,0x13,0x16,0x19
;;;143 {
;;;144 case KID_TAMPER:
;;;145 ucState = s_BtnTamper.State;
000014 4a0c LDR r2,|L16.72|
000016 7a90 LDRB r0,[r2,#0xa] ; s_BtnTamper
;;;146 break;
000018 e014 B |L16.68|
;;;147
;;;148 case KID_WAKEUP:
;;;149 ucState = s_BtnWakeUp.State;
00001a 4a0c LDR r2,|L16.76|
00001c 7a90 LDRB r0,[r2,#0xa] ; s_BtnWakeUp
;;;150 break;
00001e e011 B |L16.68|
;;;151
;;;152 case KID_USER:
;;;153 ucState = s_BtnUser.State;
000020 4a0b LDR r2,|L16.80|
000022 7a90 LDRB r0,[r2,#0xa] ; s_BtnUser
;;;154 break;
000024 e00e B |L16.68|
;;;155
;;;156 case KID_JOY_UP:
;;;157 ucState = s_BtnUp.State;
000026 4a0b LDR r2,|L16.84|
000028 7a90 LDRB r0,[r2,#0xa] ; s_BtnUp
;;;158 break;
00002a e00b B |L16.68|
;;;159
;;;160 case KID_JOY_DOWN:
;;;161 ucState = s_BtnDown.State;
00002c 4a0a LDR r2,|L16.88|
00002e 7a90 LDRB r0,[r2,#0xa] ; s_BtnDown
;;;162 break;
000030 e008 B |L16.68|
;;;163
;;;164 case KID_JOY_LEFT:
;;;165 ucState = s_BtnLeft.State;
000032 4a0a LDR r2,|L16.92|
000034 7a90 LDRB r0,[r2,#0xa] ; s_BtnLeft
;;;166 break;
000036 e005 B |L16.68|
;;;167
;;;168 case KID_JOY_RIGHT:
;;;169 ucState = s_BtnRight.State;
000038 4a09 LDR r2,|L16.96|
00003a 7a90 LDRB r0,[r2,#0xa] ; s_BtnRight
;;;170 break;
00003c e002 B |L16.68|
;;;171
;;;172 case KID_JOY_OK:
;;;173 ucState = s_BtnOk.State;
00003e 4a09 LDR r2,|L16.100|
000040 7a90 LDRB r0,[r2,#0xa] ; s_BtnOk
;;;174 break;
000042 bf00 NOP
|L16.68|
000044 bf00 NOP ;146
;;;175 }
;;;176
;;;177 return ucState;
;;;178 }
000046 4770 BX lr
;;;179
ENDP
|L16.72|
DCD s_BtnTamper
|L16.76|
DCD s_BtnWakeUp
|L16.80|
DCD s_BtnUser
|L16.84|
DCD s_BtnUp
|L16.88|
DCD s_BtnDown
|L16.92|
DCD s_BtnLeft
|L16.96|
DCD s_BtnRight
|L16.100|
DCD s_BtnOk
AREA ||i.bsp_PutKey||, CODE, READONLY, ALIGN=2
bsp_PutKey PROC
;;;91 */
;;;92 void bsp_PutKey(uint8_t _KeyCode)
000000 4906 LDR r1,|L17.28|
;;;93 {
;;;94 s_Key.Buf[s_Key.Write] = _KeyCode;
000002 7d49 LDRB r1,[r1,#0x15] ; s_Key
000004 4a05 LDR r2,|L17.28|
000006 5450 STRB r0,[r2,r1]
;;;95
;;;96 if (++s_Key.Write >= KEY_FIFO_SIZE)
000008 4611 MOV r1,r2
00000a 7d49 LDRB r1,[r1,#0x15] ; s_Key
00000c 1c49 ADDS r1,r1,#1
00000e b2c9 UXTB r1,r1
000010 7551 STRB r1,[r2,#0x15]
000012 2914 CMP r1,#0x14
000014 db01 BLT |L17.26|
;;;97 {
;;;98 s_Key.Write = 0;
000016 2100 MOVS r1,#0
000018 7551 STRB r1,[r2,#0x15]
|L17.26|
;;;99 }
;;;100 }
00001a 4770 BX lr
;;;101
ENDP
|L17.28|
DCD s_Key
AREA ||.bss||, DATA, NOINIT, ALIGN=2
s_BtnUser
% 16
s_BtnTamper
% 16
s_BtnWakeUp
% 16
s_BtnUp
% 16
s_BtnDown
% 16
s_BtnLeft
% 16
s_BtnRight
% 16
s_BtnOk
% 16
s_BtnUserTamper
% 16
s_Key
% 22
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -