-
Notifications
You must be signed in to change notification settings - Fork 1
/
vehicle_8c.html
881 lines (850 loc) · 76.4 KB
/
vehicle_8c.html
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>Vehicle: vehicle.c 文件参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">Vehicle
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.6 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>首页</span></a></li>
<li><a href="pages.html"><span>相关页面</span></a></li>
<li><a href="annotated.html"><span>结构体</span></a></li>
<li class="current"><a href="files.html"><span>文件</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>文件列表</span></a></li>
<li><a href="globals.html"><span>全局定义</span></a></li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#func-members">函数</a> |
<a href="#var-members">变量</a> </div>
<div class="headertitle">
<div class="title">vehicle.c 文件参考</div> </div>
</div><!--header-->
<div class="contents">
<p>赛车模拟控制程序源文件
<a href="#details">更多...</a></p>
<div class="textblock"><code>#include "<a class="el" href="vehicle_8h_source.html">vehicle.h</a>"</code><br/>
</div><div class="textblock"><div class="dynheader">
vehicle.c 的引用(Include)关系图:</div>
<div class="dyncontent">
<div class="center"><img src="vehicle_8c__incl.png" border="0" usemap="#vehicle_8c" alt=""/></div>
<map name="vehicle_8c" id="vehicle_8c">
<area shape="rect" id="node2" href="vehicle_8h.html" title="赛车模拟控制程序头文件 " alt="" coords="325,80,397,107"/></map>
</div>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
函数</h2></td></tr>
<tr class="memitem:a37b4defbf720b1dc56d488cebe140ba2"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="vehicle_8c.html#a37b4defbf720b1dc56d488cebe140ba2">VehicleInit</a> (void)</td></tr>
<tr class="memdesc:a37b4defbf720b1dc56d488cebe140ba2"><td class="mdescLeft"> </td><td class="mdescRight">赛车程序初始化函数 <a href="#a37b4defbf720b1dc56d488cebe140ba2">更多...</a><br/></td></tr>
<tr class="separator:a37b4defbf720b1dc56d488cebe140ba2"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae06b8941e180800660bab73ca89bb29c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="vehicle_8c.html#ae06b8941e180800660bab73ca89bb29c">VehicleStatusUpdate</a> (void)</td></tr>
<tr class="memdesc:ae06b8941e180800660bab73ca89bb29c"><td class="mdescLeft"> </td><td class="mdescRight">更新赛车数据 <a href="#ae06b8941e180800660bab73ca89bb29c">更多...</a><br/></td></tr>
<tr class="separator:ae06b8941e180800660bab73ca89bb29c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a36a5da33bcf4051796cd7c997bc5c896"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="vehicle_8c.html#a36a5da33bcf4051796cd7c997bc5c896">VehicleDisplays</a> (void)</td></tr>
<tr class="memdesc:a36a5da33bcf4051796cd7c997bc5c896"><td class="mdescLeft"> </td><td class="mdescRight">显示赛车状态 <a href="#a36a5da33bcf4051796cd7c997bc5c896">更多...</a><br/></td></tr>
<tr class="separator:a36a5da33bcf4051796cd7c997bc5c896"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aea5c29b708bb0d72e962b61515fc44b8"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="vehicle_8c.html#aea5c29b708bb0d72e962b61515fc44b8">DisplaySMG</a> (void)</td></tr>
<tr class="memdesc:aea5c29b708bb0d72e962b61515fc44b8"><td class="mdescLeft"> </td><td class="mdescRight">数码管显示函数 在左边两位显示当前已走圈数 <a href="#aea5c29b708bb0d72e962b61515fc44b8">更多...</a><br/></td></tr>
<tr class="separator:aea5c29b708bb0d72e962b61515fc44b8"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aaefbc0e26f31cb3185e4126702d08566"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="vehicle_8c.html#aaefbc0e26f31cb3185e4126702d08566">DisplayOneSMG</a> (int p, int num, int dot)</td></tr>
<tr class="memdesc:aaefbc0e26f31cb3185e4126702d08566"><td class="mdescLeft"> </td><td class="mdescRight">数码管显示函数 <a href="#aaefbc0e26f31cb3185e4126702d08566">更多...</a><br/></td></tr>
<tr class="separator:aaefbc0e26f31cb3185e4126702d08566"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a389b4b4f6b01f7d8b5867afaa79be8f0"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="vehicle_8c.html#a389b4b4f6b01f7d8b5867afaa79be8f0">DisplayLED</a> (int flag)</td></tr>
<tr class="memdesc:a389b4b4f6b01f7d8b5867afaa79be8f0"><td class="mdescLeft"> </td><td class="mdescRight">LED 显示函数 <a href="#a389b4b4f6b01f7d8b5867afaa79be8f0">更多...</a><br/></td></tr>
<tr class="separator:a389b4b4f6b01f7d8b5867afaa79be8f0"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a573e3a73f898d8e69dda05e56716723d"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="vehicle_8c.html#a573e3a73f898d8e69dda05e56716723d">DrawTrack</a> (void)</td></tr>
<tr class="memdesc:a573e3a73f898d8e69dda05e56716723d"><td class="mdescLeft"> </td><td class="mdescRight">绘制圆形赛道 <a href="#a573e3a73f898d8e69dda05e56716723d">更多...</a><br/></td></tr>
<tr class="separator:a573e3a73f898d8e69dda05e56716723d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a4fd900a3a7110287db68e11d1fa6d0e3"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="vehicle_8c.html#a4fd900a3a7110287db68e11d1fa6d0e3">DrawVehicle</a> (float p, COLOR c)</td></tr>
<tr class="memdesc:a4fd900a3a7110287db68e11d1fa6d0e3"><td class="mdescLeft"> </td><td class="mdescRight">绘制赛车,即一个小矩形 <a href="#a4fd900a3a7110287db68e11d1fa6d0e3">更多...</a><br/></td></tr>
<tr class="separator:a4fd900a3a7110287db68e11d1fa6d0e3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a01f7b1de24a0bfcba4d3fef6345fef99"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="vehicle_8c.html#a01f7b1de24a0bfcba4d3fef6345fef99">DrawRect</a> (void)</td></tr>
<tr class="memdesc:a01f7b1de24a0bfcba4d3fef6345fef99"><td class="mdescLeft"> </td><td class="mdescRight">绘制蓝色矩形方块 <a href="#a01f7b1de24a0bfcba4d3fef6345fef99">更多...</a><br/></td></tr>
<tr class="separator:a01f7b1de24a0bfcba4d3fef6345fef99"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a5d7d4bd8a4ae8dfde93d64d27a492463"><td class="memItemLeft" align="right" valign="top">void __irq </td><td class="memItemRight" valign="bottom"><a class="el" href="vehicle_8c.html#a5d7d4bd8a4ae8dfde93d64d27a492463">INT2_Handler</a> (void)</td></tr>
<tr class="memdesc:a5d7d4bd8a4ae8dfde93d64d27a492463"><td class="mdescLeft"> </td><td class="mdescRight">按键2中断处理函数 每按一次“档位”成员变量自增一 <a href="#a5d7d4bd8a4ae8dfde93d64d27a492463">更多...</a><br/></td></tr>
<tr class="separator:a5d7d4bd8a4ae8dfde93d64d27a492463"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a7897534f6b2cf9ec2d72af613e6c100d"><td class="memItemLeft" align="right" valign="top">void __irq </td><td class="memItemRight" valign="bottom"><a class="el" href="vehicle_8c.html#a7897534f6b2cf9ec2d72af613e6c100d">INT0_Handler</a> (void)</td></tr>
<tr class="memdesc:a7897534f6b2cf9ec2d72af613e6c100d"><td class="mdescLeft"> </td><td class="mdescRight">按键1中断处理函数 每按一次“档位”成员变量自减一 <a href="#a7897534f6b2cf9ec2d72af613e6c100d">更多...</a><br/></td></tr>
<tr class="separator:a7897534f6b2cf9ec2d72af613e6c100d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad56cd570f598052235ff7111f99c6504"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="vehicle_8c.html#ad56cd570f598052235ff7111f99c6504">delay</a> (int time)</td></tr>
<tr class="memdesc:ad56cd570f598052235ff7111f99c6504"><td class="mdescLeft"> </td><td class="mdescRight">简单的延时函数 <a href="#ad56cd570f598052235ff7111f99c6504">更多...</a><br/></td></tr>
<tr class="separator:ad56cd570f598052235ff7111f99c6504"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
变量</h2></td></tr>
<tr class="memitem:a7e67faac7eb0a26632340a79a8f0bf5f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_vehicle.html">Vehicle</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a></td></tr>
<tr class="separator:a7e67faac7eb0a26632340a79a8f0bf5f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a3e1821db0005527ac107eae37171c9d9"><td class="memItemLeft" align="right" valign="top">char </td><td class="memItemRight" valign="bottom"><a class="el" href="vehicle_8c.html#a3e1821db0005527ac107eae37171c9d9">speed</a> [10]</td></tr>
<tr class="separator:a3e1821db0005527ac107eae37171c9d9"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a804a164dbad16439f9b3259617407187"><td class="memItemLeft" align="right" valign="top">unsigned char </td><td class="memItemRight" valign="bottom"><a class="el" href="vehicle_8c.html#a804a164dbad16439f9b3259617407187">display_flag</a> = 0</td></tr>
<tr class="separator:a804a164dbad16439f9b3259617407187"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><p>赛车模拟控制程序源文件 </p>
<hr/>
<dl class="section author"><dt>作者</dt><dd>Gump, LDR </dd></dl>
<dl class="section version"><dt>版本</dt><dd>V0.1 </dd></dl>
<dl class="section date"><dt>日期</dt><dd>2019-12-08 <hr/>
</dd></dl>
</div><h2 class="groupheader">函数说明</h2>
<a class="anchor" id="a37b4defbf720b1dc56d488cebe140ba2"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void VehicleInit </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>赛车程序初始化函数 </p>
<div class="fragment"><div class="line"><a name="l00028"></a><span class="lineno"> 28</span> {</div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  <span class="comment">/* 绘制跑道背景图 */</span></div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *ptr = (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *)<a class="code" href="vehicle_8h.html#af3e41de76d0bbbc15c2d217dee630e2c">BACKGROUND_BUF</a>;</div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  ShowImage(ptr, 0, 0, 1);</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span> </div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  <span class="comment">/* 绘制跑道 */</span></div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  <a class="code" href="vehicle_8c.html#a573e3a73f898d8e69dda05e56716723d">DrawTrack</a>();</div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span> </div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  <span class="comment">/* 绘制赛车 */</span></div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  <a class="code" href="vehicle_8c.html#a4fd900a3a7110287db68e11d1fa6d0e3">DrawVehicle</a>(90, <a class="code" href="vehicle_8h.html#a687a7041f1313e7c7836ff0c79e6c083">VEHICLE_COLOR</a>);</div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span> }</div>
<div class="ttc" id="vehicle_8c_html_a4fd900a3a7110287db68e11d1fa6d0e3"><div class="ttname"><a href="vehicle_8c.html#a4fd900a3a7110287db68e11d1fa6d0e3">DrawVehicle</a></div><div class="ttdeci">void DrawVehicle(float p, COLOR c)</div><div class="ttdoc">绘制赛车,即一个小矩形 </div><div class="ttdef"><b>Definition:</b> vehicle.c:234</div></div>
<div class="ttc" id="vehicle_8h_html_a687a7041f1313e7c7836ff0c79e6c083"><div class="ttname"><a href="vehicle_8h.html#a687a7041f1313e7c7836ff0c79e6c083">VEHICLE_COLOR</a></div><div class="ttdeci">#define VEHICLE_COLOR</div><div class="ttdef"><b>Definition:</b> vehicle.h:53</div></div>
<div class="ttc" id="vehicle_8h_html_af3e41de76d0bbbc15c2d217dee630e2c"><div class="ttname"><a href="vehicle_8h.html#af3e41de76d0bbbc15c2d217dee630e2c">BACKGROUND_BUF</a></div><div class="ttdeci">#define BACKGROUND_BUF</div><div class="ttdef"><b>Definition:</b> vehicle.h:39</div></div>
<div class="ttc" id="vehicle_8c_html_a573e3a73f898d8e69dda05e56716723d"><div class="ttname"><a href="vehicle_8c.html#a573e3a73f898d8e69dda05e56716723d">DrawTrack</a></div><div class="ttdeci">void DrawTrack(void)</div><div class="ttdoc">绘制圆形赛道 </div><div class="ttdef"><b>Definition:</b> vehicle.c:204</div></div>
</div><!-- fragment -->
<p><div class="dynheader">
函数调用图:</div>
<div class="dyncontent">
<div class="center"><img src="vehicle_8c_a37b4defbf720b1dc56d488cebe140ba2_cgraph.png" border="0" usemap="#vehicle_8c_a37b4defbf720b1dc56d488cebe140ba2_cgraph" alt=""/></div>
<map name="vehicle_8c_a37b4defbf720b1dc56d488cebe140ba2_cgraph" id="vehicle_8c_a37b4defbf720b1dc56d488cebe140ba2_cgraph">
<area shape="rect" id="node2" href="vehicle_8c.html#a573e3a73f898d8e69dda05e56716723d" title="绘制圆形赛道 " alt="" coords="142,5,225,32"/><area shape="rect" id="node3" href="vehicle_8c.html#a4fd900a3a7110287db68e11d1fa6d0e3" title="绘制赛车,即一个小矩形 " alt="" coords="136,56,231,83"/></map>
</div>
</p>
<p><div class="dynheader">
这是这个函数的调用关系图:</div>
<div class="dyncontent">
<div class="center"><img src="vehicle_8c_a37b4defbf720b1dc56d488cebe140ba2_icgraph.png" border="0" usemap="#vehicle_8c_a37b4defbf720b1dc56d488cebe140ba2_icgraph" alt=""/></div>
<map name="vehicle_8c_a37b4defbf720b1dc56d488cebe140ba2_icgraph" id="vehicle_8c_a37b4defbf720b1dc56d488cebe140ba2_icgraph">
<area shape="rect" id="node2" href="main_8c.html#a840291bc02cba5474a4cb46a9b9566fe" title="程序主函数 " alt="" coords="136,5,187,32"/></map>
</div>
</p>
</div>
</div>
<a class="anchor" id="ae06b8941e180800660bab73ca89bb29c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void VehicleStatusUpdate </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>更新赛车数据 </p>
<dl class="todo"><dt><b><a class="el" href="todo.html#_todo000001">待办事项:</a></b></dt><dd>根据为赛车增加加速度属性值,使得赛车速度切换更加真实 </dd></dl>
<div class="fragment"><div class="line"><a name="l00046"></a><span class="lineno"> 46</span> {</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <span class="keyword">static</span> <span class="keywordtype">int</span> led_counter; <span class="comment">/* LED 闪烁计数器 */</span></div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> led_status = 0; <span class="comment">/* LED 当前状态 */</span></div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span> </div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="comment">/* 赛车前进 ****************************************************************/</span></div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="comment">/* 清除赛车当前位置 */</span></div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  <a class="code" href="vehicle_8c.html#a4fd900a3a7110287db68e11d1fa6d0e3">DrawVehicle</a>(<a class="code" href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a>.<a class="code" href="struct_vehicle.html#a979c2a3e7e4da4a8edc3d4b34dc8d62b">position</a>, 0xffffff);</div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span> </div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <span class="comment">// if (vehicle.speed < vehicle.gear * 10) /* 后续改为根据加速度递增 */</span></div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  <span class="comment">/* “档位”映射为“速度” */</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <a class="code" href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a>.<a class="code" href="struct_vehicle.html#a523997d5c13de311e719ab582f1de4d4">speed</a> = <a class="code" href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a>.<a class="code" href="struct_vehicle.html#a14600e2333dc129b08990be5fad320b4">gear</a> * 10;</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span> </div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  <span class="comment">/* “速度”成员变量格式化为字符串字面量 */</span></div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  sprintf(<a class="code" href="vehicle_8c.html#a3e1821db0005527ac107eae37171c9d9">speed</a>, <span class="stringliteral">"Speed: %2d"</span>, <a class="code" href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a>.<a class="code" href="struct_vehicle.html#a523997d5c13de311e719ab582f1de4d4">speed</a>);</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span> </div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  <span class="comment">/* 赛车位置前进 */</span></div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <a class="code" href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a>.<a class="code" href="struct_vehicle.html#a979c2a3e7e4da4a8edc3d4b34dc8d62b">position</a> += <a class="code" href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a>.<a class="code" href="struct_vehicle.html#a523997d5c13de311e719ab582f1de4d4">speed</a>;</div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span> </div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  <span class="comment">/* 圈数增加 ****************************************************************/</span></div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="keywordflow">if</span> (<a class="code" href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a>.<a class="code" href="struct_vehicle.html#a979c2a3e7e4da4a8edc3d4b34dc8d62b">position</a> > 360)</div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  {</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <a class="code" href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a>.<a class="code" href="struct_vehicle.html#a979c2a3e7e4da4a8edc3d4b34dc8d62b">position</a> -= 360;</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <a class="code" href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a>.<a class="code" href="struct_vehicle.html#a4f89aa17277ad83423164b9dccd8122a">laps</a>++;</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  <span class="comment">/* 每五圈就在数码管上显示当前圈数 */</span></div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <span class="keywordflow">if</span> (((<a class="code" href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a>.<a class="code" href="struct_vehicle.html#a4f89aa17277ad83423164b9dccd8122a">laps</a>) % 5) == 0)</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  {</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  <a class="code" href="vehicle_8c.html#a804a164dbad16439f9b3259617407187">display_flag</a> = 1;</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  }</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  <span class="comment">/* 只显示两位圈数 */</span></div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <span class="keywordflow">if</span> (<a class="code" href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a>.<a class="code" href="struct_vehicle.html#a4f89aa17277ad83423164b9dccd8122a">laps</a> >= 100)</div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  {</div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  <a class="code" href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a>.<a class="code" href="struct_vehicle.html#a4f89aa17277ad83423164b9dccd8122a">laps</a> -= 100;</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  }</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  }</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span> </div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  <span class="comment">/* 转换灯状态 **************************************************************/</span></div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <span class="comment">/* 计数器循环计数 */</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <span class="comment">/* 数字 3 为档位放大系数,闪烁频率与档位呈正相关 */</span></div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  <span class="keywordflow">if</span> (led_counter < (4 - <a class="code" href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a>.<a class="code" href="struct_vehicle.html#a14600e2333dc129b08990be5fad320b4">gear</a>) * 3)</div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  {</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  led_counter++;</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span> </div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="comment">/* LED显示 */</span></div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  LED_Display(led_status);</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  }</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <span class="comment">/* 计数完成时 */</span></div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (led_counter >= (4 - <a class="code" href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a>.<a class="code" href="struct_vehicle.html#a14600e2333dc129b08990be5fad320b4">gear</a>) * 3)</div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  {</div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  <span class="comment">/* 计数器清零 */</span></div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  led_counter = 0;</div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span> </div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  <span class="comment">/* 反转LED状态 */</span></div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  led_status = (led_status == 1) ? 0 : 1;</div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  }</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span> }</div>
<div class="ttc" id="vehicle_8c_html_a804a164dbad16439f9b3259617407187"><div class="ttname"><a href="vehicle_8c.html#a804a164dbad16439f9b3259617407187">display_flag</a></div><div class="ttdeci">unsigned char display_flag</div><div class="ttdef"><b>Definition:</b> vehicle.c:20</div></div>
<div class="ttc" id="struct_vehicle_html_a523997d5c13de311e719ab582f1de4d4"><div class="ttname"><a href="struct_vehicle.html#a523997d5c13de311e719ab582f1de4d4">Vehicle::speed</a></div><div class="ttdeci">unsigned char speed</div><div class="ttdef"><b>Definition:</b> vehicle.h:30</div></div>
<div class="ttc" id="vehicle_8c_html_a7e67faac7eb0a26632340a79a8f0bf5f"><div class="ttname"><a href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a></div><div class="ttdeci">Vehicle vehicle</div><div class="ttdef"><b>Definition:</b> vehicle.c:16</div></div>
<div class="ttc" id="vehicle_8c_html_a4fd900a3a7110287db68e11d1fa6d0e3"><div class="ttname"><a href="vehicle_8c.html#a4fd900a3a7110287db68e11d1fa6d0e3">DrawVehicle</a></div><div class="ttdeci">void DrawVehicle(float p, COLOR c)</div><div class="ttdoc">绘制赛车,即一个小矩形 </div><div class="ttdef"><b>Definition:</b> vehicle.c:234</div></div>
<div class="ttc" id="struct_vehicle_html_a979c2a3e7e4da4a8edc3d4b34dc8d62b"><div class="ttname"><a href="struct_vehicle.html#a979c2a3e7e4da4a8edc3d4b34dc8d62b">Vehicle::position</a></div><div class="ttdeci">float position</div><div class="ttdef"><b>Definition:</b> vehicle.h:29</div></div>
<div class="ttc" id="struct_vehicle_html_a14600e2333dc129b08990be5fad320b4"><div class="ttname"><a href="struct_vehicle.html#a14600e2333dc129b08990be5fad320b4">Vehicle::gear</a></div><div class="ttdeci">volatile unsigned char gear</div><div class="ttdef"><b>Definition:</b> vehicle.h:32</div></div>
<div class="ttc" id="struct_vehicle_html_a4f89aa17277ad83423164b9dccd8122a"><div class="ttname"><a href="struct_vehicle.html#a4f89aa17277ad83423164b9dccd8122a">Vehicle::laps</a></div><div class="ttdeci">unsigned char laps</div><div class="ttdef"><b>Definition:</b> vehicle.h:31</div></div>
<div class="ttc" id="vehicle_8c_html_a3e1821db0005527ac107eae37171c9d9"><div class="ttname"><a href="vehicle_8c.html#a3e1821db0005527ac107eae37171c9d9">speed</a></div><div class="ttdeci">char speed[10]</div><div class="ttdef"><b>Definition:</b> vehicle.c:19</div></div>
</div><!-- fragment -->
<p><div class="dynheader">
函数调用图:</div>
<div class="dyncontent">
<div class="center"><img src="vehicle_8c_ae06b8941e180800660bab73ca89bb29c_cgraph.png" border="0" usemap="#vehicle_8c_ae06b8941e180800660bab73ca89bb29c_cgraph" alt=""/></div>
<map name="vehicle_8c_ae06b8941e180800660bab73ca89bb29c_cgraph" id="vehicle_8c_ae06b8941e180800660bab73ca89bb29c_cgraph">
<area shape="rect" id="node2" href="vehicle_8c.html#a4fd900a3a7110287db68e11d1fa6d0e3" title="绘制赛车,即一个小矩形 " alt="" coords="197,5,292,32"/></map>
</div>
</p>
<p><div class="dynheader">
这是这个函数的调用关系图:</div>
<div class="dyncontent">
<div class="center"><img src="vehicle_8c_ae06b8941e180800660bab73ca89bb29c_icgraph.png" border="0" usemap="#vehicle_8c_ae06b8941e180800660bab73ca89bb29c_icgraph" alt=""/></div>
<map name="vehicle_8c_ae06b8941e180800660bab73ca89bb29c_icgraph" id="vehicle_8c_ae06b8941e180800660bab73ca89bb29c_icgraph">
<area shape="rect" id="node2" href="main_8c.html#a840291bc02cba5474a4cb46a9b9566fe" title="程序主函数 " alt="" coords="197,5,248,32"/></map>
</div>
</p>
</div>
</div>
<a class="anchor" id="a36a5da33bcf4051796cd7c997bc5c896"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void VehicleDisplays </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>显示赛车状态 </p>
<div class="fragment"><div class="line"><a name="l00107"></a><span class="lineno"> 107</span> {</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  <span class="comment">/* 绘制赛车 */</span></div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  <a class="code" href="vehicle_8c.html#a4fd900a3a7110287db68e11d1fa6d0e3">DrawVehicle</a>(<a class="code" href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a>.<a class="code" href="struct_vehicle.html#a979c2a3e7e4da4a8edc3d4b34dc8d62b">position</a>, <a class="code" href="vehicle_8h.html#a687a7041f1313e7c7836ff0c79e6c083">VEHICLE_COLOR</a>);</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span> </div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  <a class="code" href="vehicle_8c.html#a01f7b1de24a0bfcba4d3fef6345fef99">DrawRect</a>();</div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  drawascii168(12, 220, <a class="code" href="vehicle_8c.html#a3e1821db0005527ac107eae37171c9d9">speed</a>, 1, 1, 0xffffff);</div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span> </div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  <span class="comment">/* 显示圈数与速度*/</span></div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  <span class="keywordflow">if</span> (<a class="code" href="vehicle_8c.html#a804a164dbad16439f9b3259617407187">display_flag</a> != 0)</div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  {</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <a class="code" href="vehicle_8c.html#aea5c29b708bb0d72e962b61515fc44b8">DisplaySMG</a>();</div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  <a class="code" href="vehicle_8c.html#a804a164dbad16439f9b3259617407187">display_flag</a> = 0;</div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  }</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span> }</div>
<div class="ttc" id="vehicle_8c_html_a804a164dbad16439f9b3259617407187"><div class="ttname"><a href="vehicle_8c.html#a804a164dbad16439f9b3259617407187">display_flag</a></div><div class="ttdeci">unsigned char display_flag</div><div class="ttdef"><b>Definition:</b> vehicle.c:20</div></div>
<div class="ttc" id="vehicle_8c_html_a7e67faac7eb0a26632340a79a8f0bf5f"><div class="ttname"><a href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a></div><div class="ttdeci">Vehicle vehicle</div><div class="ttdef"><b>Definition:</b> vehicle.c:16</div></div>
<div class="ttc" id="vehicle_8c_html_aea5c29b708bb0d72e962b61515fc44b8"><div class="ttname"><a href="vehicle_8c.html#aea5c29b708bb0d72e962b61515fc44b8">DisplaySMG</a></div><div class="ttdeci">void DisplaySMG(void)</div><div class="ttdoc">数码管显示函数 在左边两位显示当前已走圈数 </div><div class="ttdef"><b>Definition:</b> vehicle.c:126</div></div>
<div class="ttc" id="vehicle_8c_html_a4fd900a3a7110287db68e11d1fa6d0e3"><div class="ttname"><a href="vehicle_8c.html#a4fd900a3a7110287db68e11d1fa6d0e3">DrawVehicle</a></div><div class="ttdeci">void DrawVehicle(float p, COLOR c)</div><div class="ttdoc">绘制赛车,即一个小矩形 </div><div class="ttdef"><b>Definition:</b> vehicle.c:234</div></div>
<div class="ttc" id="struct_vehicle_html_a979c2a3e7e4da4a8edc3d4b34dc8d62b"><div class="ttname"><a href="struct_vehicle.html#a979c2a3e7e4da4a8edc3d4b34dc8d62b">Vehicle::position</a></div><div class="ttdeci">float position</div><div class="ttdef"><b>Definition:</b> vehicle.h:29</div></div>
<div class="ttc" id="vehicle_8h_html_a687a7041f1313e7c7836ff0c79e6c083"><div class="ttname"><a href="vehicle_8h.html#a687a7041f1313e7c7836ff0c79e6c083">VEHICLE_COLOR</a></div><div class="ttdeci">#define VEHICLE_COLOR</div><div class="ttdef"><b>Definition:</b> vehicle.h:53</div></div>
<div class="ttc" id="vehicle_8c_html_a01f7b1de24a0bfcba4d3fef6345fef99"><div class="ttname"><a href="vehicle_8c.html#a01f7b1de24a0bfcba4d3fef6345fef99">DrawRect</a></div><div class="ttdeci">void DrawRect(void)</div><div class="ttdoc">绘制蓝色矩形方块 </div><div class="ttdef"><b>Definition:</b> vehicle.c:254</div></div>
<div class="ttc" id="vehicle_8c_html_a3e1821db0005527ac107eae37171c9d9"><div class="ttname"><a href="vehicle_8c.html#a3e1821db0005527ac107eae37171c9d9">speed</a></div><div class="ttdeci">char speed[10]</div><div class="ttdef"><b>Definition:</b> vehicle.c:19</div></div>
</div><!-- fragment -->
<p><div class="dynheader">
函数调用图:</div>
<div class="dyncontent">
<div class="center"><img src="vehicle_8c_a36a5da33bcf4051796cd7c997bc5c896_cgraph.png" border="0" usemap="#vehicle_8c_a36a5da33bcf4051796cd7c997bc5c896_cgraph" alt=""/></div>
<map name="vehicle_8c_a36a5da33bcf4051796cd7c997bc5c896_cgraph" id="vehicle_8c_a36a5da33bcf4051796cd7c997bc5c896_cgraph">
<area shape="rect" id="node2" href="vehicle_8c.html#a4fd900a3a7110287db68e11d1fa6d0e3" title="绘制赛车,即一个小矩形 " alt="" coords="168,5,263,32"/><area shape="rect" id="node3" href="vehicle_8c.html#a01f7b1de24a0bfcba4d3fef6345fef99" title="绘制蓝色矩形方块 " alt="" coords="176,56,255,83"/><area shape="rect" id="node4" href="vehicle_8c.html#aea5c29b708bb0d72e962b61515fc44b8" title="数码管显示函数 在左边两位显示当前已走圈数 " alt="" coords="168,107,263,133"/><area shape="rect" id="node5" href="vehicle_8c.html#aaefbc0e26f31cb3185e4126702d08566" title="数码管显示函数 " alt="" coords="311,81,429,108"/><area shape="rect" id="node6" href="vehicle_8c.html#ad56cd570f598052235ff7111f99c6504" title="简单的延时函数 " alt="" coords="343,132,397,159"/></map>
</div>
</p>
<p><div class="dynheader">
这是这个函数的调用关系图:</div>
<div class="dyncontent">
<div class="center"><img src="vehicle_8c_a36a5da33bcf4051796cd7c997bc5c896_icgraph.png" border="0" usemap="#vehicle_8c_a36a5da33bcf4051796cd7c997bc5c896_icgraph" alt=""/></div>
<map name="vehicle_8c_a36a5da33bcf4051796cd7c997bc5c896_icgraph" id="vehicle_8c_a36a5da33bcf4051796cd7c997bc5c896_icgraph">
<area shape="rect" id="node2" href="main_8c.html#a840291bc02cba5474a4cb46a9b9566fe" title="程序主函数 " alt="" coords="168,5,219,32"/></map>
</div>
</p>
</div>
</div>
<a class="anchor" id="aea5c29b708bb0d72e962b61515fc44b8"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void DisplaySMG </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>数码管显示函数 在左边两位显示当前已走圈数 </p>
<div class="fragment"><div class="line"><a name="l00127"></a><span class="lineno"> 127</span> {</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i;</div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span> </div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  <span class="keywordflow">for</span> (i = 0; i < 100; i++) <span class="comment">/* 显示一段时间 */</span></div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  {</div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  <span class="comment">/* 数码管前两位显示圈数 */</span></div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  <a class="code" href="vehicle_8c.html#aaefbc0e26f31cb3185e4126702d08566">DisplayOneSMG</a>(0, <a class="code" href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a>.<a class="code" href="struct_vehicle.html#a4f89aa17277ad83423164b9dccd8122a">laps</a> / 10, 0);</div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  <a class="code" href="vehicle_8c.html#ad56cd570f598052235ff7111f99c6504">delay</a>(5);</div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  <a class="code" href="vehicle_8c.html#aaefbc0e26f31cb3185e4126702d08566">DisplayOneSMG</a>(1, <a class="code" href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a>.<a class="code" href="struct_vehicle.html#a4f89aa17277ad83423164b9dccd8122a">laps</a> % 10, 0);</div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  <a class="code" href="vehicle_8c.html#ad56cd570f598052235ff7111f99c6504">delay</a>(5);</div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  }</div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span> </div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  <span class="comment">/* 显示完后清除数码管数据 */</span></div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  <a class="code" href="vehicle_8c.html#aaefbc0e26f31cb3185e4126702d08566">DisplayOneSMG</a>(0, 15, 0);</div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  <a class="code" href="vehicle_8c.html#aaefbc0e26f31cb3185e4126702d08566">DisplayOneSMG</a>(1, 15, 0);</div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span> }</div>
<div class="ttc" id="vehicle_8c_html_ad56cd570f598052235ff7111f99c6504"><div class="ttname"><a href="vehicle_8c.html#ad56cd570f598052235ff7111f99c6504">delay</a></div><div class="ttdeci">void delay(int time)</div><div class="ttdoc">简单的延时函数 </div><div class="ttdef"><b>Definition:</b> vehicle.c:303</div></div>
<div class="ttc" id="vehicle_8c_html_a7e67faac7eb0a26632340a79a8f0bf5f"><div class="ttname"><a href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a></div><div class="ttdeci">Vehicle vehicle</div><div class="ttdef"><b>Definition:</b> vehicle.c:16</div></div>
<div class="ttc" id="vehicle_8c_html_aaefbc0e26f31cb3185e4126702d08566"><div class="ttname"><a href="vehicle_8c.html#aaefbc0e26f31cb3185e4126702d08566">DisplayOneSMG</a></div><div class="ttdeci">void DisplayOneSMG(int p, int num, int dot)</div><div class="ttdoc">数码管显示函数 </div><div class="ttdef"><b>Definition:</b> vehicle.c:154</div></div>
<div class="ttc" id="struct_vehicle_html_a4f89aa17277ad83423164b9dccd8122a"><div class="ttname"><a href="struct_vehicle.html#a4f89aa17277ad83423164b9dccd8122a">Vehicle::laps</a></div><div class="ttdeci">unsigned char laps</div><div class="ttdef"><b>Definition:</b> vehicle.h:31</div></div>
</div><!-- fragment -->
<p><div class="dynheader">
函数调用图:</div>
<div class="dyncontent">
<div class="center"><img src="vehicle_8c_aea5c29b708bb0d72e962b61515fc44b8_cgraph.png" border="0" usemap="#vehicle_8c_aea5c29b708bb0d72e962b61515fc44b8_cgraph" alt=""/></div>
<map name="vehicle_8c_aea5c29b708bb0d72e962b61515fc44b8_cgraph" id="vehicle_8c_aea5c29b708bb0d72e962b61515fc44b8_cgraph">
<area shape="rect" id="node2" href="vehicle_8c.html#aaefbc0e26f31cb3185e4126702d08566" title="数码管显示函数 " alt="" coords="148,5,267,32"/><area shape="rect" id="node3" href="vehicle_8c.html#ad56cd570f598052235ff7111f99c6504" title="简单的延时函数 " alt="" coords="181,56,234,83"/></map>
</div>
</p>
<p><div class="dynheader">
这是这个函数的调用关系图:</div>
<div class="dyncontent">
<div class="center"><img src="vehicle_8c_aea5c29b708bb0d72e962b61515fc44b8_icgraph.png" border="0" usemap="#vehicle_8c_aea5c29b708bb0d72e962b61515fc44b8_icgraph" alt=""/></div>
<map name="vehicle_8c_aea5c29b708bb0d72e962b61515fc44b8_icgraph" id="vehicle_8c_aea5c29b708bb0d72e962b61515fc44b8_icgraph">
<area shape="rect" id="node2" href="vehicle_8h.html#a36a5da33bcf4051796cd7c997bc5c896" title="显示赛车状态 " alt="" coords="148,5,263,32"/><area shape="rect" id="node3" href="main_8c.html#a840291bc02cba5474a4cb46a9b9566fe" title="程序主函数 " alt="" coords="311,5,361,32"/></map>
</div>
</p>
</div>
</div>
<a class="anchor" id="aaefbc0e26f31cb3185e4126702d08566"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void DisplayOneSMG </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>p</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>num</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>dot</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>数码管显示函数 </p>
<dl class="params"><dt>参数</dt><dd>
<table class="params">
<tr><td class="paramname">p</td><td>数字在数码管中的位置 <ul>
<li>0..3 从右到左依次为 0 ~ 3 位 </li>
</ul>
</td></tr>
<tr><td class="paramname">num</td><td>要显示的数字 </td></tr>
<tr><td class="paramname">dot</td><td>是否显示小数点 <ul>
<li>0 不显示小数点 </li>
<li>1 显示小数点 </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<div class="fragment"><div class="line"><a name="l00155"></a><span class="lineno"> 155</span> {</div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  status(p)</div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  {</div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>  <span class="keywordflow">case</span> 0:</div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  rGPGDAT &= ~(1 << 2); <span class="comment">/* 设置数码管的位选 GPG2 = 0 (COM1) */</span></div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  rGPEDAT &= ~(1 << 9); <span class="comment">/* 设置数码管的位选 GPE9 = 0 (COM2) */</span></div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>  <span class="keywordflow">case</span> 1:</div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>  rGPGDAT |= (1 << 2); <span class="comment">/* 设置数码管的位选 GPG2 = 1 (COM1) */</span></div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>  rGPEDAT &= ~(1 << 9); <span class="comment">/* 设置数码管的位选 GPE9 = 0 (COM2) */</span></div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  <span class="keywordflow">case</span> 2:</div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>  rGPGDAT &= ~(1 << 2); <span class="comment">/* 设置数码管的位选 GPG2 = 0 (COM1) */</span></div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>  rGPEDAT |= (1 << 9); <span class="comment">/* 设置数码管的位选 GPE9 = 1 (COM2) */</span></div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span>  <span class="keywordflow">case</span> 3:</div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>  rGPGDAT |= (1 << 2); <span class="comment">/* 设置数码管的位选 GPG2 = 1 (COM1) */</span></div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>  rGPEDAT |= (1 << 9); <span class="comment">/* 设置数码管的位选 GPE9 = 1 (COM2) */</span></div>
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>  }</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span> </div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>  rGPEDAT = (rGPEDAT & ~(0x3C00)) | (num << 10); <span class="comment">/* 对应数字 6 */</span></div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>  rGPHDAT = (rGPHDAT & ~(1 << 8)) | (dot << 8);</div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span> }</div>
</div><!-- fragment -->
<p><div class="dynheader">
这是这个函数的调用关系图:</div>
<div class="dyncontent">
<div class="center"><img src="vehicle_8c_aaefbc0e26f31cb3185e4126702d08566_icgraph.png" border="0" usemap="#vehicle_8c_aaefbc0e26f31cb3185e4126702d08566_icgraph" alt=""/></div>
<map name="vehicle_8c_aaefbc0e26f31cb3185e4126702d08566_icgraph" id="vehicle_8c_aaefbc0e26f31cb3185e4126702d08566_icgraph">
<area shape="rect" id="node2" href="vehicle_8h.html#aea5c29b708bb0d72e962b61515fc44b8" title="数码管显示函数 在左边两位显示当前已走圈数 " alt="" coords="172,5,267,32"/><area shape="rect" id="node3" href="vehicle_8h.html#a36a5da33bcf4051796cd7c997bc5c896" title="显示赛车状态 " alt="" coords="315,5,429,32"/><area shape="rect" id="node4" href="main_8c.html#a840291bc02cba5474a4cb46a9b9566fe" title="程序主函数 " alt="" coords="477,5,528,32"/></map>
</div>
</p>
</div>
</div>
<a class="anchor" id="a389b4b4f6b01f7d8b5867afaa79be8f0"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void DisplayLED </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>flag</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>LED 显示函数 </p>
<dl class="params"><dt>参数</dt><dd>
<table class="params">
<tr><td class="paramname">flag</td><td>控制标志 </td></tr>
</table>
</dd>
</dl>
<div class="fragment"><div class="line"><a name="l00186"></a><span class="lineno"> 186</span> {</div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span> </div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>  <span class="keywordflow">if</span> (flag == 1) <span class="comment">/* led on */</span></div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>  {</div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>  rGPFDAT &= ~(1 << 7);</div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>  rGPFDAT &= ~(1 << 4);</div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  }</div>
<div class="line"><a name="l00193"></a><span class="lineno"> 193</span>  <span class="keywordflow">else</span> <span class="comment">/* led off */</span></div>
<div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  {</div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  rGPFDAT |= 1 << 7;</div>
<div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  rGPFDAT |= 1 << 4;</div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  }</div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span> }</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a573e3a73f898d8e69dda05e56716723d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void DrawTrack </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>绘制圆形赛道 </p>
<div class="fragment"><div class="line"><a name="l00205"></a><span class="lineno"> 205</span> {</div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>  <span class="keywordtype">int</span> i, j;</div>
<div class="line"><a name="l00207"></a><span class="lineno"> 207</span> </div>
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>  <span class="keywordflow">for</span> (i = 0; i <= 360; i++)</div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>  {</div>
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>  <span class="keywordflow">for</span> (j = <a class="code" href="vehicle_8h.html#af7ca67b66395e29d99ecbac716582787">TRACK_WIDTH_HALF</a> - 1; j > -<a class="code" href="vehicle_8h.html#af7ca67b66395e29d99ecbac716582787">TRACK_WIDTH_HALF</a>; j--)</div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>  {</div>
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span>  setpixel(<a class="code" href="vehicle_8h.html#a15d49b03259d0d164c152c151b24ce2a">TRACK_CENTRE_X</a> + (<a class="code" href="vehicle_8h.html#a64f019298900dd5c1e36926e7c005f7c">TRACK_RADIUS</a> + j) * cos(i * <a class="code" href="vehicle_8h.html#a598a3330b3c21701223ee0ca14316eca">PI</a> / 180.0f),</div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>  <a class="code" href="vehicle_8h.html#aab40bca60845489b3efae50a8425634a">TRACK_CENTRE_Y</a> + (<a class="code" href="vehicle_8h.html#a64f019298900dd5c1e36926e7c005f7c">TRACK_RADIUS</a> + j) * sin(i * <a class="code" href="vehicle_8h.html#a598a3330b3c21701223ee0ca14316eca">PI</a> / 180.0f),</div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>  0xffffff); <span class="comment">/* 绘制白色内道 */</span></div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>  }</div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span> </div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>  <span class="comment">/* 绘制黑色赛道描边 */</span></div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>  <span class="comment">/* 用弧度表示角度,1度= Π/180(rad) */</span></div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>  setpixel(<a class="code" href="vehicle_8h.html#a15d49b03259d0d164c152c151b24ce2a">TRACK_CENTRE_X</a> + (<a class="code" href="vehicle_8h.html#a64f019298900dd5c1e36926e7c005f7c">TRACK_RADIUS</a> + TRACK_WIDTH_HALF) * cos(i * <a class="code" href="vehicle_8h.html#a598a3330b3c21701223ee0ca14316eca">PI</a> / 180.0f),</div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>  <a class="code" href="vehicle_8h.html#aab40bca60845489b3efae50a8425634a">TRACK_CENTRE_Y</a> + (<a class="code" href="vehicle_8h.html#a64f019298900dd5c1e36926e7c005f7c">TRACK_RADIUS</a> + TRACK_WIDTH_HALF) * sin(i * <a class="code" href="vehicle_8h.html#a598a3330b3c21701223ee0ca14316eca">PI</a> / 180.0f),</div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>  <a class="code" href="vehicle_8h.html#a841a9bc465f236a3520d3cdffc1a9100">TRACK_COLOR</a>); <span class="comment">/* 绘制外描边 */</span></div>
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>  setpixel(<a class="code" href="vehicle_8h.html#a15d49b03259d0d164c152c151b24ce2a">TRACK_CENTRE_X</a> + (<a class="code" href="vehicle_8h.html#a64f019298900dd5c1e36926e7c005f7c">TRACK_RADIUS</a> - TRACK_WIDTH_HALF) * cos(i * <a class="code" href="vehicle_8h.html#a598a3330b3c21701223ee0ca14316eca">PI</a> / 180.0f),</div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>  <a class="code" href="vehicle_8h.html#aab40bca60845489b3efae50a8425634a">TRACK_CENTRE_Y</a> + (<a class="code" href="vehicle_8h.html#a64f019298900dd5c1e36926e7c005f7c">TRACK_RADIUS</a> - TRACK_WIDTH_HALF) * sin(i * <a class="code" href="vehicle_8h.html#a598a3330b3c21701223ee0ca14316eca">PI</a> / 180.0f),</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>  <a class="code" href="vehicle_8h.html#a841a9bc465f236a3520d3cdffc1a9100">TRACK_COLOR</a>); <span class="comment">/* 绘制内描边 */</span></div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>  }</div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span> }</div>
<div class="ttc" id="vehicle_8h_html_a15d49b03259d0d164c152c151b24ce2a"><div class="ttname"><a href="vehicle_8h.html#a15d49b03259d0d164c152c151b24ce2a">TRACK_CENTRE_X</a></div><div class="ttdeci">#define TRACK_CENTRE_X</div><div class="ttdef"><b>Definition:</b> vehicle.h:47</div></div>
<div class="ttc" id="vehicle_8h_html_af7ca67b66395e29d99ecbac716582787"><div class="ttname"><a href="vehicle_8h.html#af7ca67b66395e29d99ecbac716582787">TRACK_WIDTH_HALF</a></div><div class="ttdeci">#define TRACK_WIDTH_HALF</div><div class="ttdef"><b>Definition:</b> vehicle.h:49</div></div>
<div class="ttc" id="vehicle_8h_html_a841a9bc465f236a3520d3cdffc1a9100"><div class="ttname"><a href="vehicle_8h.html#a841a9bc465f236a3520d3cdffc1a9100">TRACK_COLOR</a></div><div class="ttdeci">#define TRACK_COLOR</div><div class="ttdef"><b>Definition:</b> vehicle.h:50</div></div>
<div class="ttc" id="vehicle_8h_html_a598a3330b3c21701223ee0ca14316eca"><div class="ttname"><a href="vehicle_8h.html#a598a3330b3c21701223ee0ca14316eca">PI</a></div><div class="ttdeci">#define PI</div><div class="ttdef"><b>Definition:</b> vehicle.h:36</div></div>
<div class="ttc" id="vehicle_8h_html_aab40bca60845489b3efae50a8425634a"><div class="ttname"><a href="vehicle_8h.html#aab40bca60845489b3efae50a8425634a">TRACK_CENTRE_Y</a></div><div class="ttdeci">#define TRACK_CENTRE_Y</div><div class="ttdef"><b>Definition:</b> vehicle.h:48</div></div>
<div class="ttc" id="vehicle_8h_html_a64f019298900dd5c1e36926e7c005f7c"><div class="ttname"><a href="vehicle_8h.html#a64f019298900dd5c1e36926e7c005f7c">TRACK_RADIUS</a></div><div class="ttdeci">#define TRACK_RADIUS</div><div class="ttdef"><b>Definition:</b> vehicle.h:46</div></div>
</div><!-- fragment -->
<p><div class="dynheader">
这是这个函数的调用关系图:</div>
<div class="dyncontent">
<div class="center"><img src="vehicle_8c_a573e3a73f898d8e69dda05e56716723d_icgraph.png" border="0" usemap="#vehicle_8c_a573e3a73f898d8e69dda05e56716723d_icgraph" alt=""/></div>
<map name="vehicle_8c_a573e3a73f898d8e69dda05e56716723d_icgraph" id="vehicle_8c_a573e3a73f898d8e69dda05e56716723d_icgraph">
<area shape="rect" id="node2" href="vehicle_8h.html#a37b4defbf720b1dc56d488cebe140ba2" title="赛车程序初始化函数 " alt="" coords="136,5,219,32"/><area shape="rect" id="node3" href="main_8c.html#a840291bc02cba5474a4cb46a9b9566fe" title="程序主函数 " alt="" coords="267,5,317,32"/></map>
</div>
</p>
</div>
</div>
<a class="anchor" id="a4fd900a3a7110287db68e11d1fa6d0e3"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void DrawVehicle </td>
<td>(</td>
<td class="paramtype">float </td>
<td class="paramname"><em>p</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">COLOR </td>
<td class="paramname"><em>c</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>绘制赛车,即一个小矩形 </p>
<dl class="params"><dt>参数</dt><dd>
<table class="params">
<tr><td class="paramname">p</td><td>赛车当前所处在赛道的位置 </td></tr>
<tr><td class="paramname">c</td><td>赛车颜色 </td></tr>
</table>
</dd>
</dl>
<div class="fragment"><div class="line"><a name="l00235"></a><span class="lineno"> 235</span> {</div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>  <span class="keywordtype">int</span> i, j;</div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span> </div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>  <span class="comment">/* 以矩形的几何中心为定位点,从左上角到右下角绘制矩形 */</span></div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>  <span class="keywordflow">for</span> (i = -<a class="code" href="vehicle_8h.html#a433dd285829a178cd787b3b113158125">VEHICLE_WIDTH_HALF</a>; i < <a class="code" href="vehicle_8h.html#a433dd285829a178cd787b3b113158125">VEHICLE_WIDTH_HALF</a>; i++)</div>
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>  {</div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>  <span class="keywordflow">for</span> (j = -VEHICLE_WIDTH_HALF; j < <a class="code" href="vehicle_8h.html#a433dd285829a178cd787b3b113158125">VEHICLE_WIDTH_HALF</a>; j++)</div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>  {</div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>  setpixel(<a class="code" href="vehicle_8h.html#a15d49b03259d0d164c152c151b24ce2a">TRACK_CENTRE_X</a> + <a class="code" href="vehicle_8h.html#a64f019298900dd5c1e36926e7c005f7c">TRACK_RADIUS</a> * cos(p * <a class="code" href="vehicle_8h.html#a598a3330b3c21701223ee0ca14316eca">PI</a> / 180.0f) + i,</div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>  <a class="code" href="vehicle_8h.html#aab40bca60845489b3efae50a8425634a">TRACK_CENTRE_Y</a> + <a class="code" href="vehicle_8h.html#a64f019298900dd5c1e36926e7c005f7c">TRACK_RADIUS</a> * sin(p * <a class="code" href="vehicle_8h.html#a598a3330b3c21701223ee0ca14316eca">PI</a> / 180.0f) + j,</div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>  c);</div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>  }</div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>  }</div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span> }</div>
<div class="ttc" id="vehicle_8h_html_a15d49b03259d0d164c152c151b24ce2a"><div class="ttname"><a href="vehicle_8h.html#a15d49b03259d0d164c152c151b24ce2a">TRACK_CENTRE_X</a></div><div class="ttdeci">#define TRACK_CENTRE_X</div><div class="ttdef"><b>Definition:</b> vehicle.h:47</div></div>
<div class="ttc" id="vehicle_8h_html_a598a3330b3c21701223ee0ca14316eca"><div class="ttname"><a href="vehicle_8h.html#a598a3330b3c21701223ee0ca14316eca">PI</a></div><div class="ttdeci">#define PI</div><div class="ttdef"><b>Definition:</b> vehicle.h:36</div></div>
<div class="ttc" id="vehicle_8h_html_aab40bca60845489b3efae50a8425634a"><div class="ttname"><a href="vehicle_8h.html#aab40bca60845489b3efae50a8425634a">TRACK_CENTRE_Y</a></div><div class="ttdeci">#define TRACK_CENTRE_Y</div><div class="ttdef"><b>Definition:</b> vehicle.h:48</div></div>
<div class="ttc" id="vehicle_8h_html_a433dd285829a178cd787b3b113158125"><div class="ttname"><a href="vehicle_8h.html#a433dd285829a178cd787b3b113158125">VEHICLE_WIDTH_HALF</a></div><div class="ttdeci">#define VEHICLE_WIDTH_HALF</div><div class="ttdef"><b>Definition:</b> vehicle.h:52</div></div>
<div class="ttc" id="vehicle_8h_html_a64f019298900dd5c1e36926e7c005f7c"><div class="ttname"><a href="vehicle_8h.html#a64f019298900dd5c1e36926e7c005f7c">TRACK_RADIUS</a></div><div class="ttdeci">#define TRACK_RADIUS</div><div class="ttdef"><b>Definition:</b> vehicle.h:46</div></div>
</div><!-- fragment -->
<p><div class="dynheader">
这是这个函数的调用关系图:</div>
<div class="dyncontent">
<div class="center"><img src="vehicle_8c_a4fd900a3a7110287db68e11d1fa6d0e3_icgraph.png" border="0" usemap="#vehicle_8c_a4fd900a3a7110287db68e11d1fa6d0e3_icgraph" alt=""/></div>
<map name="vehicle_8c_a4fd900a3a7110287db68e11d1fa6d0e3_icgraph" id="vehicle_8c_a4fd900a3a7110287db68e11d1fa6d0e3_icgraph">
<area shape="rect" id="node2" href="vehicle_8h.html#a37b4defbf720b1dc56d488cebe140ba2" title="赛车程序初始化函数 " alt="" coords="179,5,261,32"/><area shape="rect" id="node4" href="vehicle_8h.html#ae06b8941e180800660bab73ca89bb29c" title="更新赛车数据 " alt="" coords="148,56,292,83"/><area shape="rect" id="node5" href="vehicle_8h.html#a36a5da33bcf4051796cd7c997bc5c896" title="显示赛车状态 " alt="" coords="163,107,277,133"/><area shape="rect" id="node3" href="main_8c.html#a840291bc02cba5474a4cb46a9b9566fe" title="程序主函数 " alt="" coords="340,56,391,83"/></map>
</div>
</p>
</div>
</div>
<a class="anchor" id="a01f7b1de24a0bfcba4d3fef6345fef99"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void DrawRect </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>绘制蓝色矩形方块 </p>
<div class="fragment"><div class="line"><a name="l00255"></a><span class="lineno"> 255</span> {</div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span> </div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>  <span class="keywordtype">int</span> i, j;</div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span> </div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>  <span class="keywordflow">for</span> (i = 0; i < <a class="code" href="vehicle_8h.html#aa47729bda8134b8e4d57efdc2059dc57">SPEED_W</a>; i++)</div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>  {</div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>  <span class="keywordflow">for</span> (j = 0; j < <a class="code" href="vehicle_8h.html#a5e9068043931c7cb96c6045e9be3e34d">SPEED_H</a>; j++)</div>
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>  {</div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>  setpixel(<a class="code" href="vehicle_8h.html#af1062de956277a36ed7f39bb42e60f4b">SPEED_X</a> + i,</div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>  <a class="code" href="vehicle_8h.html#a6878cf48d46febe3904a323be1dc944c">SPEED_Y</a> + j,</div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>  0x0000ff);</div>
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span>  }</div>
<div class="line"><a name="l00267"></a><span class="lineno"> 267</span>  }</div>
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span> }</div>
<div class="ttc" id="vehicle_8h_html_af1062de956277a36ed7f39bb42e60f4b"><div class="ttname"><a href="vehicle_8h.html#af1062de956277a36ed7f39bb42e60f4b">SPEED_X</a></div><div class="ttdeci">#define SPEED_X</div><div class="ttdef"><b>Definition:</b> vehicle.h:41</div></div>
<div class="ttc" id="vehicle_8h_html_a5e9068043931c7cb96c6045e9be3e34d"><div class="ttname"><a href="vehicle_8h.html#a5e9068043931c7cb96c6045e9be3e34d">SPEED_H</a></div><div class="ttdeci">#define SPEED_H</div><div class="ttdef"><b>Definition:</b> vehicle.h:44</div></div>
<div class="ttc" id="vehicle_8h_html_a6878cf48d46febe3904a323be1dc944c"><div class="ttname"><a href="vehicle_8h.html#a6878cf48d46febe3904a323be1dc944c">SPEED_Y</a></div><div class="ttdeci">#define SPEED_Y</div><div class="ttdef"><b>Definition:</b> vehicle.h:42</div></div>
<div class="ttc" id="vehicle_8h_html_aa47729bda8134b8e4d57efdc2059dc57"><div class="ttname"><a href="vehicle_8h.html#aa47729bda8134b8e4d57efdc2059dc57">SPEED_W</a></div><div class="ttdeci">#define SPEED_W</div><div class="ttdef"><b>Definition:</b> vehicle.h:43</div></div>
</div><!-- fragment -->
<p><div class="dynheader">
这是这个函数的调用关系图:</div>
<div class="dyncontent">
<div class="center"><img src="vehicle_8c_a01f7b1de24a0bfcba4d3fef6345fef99_icgraph.png" border="0" usemap="#vehicle_8c_a01f7b1de24a0bfcba4d3fef6345fef99_icgraph" alt=""/></div>
<map name="vehicle_8c_a01f7b1de24a0bfcba4d3fef6345fef99_icgraph" id="vehicle_8c_a01f7b1de24a0bfcba4d3fef6345fef99_icgraph">
<area shape="rect" id="node2" href="vehicle_8h.html#a36a5da33bcf4051796cd7c997bc5c896" title="显示赛车状态 " alt="" coords="132,5,247,32"/><area shape="rect" id="node3" href="main_8c.html#a840291bc02cba5474a4cb46a9b9566fe" title="程序主函数 " alt="" coords="295,5,345,32"/></map>
</div>
</p>
</div>
</div>
<a class="anchor" id="a5d7d4bd8a4ae8dfde93d64d27a492463"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void __irq INT2_Handler </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>按键2中断处理函数 每按一次“档位”成员变量自增一 </p>
<div class="fragment"><div class="line"><a name="l00275"></a><span class="lineno"> 275</span> {</div>
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span>  <span class="keywordflow">if</span> (<a class="code" href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a>.<a class="code" href="struct_vehicle.html#a14600e2333dc129b08990be5fad320b4">gear</a> < 3)</div>
<div class="line"><a name="l00277"></a><span class="lineno"> 277</span>  {</div>
<div class="line"><a name="l00278"></a><span class="lineno"> 278</span>  <a class="code" href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a>.<a class="code" href="struct_vehicle.html#a14600e2333dc129b08990be5fad320b4">gear</a>++;</div>
<div class="line"><a name="l00279"></a><span class="lineno"> 279</span>  }</div>
<div class="line"><a name="l00280"></a><span class="lineno"> 280</span> </div>
<div class="line"><a name="l00281"></a><span class="lineno"> 281</span>  ClearInt();</div>
<div class="line"><a name="l00282"></a><span class="lineno"> 282</span> }</div>
<div class="ttc" id="vehicle_8c_html_a7e67faac7eb0a26632340a79a8f0bf5f"><div class="ttname"><a href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a></div><div class="ttdeci">Vehicle vehicle</div><div class="ttdef"><b>Definition:</b> vehicle.c:16</div></div>
<div class="ttc" id="struct_vehicle_html_a14600e2333dc129b08990be5fad320b4"><div class="ttname"><a href="struct_vehicle.html#a14600e2333dc129b08990be5fad320b4">Vehicle::gear</a></div><div class="ttdeci">volatile unsigned char gear</div><div class="ttdef"><b>Definition:</b> vehicle.h:32</div></div>
</div><!-- fragment -->
<p><div class="dynheader">
这是这个函数的调用关系图:</div>
<div class="dyncontent">
<div class="center"><img src="vehicle_8c_a5d7d4bd8a4ae8dfde93d64d27a492463_icgraph.png" border="0" usemap="#vehicle_8c_a5d7d4bd8a4ae8dfde93d64d27a492463_icgraph" alt=""/></div>
<map name="vehicle_8c_a5d7d4bd8a4ae8dfde93d64d27a492463_icgraph" id="vehicle_8c_a5d7d4bd8a4ae8dfde93d64d27a492463_icgraph">
<area shape="rect" id="node2" href="main_8h.html#a85f4f7afb13dec1233f5cfd2473d5a12" title="中断初始化 " alt="" coords="152,5,215,32"/><area shape="rect" id="node3" href="main_8c.html#a840291bc02cba5474a4cb46a9b9566fe" title="程序主函数 " alt="" coords="263,5,313,32"/></map>
</div>
</p>
</div>
</div>
<a class="anchor" id="a7897534f6b2cf9ec2d72af613e6c100d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void __irq INT0_Handler </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>按键1中断处理函数 每按一次“档位”成员变量自减一 </p>
<div class="fragment"><div class="line"><a name="l00289"></a><span class="lineno"> 289</span> {</div>
<div class="line"><a name="l00290"></a><span class="lineno"> 290</span>  <span class="keywordflow">if</span> (<a class="code" href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a>.<a class="code" href="struct_vehicle.html#a14600e2333dc129b08990be5fad320b4">gear</a> > 0)</div>
<div class="line"><a name="l00291"></a><span class="lineno"> 291</span>  {</div>
<div class="line"><a name="l00292"></a><span class="lineno"> 292</span>  <a class="code" href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a>.<a class="code" href="struct_vehicle.html#a14600e2333dc129b08990be5fad320b4">gear</a>--;</div>
<div class="line"><a name="l00293"></a><span class="lineno"> 293</span>  }</div>
<div class="line"><a name="l00294"></a><span class="lineno"> 294</span> </div>
<div class="line"><a name="l00295"></a><span class="lineno"> 295</span>  ClearInt();</div>
<div class="line"><a name="l00296"></a><span class="lineno"> 296</span> }</div>
<div class="ttc" id="vehicle_8c_html_a7e67faac7eb0a26632340a79a8f0bf5f"><div class="ttname"><a href="vehicle_8c.html#a7e67faac7eb0a26632340a79a8f0bf5f">vehicle</a></div><div class="ttdeci">Vehicle vehicle</div><div class="ttdef"><b>Definition:</b> vehicle.c:16</div></div>
<div class="ttc" id="struct_vehicle_html_a14600e2333dc129b08990be5fad320b4"><div class="ttname"><a href="struct_vehicle.html#a14600e2333dc129b08990be5fad320b4">Vehicle::gear</a></div><div class="ttdeci">volatile unsigned char gear</div><div class="ttdef"><b>Definition:</b> vehicle.h:32</div></div>
</div><!-- fragment -->
<p><div class="dynheader">
这是这个函数的调用关系图:</div>
<div class="dyncontent">
<div class="center"><img src="vehicle_8c_a7897534f6b2cf9ec2d72af613e6c100d_icgraph.png" border="0" usemap="#vehicle_8c_a7897534f6b2cf9ec2d72af613e6c100d_icgraph" alt=""/></div>
<map name="vehicle_8c_a7897534f6b2cf9ec2d72af613e6c100d_icgraph" id="vehicle_8c_a7897534f6b2cf9ec2d72af613e6c100d_icgraph">
<area shape="rect" id="node2" href="main_8h.html#a85f4f7afb13dec1233f5cfd2473d5a12" title="中断初始化 " alt="" coords="152,5,215,32"/><area shape="rect" id="node3" href="main_8c.html#a840291bc02cba5474a4cb46a9b9566fe" title="程序主函数 " alt="" coords="263,5,313,32"/></map>
</div>
</p>
</div>
</div>
<a class="anchor" id="ad56cd570f598052235ff7111f99c6504"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void delay </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>time</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>简单的延时函数 </p>
<dl class="params"><dt>参数</dt><dd>
<table class="params">
<tr><td class="paramname">time</td><td>延时次数 </td></tr>
</table>
</dd>
</dl>
<div class="fragment"><div class="line"><a name="l00304"></a><span class="lineno"> 304</span> {</div>
<div class="line"><a name="l00305"></a><span class="lineno"> 305</span>  <span class="keywordtype">int</span> i, j;</div>
<div class="line"><a name="l00306"></a><span class="lineno"> 306</span>  <span class="keywordflow">for</span> (i = 0; i < time; i++)</div>
<div class="line"><a name="l00307"></a><span class="lineno"> 307</span>  <span class="keywordflow">for</span> (j = 0; j < 1000; j++)</div>
<div class="line"><a name="l00308"></a><span class="lineno"> 308</span>  ;</div>
<div class="line"><a name="l00309"></a><span class="lineno"> 309</span> }</div>
</div><!-- fragment -->
<p><div class="dynheader">
这是这个函数的调用关系图:</div>
<div class="dyncontent">
<div class="center"><img src="vehicle_8c_ad56cd570f598052235ff7111f99c6504_icgraph.png" border="0" usemap="#vehicle_8c_ad56cd570f598052235ff7111f99c6504_icgraph" alt=""/></div>
<map name="vehicle_8c_ad56cd570f598052235ff7111f99c6504_icgraph" id="vehicle_8c_ad56cd570f598052235ff7111f99c6504_icgraph">
<area shape="rect" id="node2" href="main_8h.html#a22ded4a110818b6fb8a72a001ff988ea" title="在LCD上显示成员信息,持续一段时间 " alt="" coords="263,5,350,32"/><area shape="rect" id="node4" href="vehicle_8h.html#aea5c29b708bb0d72e962b61515fc44b8" title="数码管显示函数 在左边两位显示当前已走圈数 " alt="" coords="107,56,201,83"/><area shape="rect" id="node3" href="main_8c.html#a840291bc02cba5474a4cb46a9b9566fe" title="程序主函数 " alt="" coords="412,31,463,57"/><area shape="rect" id="node5" href="vehicle_8h.html#a36a5da33bcf4051796cd7c997bc5c896" title="显示赛车状态 " alt="" coords="249,56,364,83"/></map>
</div>
</p>
</div>
</div>
<h2 class="groupheader">变量说明</h2>
<a class="anchor" id="a7e67faac7eb0a26632340a79a8f0bf5f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_vehicle.html">Vehicle</a> vehicle</td>
</tr>
</table>
</div><div class="memdoc">
<b>初始值:</b><div class="fragment"><div class="line">= {</div>
<div class="line"> 90, 0, 1, 2}</div>
</div><!-- fragment --><p>赛车结构体 </p>
</div>
</div>
<a class="anchor" id="a3e1821db0005527ac107eae37171c9d9"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char speed[10]</td>
</tr>
</table>
</div><div class="memdoc">
<p>LCD 左上角显示的当前速度 </p>
</div>
</div>
<a class="anchor" id="a804a164dbad16439f9b3259617407187"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">unsigned char display_flag = 0</td>
</tr>
</table>
</div><div class="memdoc">
<p>显示控制标志 </p>
</div>
</div>
</div><!-- contents -->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta charset="utf-8" />
<style>
body {
padding-bottom: 50px;
}
.footer {
position: fixed;
left: 0px;
bottom: 0px;
width: 100%;
height: 35px;
background-color: #eee;
z-index: 9999;
}
</style>
</head>
<body>
<div class="footer"> Posted by: Gump JunSen, LDR </div>
</body>