bsp_button.txt
36.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
; generated by Component: ARM Compiler 5.06 update 6 (build 750) Tool: ArmCC [4d3637]
; commandline ArmCC [--c99 --list --split_sections --debug -c --asm --interleave -o.\flash\obj\bsp_button.o --asm_dir=.\Flash\List\ --list_dir=.\Flash\List\ --depend=.\flash\obj\bsp_button.d --cpu=Cortex-M4.fp --apcs=interwork -O0 --diag_suppress=9931,870 -I..\..\Libraries\CMSIS\Include -I..\..\Libraries\CMSIS\Device\ST\STM32F4xx\Include -I..\..\Libraries\STM32F4xx_StdPeriph_Driver\inc -I..\..\uCOS-III\uC-CPU -I..\..\uCOS-III\uC-LIB -I..\..\uCOS-III\uCOS-III\Ports -I..\..\uCOS-III\uCOS-III\Source -I..\..\uCOS-III\uC-CPU\ARM-Cortex-M4\RealView -I..\..\uCOS-III\uC-LIB\Ports\ARM-Cortex-M4\RealView -I..\..\uCOS-III\uCOS-III\Ports\ARM-Cortex-M4\Generic\RealView -I..\..\User -I..\..\User\bsp -I..\..\User\bsp\inc -I..\..\User\libapp -I..\..\RL-ARM\Config -I..\..\RL-ARM\Driver -I..\..\RL-ARM\RL-RTX\inc -I..\..\User\bsp\BSP -I..\..\RL-ARM\RL-CAN -I..\..\Libraries\DSP_LIB\Include -I..\..\MODBUS\modbus\rtu -I..\..\MODBUS\BARE\port -I..\..\MODBUS\modbus\include -I..\..\User\bsp\BSP -I..\..\PLC -I..\..\Avoid -I.\RTE\_Flash -IC:\Users\49520\AppData\Local\Arm\Packs\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Users\49520\AppData\Local\Arm\Packs\Keil\STM32F4xx_DFP\2.13.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include -D__UVISION_VERSION=527 -D_RTE_ -DSTM32F407xx -DUSE_STDPERIPH_DRIVER -DSTM32F40_41xxx -D__RTX -D__FPU_USED=1 --omf_browse=.\flash\obj\bsp_button.crf ..\..\User\bsp\BSP\bsp_button.c]
THUMB
AREA ||i.IsKeyDownCancel||, CODE, READONLY, ALIGN=2
IsKeyDownCancel PROC
;;;40 uint8_t IsKeyDownOK(void) {if (InputGPIO[7] & 0x08) return 1; return 0;}
;;;41 uint8_t IsKeyDownCancel(void) {if (InputGPIO[7] & 0x04) return 1; return 0;}
000000 4804 LDR r0,|L1.20|
000002 7b80 LDRB r0,[r0,#0xe] ; InputGPIO
000004 f0000004 AND r0,r0,#4
000008 b108 CBZ r0,|L1.14|
00000a 2001 MOVS r0,#1
|L1.12|
00000c 4770 BX lr
|L1.14|
00000e 2000 MOVS r0,#0
000010 e7fc B |L1.12|
;;;42 uint8_t IsKeyDownUp(void) {if (InputGPIO[7] & 0x20) return 1; return 0;}
ENDP
000012 0000 DCW 0x0000
|L1.20|
DCD InputGPIO
AREA ||i.IsKeyDownDown||, CODE, READONLY, ALIGN=2
IsKeyDownDown PROC
;;;42 uint8_t IsKeyDownUp(void) {if (InputGPIO[7] & 0x20) return 1; return 0;}
;;;43 uint8_t IsKeyDownDown(void) {if (InputGPIO[7] & 0x10) return 1; return 0;}
000000 4804 LDR r0,|L2.20|
000002 7b80 LDRB r0,[r0,#0xe] ; InputGPIO
000004 f0000010 AND r0,r0,#0x10
000008 b108 CBZ r0,|L2.14|
00000a 2001 MOVS r0,#1
|L2.12|
00000c 4770 BX lr
|L2.14|
00000e 2000 MOVS r0,#0
000010 e7fc B |L2.12|
;;;44 uint8_t IsKeyDownLeft(void) {if (InputGPIO[7] & 0x02) return 1; return 0;}
ENDP
000012 0000 DCW 0x0000
|L2.20|
DCD InputGPIO
AREA ||i.IsKeyDownLeft||, CODE, READONLY, ALIGN=2
IsKeyDownLeft PROC
;;;43 uint8_t IsKeyDownDown(void) {if (InputGPIO[7] & 0x10) return 1; return 0;}
;;;44 uint8_t IsKeyDownLeft(void) {if (InputGPIO[7] & 0x02) return 1; return 0;}
000000 4804 LDR r0,|L3.20|
000002 7b80 LDRB r0,[r0,#0xe] ; InputGPIO
000004 f0000002 AND r0,r0,#2
000008 b108 CBZ r0,|L3.14|
00000a 2001 MOVS r0,#1
|L3.12|
00000c 4770 BX lr
|L3.14|
00000e 2000 MOVS r0,#0
000010 e7fc B |L3.12|
;;;45 uint8_t IsKeyDownRight(void) {if (InputGPIO[7] & 0x01) return 1; return 0;}
ENDP
000012 0000 DCW 0x0000
|L3.20|
DCD InputGPIO
AREA ||i.IsKeyDownOK||, CODE, READONLY, ALIGN=2
IsKeyDownOK PROC
;;;39 extern unsigned short InputGPIO[];
;;;40 uint8_t IsKeyDownOK(void) {if (InputGPIO[7] & 0x08) return 1; return 0;}
000000 4804 LDR r0,|L4.20|
000002 7b80 LDRB r0,[r0,#0xe] ; InputGPIO
000004 f0000008 AND r0,r0,#8
000008 b108 CBZ r0,|L4.14|
00000a 2001 MOVS r0,#1
|L4.12|
00000c 4770 BX lr
|L4.14|
00000e 2000 MOVS r0,#0
000010 e7fc B |L4.12|
;;;41 uint8_t IsKeyDownCancel(void) {if (InputGPIO[7] & 0x04) return 1; return 0;}
ENDP
000012 0000 DCW 0x0000
|L4.20|
DCD InputGPIO
AREA ||i.IsKeyDownRight||, CODE, READONLY, ALIGN=2
IsKeyDownRight PROC
;;;44 uint8_t IsKeyDownLeft(void) {if (InputGPIO[7] & 0x02) return 1; return 0;}
;;;45 uint8_t IsKeyDownRight(void) {if (InputGPIO[7] & 0x01) return 1; return 0;}
000000 4804 LDR r0,|L5.20|
000002 7b80 LDRB r0,[r0,#0xe] ; InputGPIO
000004 f0000001 AND r0,r0,#1
000008 b108 CBZ r0,|L5.14|
00000a 2001 MOVS r0,#1
|L5.12|
00000c 4770 BX lr
|L5.14|
00000e 2000 MOVS r0,#0
000010 e7fc B |L5.12|
;;;46
ENDP
000012 0000 DCW 0x0000
|L5.20|
DCD InputGPIO
AREA ||i.IsKeyDownUp||, CODE, READONLY, ALIGN=2
IsKeyDownUp PROC
;;;41 uint8_t IsKeyDownCancel(void) {if (InputGPIO[7] & 0x04) return 1; return 0;}
;;;42 uint8_t IsKeyDownUp(void) {if (InputGPIO[7] & 0x20) return 1; return 0;}
000000 4804 LDR r0,|L6.20|
000002 7b80 LDRB r0,[r0,#0xe] ; InputGPIO
000004 f0000020 AND r0,r0,#0x20
000008 b108 CBZ r0,|L6.14|
00000a 2001 MOVS r0,#1
|L6.12|
00000c 4770 BX lr
|L6.14|
00000e 2000 MOVS r0,#0
000010 e7fc B |L6.12|
;;;43 uint8_t IsKeyDownDown(void) {if (InputGPIO[7] & 0x10) return 1; return 0;}
ENDP
000012 0000 DCW 0x0000
|L6.20|
DCD InputGPIO
AREA ||i.bsp_DetectButton||, CODE, READONLY, ALIGN=1
bsp_DetectButton PROC
;;;258 */
;;;259 static void bsp_DetectButton(BUTTON_T *_pBtn)
000000 b510 PUSH {r4,lr}
;;;260 {
000002 4604 MOV r4,r0
;;;261 /* 如果没有初始化按键函数,则报错
;;;262 if (_pBtn->IsKeyDownFunc == 0)
;;;263 {
;;;264 printf("Fault : DetectButton(), _pBtn->IsKeyDownFunc undefine");
;;;265 }
;;;266 */
;;;267
;;;268 if (_pBtn->IsKeyDownFunc())
000004 6820 LDR r0,[r4,#0]
000006 4780 BLX r0
000008 2800 CMP r0,#0
00000a d03b BEQ |L7.132|
;;;269 {
;;;270 if (_pBtn->Count < _pBtn->FilterTime)
00000c 7920 LDRB r0,[r4,#4]
00000e 7961 LDRB r1,[r4,#5]
000010 4288 CMP r0,r1
000012 da02 BGE |L7.26|
;;;271 {
;;;272 _pBtn->Count = _pBtn->FilterTime;
000014 7960 LDRB r0,[r4,#5]
000016 7120 STRB r0,[r4,#4]
000018 e04f B |L7.186|
|L7.26|
;;;273 }
;;;274 else if(_pBtn->Count < 2 * _pBtn->FilterTime)
00001a 7920 LDRB r0,[r4,#4]
00001c 7961 LDRB r1,[r4,#5]
00001e 0049 LSLS r1,r1,#1
000020 4288 CMP r0,r1
000022 da03 BGE |L7.44|
;;;275 {
;;;276 _pBtn->Count++;
000024 7920 LDRB r0,[r4,#4]
000026 1c40 ADDS r0,r0,#1
000028 7120 STRB r0,[r4,#4]
00002a e046 B |L7.186|
|L7.44|
;;;277 }
;;;278 else
;;;279 {
;;;280 if (_pBtn->State == 0)
00002c 7aa0 LDRB r0,[r4,#0xa]
00002e b938 CBNZ r0,|L7.64|
;;;281 {
;;;282 _pBtn->State = 1;
000030 2001 MOVS r0,#1
000032 72a0 STRB r0,[r4,#0xa]
;;;283
;;;284 /* 发送按钮按下的消息 */
;;;285 if (_pBtn->KeyCodeDown > 0)
000034 7b20 LDRB r0,[r4,#0xc]
000036 2800 CMP r0,#0
000038 dd02 BLE |L7.64|
;;;286 {
;;;287 /* 键值放入按键FIFO */
;;;288 bsp_PutKey(_pBtn->KeyCodeDown);
00003a 7b20 LDRB r0,[r4,#0xc]
00003c f7fffffe BL bsp_PutKey
|L7.64|
;;;289 }
;;;290 }
;;;291
;;;292 if (_pBtn->LongTime > 0)
000040 8920 LDRH r0,[r4,#8]
000042 2800 CMP r0,#0
000044 dd39 BLE |L7.186|
;;;293 {
;;;294 if (_pBtn->LongCount < _pBtn->LongTime)
000046 88e0 LDRH r0,[r4,#6]
000048 8921 LDRH r1,[r4,#8]
00004a 4288 CMP r0,r1
00004c da0a BGE |L7.100|
;;;295 {
;;;296 /* 发送按钮持续按下的消息 */
;;;297 if (++_pBtn->LongCount == _pBtn->LongTime)
00004e 88e0 LDRH r0,[r4,#6]
000050 1c40 ADDS r0,r0,#1
000052 b280 UXTH r0,r0
000054 80e0 STRH r0,[r4,#6]
000056 8921 LDRH r1,[r4,#8]
000058 4288 CMP r0,r1
00005a d12e BNE |L7.186|
;;;298 {
;;;299 /* 键值放入按键FIFO */
;;;300 bsp_PutKey(_pBtn->KeyCodeLong);
00005c 7b60 LDRB r0,[r4,#0xd]
00005e f7fffffe BL bsp_PutKey
000062 e02a B |L7.186|
|L7.100|
;;;301 }
;;;302 }
;;;303 else
;;;304 {
;;;305 if (_pBtn->RepeatSpeed > 0)
000064 7ba0 LDRB r0,[r4,#0xe]
000066 2800 CMP r0,#0
000068 dd27 BLE |L7.186|
;;;306 {
;;;307 if (++_pBtn->RepeatCount >= _pBtn->RepeatSpeed)
00006a 7be0 LDRB r0,[r4,#0xf]
00006c 1c40 ADDS r0,r0,#1
00006e b2c0 UXTB r0,r0
000070 73e0 STRB r0,[r4,#0xf]
000072 7ba1 LDRB r1,[r4,#0xe]
000074 4288 CMP r0,r1
000076 db20 BLT |L7.186|
;;;308 {
;;;309 _pBtn->RepeatCount = 0;
000078 2000 MOVS r0,#0
00007a 73e0 STRB r0,[r4,#0xf]
;;;310 /* 常按键后,每隔10ms发送1个按键 */
;;;311 bsp_PutKey(_pBtn->KeyCodeDown);
00007c 7b20 LDRB r0,[r4,#0xc]
00007e f7fffffe BL bsp_PutKey
000082 e01a B |L7.186|
|L7.132|
;;;312 }
;;;313 }
;;;314 }
;;;315 }
;;;316 }
;;;317 }
;;;318 else
;;;319 {
;;;320 if(_pBtn->Count > _pBtn->FilterTime)
000084 7920 LDRB r0,[r4,#4]
000086 7961 LDRB r1,[r4,#5]
000088 4288 CMP r0,r1
00008a dd02 BLE |L7.146|
;;;321 {
;;;322 _pBtn->Count = _pBtn->FilterTime;
00008c 7960 LDRB r0,[r4,#5]
00008e 7120 STRB r0,[r4,#4]
000090 e010 B |L7.180|
|L7.146|
;;;323 }
;;;324 else if(_pBtn->Count != 0)
000092 7920 LDRB r0,[r4,#4]
000094 b118 CBZ r0,|L7.158|
;;;325 {
;;;326 _pBtn->Count--;
000096 7920 LDRB r0,[r4,#4]
000098 1e40 SUBS r0,r0,#1
00009a 7120 STRB r0,[r4,#4]
00009c e00a B |L7.180|
|L7.158|
;;;327 }
;;;328 else
;;;329 {
;;;330 if (_pBtn->State == 1)
00009e 7aa0 LDRB r0,[r4,#0xa]
0000a0 2801 CMP r0,#1
0000a2 d107 BNE |L7.180|
;;;331 {
;;;332 _pBtn->State = 0;
0000a4 2000 MOVS r0,#0
0000a6 72a0 STRB r0,[r4,#0xa]
;;;333
;;;334 /* 发送按钮弹起的消息 */
;;;335 if (_pBtn->KeyCodeUp > 0)
0000a8 7ae0 LDRB r0,[r4,#0xb]
0000aa 2800 CMP r0,#0
0000ac dd02 BLE |L7.180|
;;;336 {
;;;337 /* 键值放入按键FIFO */
;;;338 bsp_PutKey(_pBtn->KeyCodeUp);
0000ae 7ae0 LDRB r0,[r4,#0xb]
0000b0 f7fffffe BL bsp_PutKey
|L7.180|
;;;339 }
;;;340 }
;;;341 }
;;;342
;;;343 _pBtn->LongCount = 0;
0000b4 2000 MOVS r0,#0
0000b6 80e0 STRH r0,[r4,#6]
;;;344 _pBtn->RepeatCount = 0;
0000b8 73e0 STRB r0,[r4,#0xf]
|L7.186|
;;;345 }
;;;346 }
0000ba bd10 POP {r4,pc}
;;;347
ENDP
AREA ||i.bsp_GetKey||, CODE, READONLY, ALIGN=2
bsp_GetKey PROC
;;;86 */
;;;87 uint8_t bsp_GetKey(void)
000000 480b LDR r0,|L8.48|
;;;88 {
;;;89 uint8_t ret;
;;;90
;;;91 if (s_Key.Read == s_Key.Write)
000002 7d00 LDRB r0,[r0,#0x14] ; s_Key
000004 4a0a LDR r2,|L8.48|
000006 7d52 LDRB r2,[r2,#0x15] ; s_Key
000008 4290 CMP r0,r2
00000a d101 BNE |L8.16|
;;;92 {
;;;93 return KEY_NONE;
00000c 2000 MOVS r0,#0
|L8.14|
;;;94 }
;;;95 else
;;;96 {
;;;97 ret = s_Key.Buf[s_Key.Read];
;;;98
;;;99 if (++s_Key.Read >= KEY_FIFO_SIZE)
;;;100 {
;;;101 s_Key.Read = 0;
;;;102 }
;;;103 return ret;
;;;104 }
;;;105 }
00000e 4770 BX lr
|L8.16|
000010 4807 LDR r0,|L8.48|
000012 7d00 LDRB r0,[r0,#0x14] ;97 ; s_Key
000014 4a06 LDR r2,|L8.48|
000016 5c11 LDRB r1,[r2,r0] ;97
000018 4610 MOV r0,r2 ;99
00001a 7d00 LDRB r0,[r0,#0x14] ;99 ; s_Key
00001c 1c40 ADDS r0,r0,#1 ;99
00001e b2c0 UXTB r0,r0 ;99
000020 7510 STRB r0,[r2,#0x14] ;99
000022 2814 CMP r0,#0x14 ;99
000024 db01 BLT |L8.42|
000026 2000 MOVS r0,#0 ;101
000028 7510 STRB r0,[r2,#0x14] ;101
|L8.42|
00002a 4608 MOV r0,r1 ;103
00002c e7ef B |L8.14|
;;;106
ENDP
00002e 0000 DCW 0x0000
|L8.48|
DCD s_Key
AREA ||i.bsp_InitButton||, CODE, READONLY, ALIGN=1
bsp_InitButton PROC
;;;54 */
;;;55 void bsp_InitButton(void)
000000 b510 PUSH {r4,lr}
;;;56 {
;;;57 bsp_InitButtonVar(); /* 初始化按键变量 */
000002 f7fffffe BL bsp_InitButtonVar
;;;58 bsp_InitButtonHard(); /* 初始化按键硬件 */
000006 f7fffffe BL bsp_InitButtonHard
;;;59 }
00000a bd10 POP {r4,pc}
;;;60
ENDP
AREA ||i.bsp_InitButtonHard||, CODE, READONLY, ALIGN=1
bsp_InitButtonHard PROC
;;;156 */
;;;157 static void bsp_InitButtonHard(void)
000000 4770 BX lr
;;;158 {
;;;159
;;;160 }
;;;161
ENDP
AREA ||i.bsp_InitButtonVar||, CODE, READONLY, ALIGN=2
bsp_InitButtonVar PROC
;;;170 */
;;;171 static void bsp_InitButtonVar(void)
000000 2000 MOVS r0,#0
;;;172 {
;;;173
;;;174 /* 对按键FIFO读写指针清零 */
;;;175 s_Key.Read = 0;
000002 494f LDR r1,|L11.320|
000004 7508 STRB r0,[r1,#0x14]
;;;176 s_Key.Write = 0;
000006 7548 STRB r0,[r1,#0x15]
;;;177
;;;178 /* 初始化OK按键变量,支持按下、弹起、长按 */
;;;179 s_BtnOK.IsKeyDownFunc = IsKeyDownOK; /* 判断按键按下的函数 */
000008 484e LDR r0,|L11.324|
00000a 494f LDR r1,|L11.328|
00000c 6008 STR r0,[r1,#0] ; s_BtnOK
;;;180 s_BtnOK.FilterTime = BUTTON_FILTER_TIME; /* 按键滤波时间 */
00000e 2005 MOVS r0,#5
000010 7148 STRB r0,[r1,#5]
;;;181 s_BtnOK.LongTime = BUTTON_LONG_TIME; /* 长按时间 */
000012 2064 MOVS r0,#0x64
000014 8108 STRH r0,[r1,#8]
;;;182 s_BtnOK.Count = s_BtnOK.FilterTime / 2; /* 计数器设置为滤波时间的一半 */
000016 7948 LDRB r0,[r1,#5] ; s_BtnOK
000018 eb0071d0 ADD r1,r0,r0,LSR #31
00001c 1049 ASRS r1,r1,#1
00001e 4a4a LDR r2,|L11.328|
000020 7111 STRB r1,[r2,#4]
;;;183 s_BtnOK.State = 0; /* 按键缺省状态,0为未按下 */
000022 2000 MOVS r0,#0
000024 4611 MOV r1,r2
000026 7288 STRB r0,[r1,#0xa]
;;;184 s_BtnOK.KeyCodeDown = KEY_DOWN_OK; /* 按键按下的键值代码 */
000028 2001 MOVS r0,#1
00002a 7308 STRB r0,[r1,#0xc]
;;;185 s_BtnOK.KeyCodeUp = KEY_UP_OK; /* 按键弹起的键值代码 */
00002c 2002 MOVS r0,#2
00002e 72c8 STRB r0,[r1,#0xb]
;;;186 s_BtnOK.KeyCodeLong = KEY_LONG_OK; /* 按键被持续按下的键值代码 */
000030 2003 MOVS r0,#3
000032 7348 STRB r0,[r1,#0xd]
;;;187 s_BtnOK.RepeatSpeed = 0; /* 按键连发的速度,0表示不支持连发 */
000034 2000 MOVS r0,#0
000036 7388 STRB r0,[r1,#0xe]
;;;188 s_BtnOK.RepeatCount = 0; /* 连发计数器 */
000038 73c8 STRB r0,[r1,#0xf]
;;;189
;;;190 /* 初始化Left按键变量,支持按下 */
;;;191 s_BtnLeft.IsKeyDownFunc = IsKeyDownLeft; /* 判断按键按下的函数 */
00003a 4844 LDR r0,|L11.332|
00003c 4944 LDR r1,|L11.336|
00003e 6008 STR r0,[r1,#0] ; s_BtnLeft
;;;192 s_BtnLeft.FilterTime = BUTTON_FILTER_TIME; /* 按键滤波时间 */
000040 2005 MOVS r0,#5
000042 7148 STRB r0,[r1,#5]
;;;193 s_BtnLeft.LongTime = BUTTON_LONG_TIME; /* 长按时间 */
000044 2064 MOVS r0,#0x64
000046 8108 STRH r0,[r1,#8]
;;;194 s_BtnLeft.Count = s_BtnLeft.FilterTime / 2; /* 计数器设置为滤波时间的一半 */
000048 7948 LDRB r0,[r1,#5] ; s_BtnLeft
00004a eb0071d0 ADD r1,r0,r0,LSR #31
00004e 1049 ASRS r1,r1,#1
000050 4a3f LDR r2,|L11.336|
000052 7111 STRB r1,[r2,#4]
;;;195 s_BtnLeft.State = 0; /* 按键缺省状态,0为未按下 */
000054 2000 MOVS r0,#0
000056 4611 MOV r1,r2
000058 7288 STRB r0,[r1,#0xa]
;;;196 s_BtnLeft.KeyCodeDown = KEY_DOWN_LEFT; /* 按键按下的键值代码 */
00005a 200d MOVS r0,#0xd
00005c 7308 STRB r0,[r1,#0xc]
;;;197 s_BtnLeft.KeyCodeUp = KEY_UP_LEFT; /* 按键弹起的键值代码,0表示不检测 */
00005e 200e MOVS r0,#0xe
000060 72c8 STRB r0,[r1,#0xb]
;;;198 s_BtnLeft.KeyCodeLong = KEY_LONG_LEFT; /* 按键被持续按下的键值代码,0表示不检测 */
000062 200f MOVS r0,#0xf
000064 7348 STRB r0,[r1,#0xd]
;;;199 s_BtnLeft.RepeatSpeed = 0; /* 按键连发的速度,0表示不支持连发 */
000066 2000 MOVS r0,#0
000068 7388 STRB r0,[r1,#0xe]
;;;200 s_BtnLeft.RepeatCount = 0; /* 连发计数器 */
00006a 73c8 STRB r0,[r1,#0xf]
;;;201
;;;202 /* 初始化Right按键变量,支持按下 */
;;;203 s_BtnRight.IsKeyDownFunc = IsKeyDownRight; /* 判断按键按下的函数 */
00006c 4839 LDR r0,|L11.340|
00006e 493a LDR r1,|L11.344|
000070 6008 STR r0,[r1,#0] ; s_BtnRight
;;;204 s_BtnRight.FilterTime = BUTTON_FILTER_TIME; /* 按键滤波时间 */
000072 2005 MOVS r0,#5
000074 7148 STRB r0,[r1,#5]
;;;205 s_BtnRight.LongTime = BUTTON_LONG_TIME; /* 长按时间, 0表示不检测 */
000076 2064 MOVS r0,#0x64
000078 8108 STRH r0,[r1,#8]
;;;206 s_BtnRight.Count = s_BtnRight.FilterTime / 2; /* 计数器设置为滤波时间的一半 */
00007a 7948 LDRB r0,[r1,#5] ; s_BtnRight
00007c eb0071d0 ADD r1,r0,r0,LSR #31
000080 1049 ASRS r1,r1,#1
000082 4a35 LDR r2,|L11.344|
000084 7111 STRB r1,[r2,#4]
;;;207 s_BtnRight.State = 0; /* 按键缺省状态,0为未按下 */
000086 2000 MOVS r0,#0
000088 4611 MOV r1,r2
00008a 7288 STRB r0,[r1,#0xa]
;;;208 s_BtnRight.KeyCodeDown = KEY_DOWN_RIGHT; /* 按键按下的键值代码 */
00008c 2010 MOVS r0,#0x10
00008e 7308 STRB r0,[r1,#0xc]
;;;209 s_BtnRight.KeyCodeUp = KEY_UP_RIGHT; /* 按键弹起的键值代码 */
000090 2011 MOVS r0,#0x11
000092 72c8 STRB r0,[r1,#0xb]
;;;210 s_BtnRight.KeyCodeLong = KEY_LONG_RIGHT; /* 按键被持续按下的键值代码 */
000094 2012 MOVS r0,#0x12
000096 7348 STRB r0,[r1,#0xd]
;;;211 s_BtnRight.RepeatSpeed = 2; /* 按键连发的速度,0表示不支持连发 */
000098 2002 MOVS r0,#2
00009a 7388 STRB r0,[r1,#0xe]
;;;212 s_BtnRight.RepeatCount = 0; /* 连发计数器 */
00009c 2000 MOVS r0,#0
00009e 73c8 STRB r0,[r1,#0xf]
;;;213
;;;214 /* 初始化UP按键变量,支持按下 */
;;;215 s_BtnUp.IsKeyDownFunc = IsKeyDownUp; /* 判断按键按下的函数 */
0000a0 482e LDR r0,|L11.348|
0000a2 492f LDR r1,|L11.352|
0000a4 6008 STR r0,[r1,#0] ; s_BtnUp
;;;216 s_BtnUp.FilterTime = BUTTON_FILTER_TIME; /* 按键滤波时间 */
0000a6 2005 MOVS r0,#5
0000a8 7148 STRB r0,[r1,#5]
;;;217 s_BtnUp.LongTime = BUTTON_LONG_TIME; /* 长按时间 */
0000aa 2064 MOVS r0,#0x64
0000ac 8108 STRH r0,[r1,#8]
;;;218 s_BtnUp.Count = s_BtnUp.FilterTime / 2; /* 计数器设置为滤波时间的一半 */
0000ae 7948 LDRB r0,[r1,#5] ; s_BtnUp
0000b0 eb0071d0 ADD r1,r0,r0,LSR #31
0000b4 1049 ASRS r1,r1,#1
0000b6 4a2a LDR r2,|L11.352|
0000b8 7111 STRB r1,[r2,#4]
;;;219 s_BtnUp.State = 0; /* 按键缺省状态,0为未按下 */
0000ba 2000 MOVS r0,#0
0000bc 4611 MOV r1,r2
0000be 7288 STRB r0,[r1,#0xa]
;;;220 s_BtnUp.KeyCodeDown = KEY_DOWN_UP; /* 按键按下的键值代码 */
0000c0 2007 MOVS r0,#7
0000c2 7308 STRB r0,[r1,#0xc]
;;;221 s_BtnUp.KeyCodeUp = KEY_UP_UP; /* 按键弹起的键值代码,0表示不检测 */
0000c4 2008 MOVS r0,#8
0000c6 72c8 STRB r0,[r1,#0xb]
;;;222 s_BtnUp.KeyCodeLong = KEY_LONG_UP; /* 按键被持续按下的键值代码,0表示不检测 */
0000c8 2009 MOVS r0,#9
0000ca 7348 STRB r0,[r1,#0xd]
;;;223 s_BtnUp.RepeatSpeed = 2; /* 按键连发的速度,0表示不支持连发 */
0000cc 2002 MOVS r0,#2
0000ce 7388 STRB r0,[r1,#0xe]
;;;224 s_BtnUp.RepeatCount = 0; /* 连发计数器 */
0000d0 2000 MOVS r0,#0
0000d2 73c8 STRB r0,[r1,#0xf]
;;;225
;;;226 /* 初始化DOWN按键变量,支持按下、连发(周期10ms) */
;;;227 s_BtnDown.IsKeyDownFunc = IsKeyDownDown; /* 判断按键按下的函数 */
0000d4 4823 LDR r0,|L11.356|
0000d6 4924 LDR r1,|L11.360|
0000d8 6008 STR r0,[r1,#0] ; s_BtnDown
;;;228 s_BtnDown.FilterTime = BUTTON_FILTER_TIME; /* 按键滤波时间 */
0000da 2005 MOVS r0,#5
0000dc 7148 STRB r0,[r1,#5]
;;;229 s_BtnDown.LongTime = BUTTON_LONG_TIME; /* 长按时间 */
0000de 2064 MOVS r0,#0x64
0000e0 8108 STRH r0,[r1,#8]
;;;230 s_BtnDown.Count = s_BtnDown.FilterTime / 2; /* 计数器设置为滤波时间的一半 */
0000e2 7948 LDRB r0,[r1,#5] ; s_BtnDown
0000e4 eb0071d0 ADD r1,r0,r0,LSR #31
0000e8 1049 ASRS r1,r1,#1
0000ea 4a1f LDR r2,|L11.360|
0000ec 7111 STRB r1,[r2,#4]
;;;231 s_BtnDown.State = 0; /* 按键缺省状态,0为未按下 */
0000ee 2000 MOVS r0,#0
0000f0 4611 MOV r1,r2
0000f2 7288 STRB r0,[r1,#0xa]
;;;232 s_BtnDown.KeyCodeDown = KEY_DOWN_DOWN; /* 按键按下的键值代码 */
0000f4 200a MOVS r0,#0xa
0000f6 7308 STRB r0,[r1,#0xc]
;;;233 s_BtnDown.KeyCodeUp = KEY_UP_DOWN; /* 按键弹起的键值代码,0表示不检测 */
0000f8 200b MOVS r0,#0xb
0000fa 72c8 STRB r0,[r1,#0xb]
;;;234 s_BtnDown.KeyCodeLong = KEY_LONG_DOWN; /* 按键被持续按下的键值代码,0表示不检测 */
0000fc 200c MOVS r0,#0xc
0000fe 7348 STRB r0,[r1,#0xd]
;;;235 s_BtnDown.RepeatSpeed = 2; /* 按键连发的速度,0表示不支持连发 */
000100 2002 MOVS r0,#2
000102 7388 STRB r0,[r1,#0xe]
;;;236 s_BtnDown.RepeatCount = 0; /* 连发计数器 */
000104 2000 MOVS r0,#0
000106 73c8 STRB r0,[r1,#0xf]
;;;237
;;;238 /* 初始化DOWN按键变量,支持按下、连发(周期10ms) */
;;;239 s_BtnCancel.IsKeyDownFunc = IsKeyDownCancel; /* 判断按键按下的函数 */
000108 4818 LDR r0,|L11.364|
00010a 4919 LDR r1,|L11.368|
00010c 6008 STR r0,[r1,#0] ; s_BtnCancel
;;;240 s_BtnCancel.FilterTime = BUTTON_FILTER_TIME; /* 按键滤波时间 */
00010e 2005 MOVS r0,#5
000110 7148 STRB r0,[r1,#5]
;;;241 s_BtnCancel.LongTime = BUTTON_LONG_TIME; /* 长按时间 */
000112 2064 MOVS r0,#0x64
000114 8108 STRH r0,[r1,#8]
;;;242 s_BtnCancel.Count = s_BtnCancel.FilterTime / 2; /* 计数器设置为滤波时间的一半 */
000116 7948 LDRB r0,[r1,#5] ; s_BtnCancel
000118 eb0071d0 ADD r1,r0,r0,LSR #31
00011c 1049 ASRS r1,r1,#1
00011e 4a14 LDR r2,|L11.368|
000120 7111 STRB r1,[r2,#4]
;;;243 s_BtnCancel.State = 0; /* 按键缺省状态,0为未按下 */
000122 2000 MOVS r0,#0
000124 4611 MOV r1,r2
000126 7288 STRB r0,[r1,#0xa]
;;;244 s_BtnCancel.KeyCodeDown = KEY_DOWN_CANCEL; /* 按键按下的键值代码 */
000128 2004 MOVS r0,#4
00012a 7308 STRB r0,[r1,#0xc]
;;;245 s_BtnCancel.KeyCodeUp = KEY_UP_CANCEL; /* 按键弹起的键值代码,0表示不检测 */
00012c 2005 MOVS r0,#5
00012e 72c8 STRB r0,[r1,#0xb]
;;;246 s_BtnCancel.KeyCodeLong = KEY_LONG_CANCEL; /* 按键被持续按下的键值代码,0表示不检测 */
000130 2006 MOVS r0,#6
000132 7348 STRB r0,[r1,#0xd]
;;;247 s_BtnCancel.RepeatSpeed = 2; /* 按键连发的速度,0表示不支持连发 */
000134 2002 MOVS r0,#2
000136 7388 STRB r0,[r1,#0xe]
;;;248 s_BtnCancel.RepeatCount = 0; /* 连发计数器 */
000138 2000 MOVS r0,#0
00013a 73c8 STRB r0,[r1,#0xf]
;;;249 }
00013c 4770 BX lr
;;;250
ENDP
00013e 0000 DCW 0x0000
|L11.320|
DCD s_Key
|L11.324|
DCD IsKeyDownOK
|L11.328|
DCD s_BtnOK
|L11.332|
DCD IsKeyDownLeft
|L11.336|
DCD s_BtnLeft
|L11.340|
DCD IsKeyDownRight
|L11.344|
DCD s_BtnRight
|L11.348|
DCD IsKeyDownUp
|L11.352|
DCD s_BtnUp
|L11.356|
DCD IsKeyDownDown
|L11.360|
DCD s_BtnDown
|L11.364|
DCD IsKeyDownCancel
|L11.368|
DCD s_BtnCancel
AREA ||i.bsp_KeyPro||, CODE, READONLY, ALIGN=2
bsp_KeyPro PROC
;;;355 */
;;;356 void bsp_KeyPro(void)
000000 b510 PUSH {r4,lr}
;;;357 {
;;;358 bsp_DetectButton(&s_BtnOK); /* OK 键 */
000002 4809 LDR r0,|L12.40|
000004 f7fffffe BL bsp_DetectButton
;;;359 bsp_DetectButton(&s_BtnCancel); /* Cancel 键 */
000008 4808 LDR r0,|L12.44|
00000a f7fffffe BL bsp_DetectButton
;;;360 bsp_DetectButton(&s_BtnUp); /* UP 键 */
00000e 4808 LDR r0,|L12.48|
000010 f7fffffe BL bsp_DetectButton
;;;361 bsp_DetectButton(&s_BtnDown); /* DOWN 键 */
000014 4807 LDR r0,|L12.52|
000016 f7fffffe BL bsp_DetectButton
;;;362 bsp_DetectButton(&s_BtnLeft); /* Left 键 */
00001a 4807 LDR r0,|L12.56|
00001c f7fffffe BL bsp_DetectButton
;;;363 bsp_DetectButton(&s_BtnRight); /* Right 键 */
000020 4806 LDR r0,|L12.60|
000022 f7fffffe BL bsp_DetectButton
;;;364 }
000026 bd10 POP {r4,pc}
ENDP
|L12.40|
DCD s_BtnOK
|L12.44|
DCD s_BtnCancel
|L12.48|
DCD s_BtnUp
|L12.52|
DCD s_BtnDown
|L12.56|
DCD s_BtnLeft
|L12.60|
DCD s_BtnRight
AREA ||i.bsp_KeyState||, CODE, READONLY, ALIGN=2
bsp_KeyState PROC
;;;114 */
;;;115 uint8_t bsp_KeyState(uint8_t _ucKeyID)
000000 4601 MOV r1,r0
;;;116 {
;;;117 uint8_t ucState = 0;
000002 2000 MOVS r0,#0
;;;118
;;;119 switch (_ucKeyID)
000004 2906 CMP r1,#6
000006 d216 BCS |L13.54|
000008 e8dff001 TBB [pc,r1]
00000c 03060f12 DCB 0x03,0x06,0x0f,0x12
000010 090c DCB 0x09,0x0c
;;;120 {
;;;121 case KID_OK:
;;;122 ucState = s_BtnOK.State;
000012 4a0a LDR r2,|L13.60|
000014 7a90 LDRB r0,[r2,#0xa] ; s_BtnOK
;;;123 break;
000016 e00e B |L13.54|
;;;124
;;;125 case KID_CANCEL:
;;;126 ucState = s_BtnCancel.State;
000018 4a09 LDR r2,|L13.64|
00001a 7a90 LDRB r0,[r2,#0xa] ; s_BtnCancel
;;;127 break;
00001c e00b B |L13.54|
;;;128
;;;129 case KID_UP:
;;;130 ucState = s_BtnUp.State;
00001e 4a09 LDR r2,|L13.68|
000020 7a90 LDRB r0,[r2,#0xa] ; s_BtnUp
;;;131 break;
000022 e008 B |L13.54|
;;;132
;;;133 case KID_DOWN:
;;;134 ucState = s_BtnUp.State;
000024 4a07 LDR r2,|L13.68|
000026 7a90 LDRB r0,[r2,#0xa] ; s_BtnUp
;;;135 break;
000028 e005 B |L13.54|
;;;136
;;;137 case KID_LEFT:
;;;138 ucState = s_BtnLeft.State;
00002a 4a07 LDR r2,|L13.72|
00002c 7a90 LDRB r0,[r2,#0xa] ; s_BtnLeft
;;;139 break;
00002e e002 B |L13.54|
;;;140
;;;141 case KID_RIGHT:
;;;142 ucState = s_BtnRight.State;
000030 4a06 LDR r2,|L13.76|
000032 7a90 LDRB r0,[r2,#0xa] ; s_BtnRight
;;;143 break;
000034 bf00 NOP
|L13.54|
000036 bf00 NOP ;123
;;;144 }
;;;145
;;;146 return ucState;
;;;147 }
000038 4770 BX lr
;;;148
ENDP
00003a 0000 DCW 0x0000
|L13.60|
DCD s_BtnOK
|L13.64|
DCD s_BtnCancel
|L13.68|
DCD s_BtnUp
|L13.72|
DCD s_BtnLeft
|L13.76|
DCD s_BtnRight
AREA ||i.bsp_PutKey||, CODE, READONLY, ALIGN=2
bsp_PutKey PROC
;;;68 */
;;;69 void bsp_PutKey(uint8_t _KeyCode)
000000 4906 LDR r1,|L14.28|
;;;70 {
;;;71 s_Key.Buf[s_Key.Write] = _KeyCode;
000002 7d49 LDRB r1,[r1,#0x15] ; s_Key
000004 4a05 LDR r2,|L14.28|
000006 5450 STRB r0,[r2,r1]
;;;72
;;;73 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 |L14.26|
;;;74 {
;;;75 s_Key.Write = 0;
000016 2100 MOVS r1,#0
000018 7551 STRB r1,[r2,#0x15]
|L14.26|
;;;76 }
;;;77 }
00001a 4770 BX lr
;;;78
ENDP
|L14.28|
DCD s_Key
AREA ||.bss||, DATA, NOINIT, ALIGN=2
s_BtnOK
% 16
s_BtnCancel
% 16
s_BtnLeft
% 16
s_BtnRight
% 16
s_BtnUp
% 16
s_BtnDown
% 16
s_Key
% 22
;*** Start embedded assembler ***
#line 1 "..\\..\\User\\bsp\\BSP\\bsp_button.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___12_bsp_button_c_cb2513db____REV16|
#line 129 "..\\..\\Libraries\\CMSIS\\Include\\core_cmInstr.h"
|__asm___12_bsp_button_c_cb2513db____REV16| PROC
#line 130
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___12_bsp_button_c_cb2513db____REVSH|
#line 144
|__asm___12_bsp_button_c_cb2513db____REVSH| PROC
#line 145
revsh r0, r0
bx lr
ENDP
AREA ||.rrx_text||, CODE
THUMB
EXPORT |__asm___12_bsp_button_c_cb2513db____RRX|
#line 300
|__asm___12_bsp_button_c_cb2513db____RRX| PROC
#line 301
rrx r0, r0
bx lr
ENDP
;*** End embedded assembler ***