Vehicle
vehicle.h
浏览该文件的文档.
1 
12 /* Define to prevent recursive inclusion -------------------------------------*/
13 #ifndef __VEHICLE_H
14 #define __VEHICLE_H
15 
16 /* Includes ------------------------------------------------------------------*/
17 #include "def.h"
18 #include "consol.h"
19 #include "S3c2410x.h"
20 #include "INT.h"
21 #include "2410lib.h"
22 #include "lcdlib.h"
23 #include <stdio.h>
24 #include <math.h>
25 
26 /* Private typedef -----------------------------------------------------------*/
27 typedef struct
28 {
29  float position;
30  unsigned char speed;
31  unsigned char laps;
32  volatile unsigned char gear;
33 } Vehicle;
34 
35 /* Private define ------------------------------------------------------------*/
36 #define PI 3.14
38 #define COVER_BUF 0x32000000
39 #define BACKGROUND_BUF 0x31000000
41 #define SPEED_X 10
42 #define SPEED_Y 200
43 #define SPEED_W 90
44 #define SPEED_H 21
46 #define TRACK_RADIUS 100
47 #define TRACK_CENTRE_X 200.0f
48 #define TRACK_CENTRE_Y 120.0f
49 #define TRACK_WIDTH_HALF 17.0f
50 #define TRACK_COLOR 0x000000
52 #define VEHICLE_WIDTH_HALF 11
53 #define VEHICLE_COLOR 0xffff00
55 /* Private function prototypes -----------------------------------------------*/
56 void VehicleInit(void);
57 void VehicleStatusUpdate(void);
58 void VehicleDisplays(void);
59 
60 void DisplaySMG(void);
61 void DisplayLED(int flag);
62 void DisplayOneSMG(int p, int num, int dot);
63 
64 void DrawVehicle(float p, COLOR c);
65 void DrawTrack(void);
66 void DrawRect(void);
67 
68 void delay(int time);
69 
70 /* Exported functions --------------------------------------------------------*/
71 extern void __irq INT0_Handler(void);
72 extern void __irq INT2_Handler(void);
73 
74 #endif /* __VEHICLE_H */
75 
76 /********************************** END OF FILE *******************************/
void VehicleDisplays(void)
显示赛车状态
Definition: vehicle.c:106
Definition: vehicle.h:27
unsigned char speed
Definition: vehicle.h:30
void delay(int time)
简单的延时函数
Definition: vehicle.c:303
void DisplayOneSMG(int p, int num, int dot)
数码管显示函数
Definition: vehicle.c:154
float position
Definition: vehicle.h:29
volatile unsigned char gear
Definition: vehicle.h:32
void VehicleInit(void)
赛车程序初始化函数
Definition: vehicle.c:27
void VehicleStatusUpdate(void)
更新赛车数据
Definition: vehicle.c:45
void DrawRect(void)
绘制蓝色矩形方块
Definition: vehicle.c:254
void DrawTrack(void)
绘制圆形赛道
Definition: vehicle.c:204
void DisplaySMG(void)
数码管显示函数 在左边两位显示当前已走圈数
Definition: vehicle.c:126
unsigned char laps
Definition: vehicle.h:31
void DrawVehicle(float p, COLOR c)
绘制赛车,即一个小矩形
Definition: vehicle.c:234
void __irq INT0_Handler(void)
按键1中断处理函数 每按一次“档位”成员变量自减一
Definition: vehicle.c:288
void __irq INT2_Handler(void)
按键2中断处理函数 每按一次“档位”成员变量自增一
Definition: vehicle.c:274
void DisplayLED(int flag)
LED 显示函数
Definition: vehicle.c:185