向工程中添加两个stm32f10x_fsmc.c,stm32f10x_spi.c这两个文件。
好了,大部分的准备工作都好了, 再在让新建一个任务来运行Dome中的MainTask();在任务3中调用GUI_TOUCH_Exec();
1 /*————————————————————————-
2
3 软件主体
4
5
6 ————————————————————————-*/
7
8 #include “bsp.h“
9 #include “App.h“
10
11 extern void MainTask(void);
12 extern void GUI_TOUCH_Exec(void);
13
14 static OS_TCB taskStartTCB;
15 static CPU_STK taskStartStk[STARTUP_TASK_STK_SIZE]; //启动任务的程序空间
16
17 static OS_TCB task1TCB;
18 static CPU_STK task1Stk[TASK1_STK_SIZE];
19
20 static OS_TCB task2TCB;
21 static CPU_STK task2Stk[TASK2_STK_SIZE];
22
23 static OS_TCB task3TCB;
24 static CPU_STK task3Stk[TASK3_STK_SIZE];
25
26 static OS_TCB dispTCB;
27 static CPU_STK dispStk[TASK4_STK_SIZE];
28
29 static volatile OS_SEM taskSem;
30
31
32
33 /*******************************************************************************
34 * Function Name :void TaskStart(void)
35 * Description :任务启动
36 * Input :
37 * Output :
38 * Other :
39 * Date :2012.04.18 11:48:23
40 *******************************************************************************/
41 static void TaskStart(void)
42 {
43 OS_ERR err;
44
45 led_init();
46 SysTickInit();
47
48
49 OSTaskCreate( (OS_TCB *)&task1TCB,
50 (CPU_CHAR *)“Task1“,
51 (OS_TASK_PTR)Task1,
52 (void *)0,
53 (OS_PRIO )TASK1_PRIO,
54 (CPU_STK *)&task1Stk[0],
55 (CPU_STK_SIZE)TASK1_STK_SIZE / 10,
56 (CPU_STK_SIZE)TASK1_STK_SIZE,
57 (OS_MSG_QTY )0,
58 (OS_TICK )0,
59 (void *)0,
60 (OS_OPT )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
61 (OS_ERR *)&err);
62
63 OSTaskCreate( (OS_TCB *)&task2TCB,
64 (CPU_CHAR *)“Task2“,
65 (OS_TASK_PTR)Task2,
66 (void *)0,
67 (OS_PRIO ) TASK2_PRIO,
68 (CPU_STK *)&task2Stk[0],
69 (CPU_STK_SIZE)TASK2_STK_SIZE / 10,
70 (CPU_STK_SIZE)TASK2_STK_SIZE,
71 (OS_MSG_QTY )0,
72 (OS_TICK )0,
73 (void *)0,
74 (OS_OPT )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
75 (OS_ERR *)&err);
76
77
78 OSTaskCreate( (OS_TCB *)&task3TCB,
79 (CPU_CHAR *)“Task3“,
80 (OS_TASK_PTR)Task3,
81 (void *)0,
82 (OS_PRIO )TASK3_PRIO,
83 (CPU_STK *)&task3Stk[0],
84 (CPU_STK_SIZE)TASK3_STK_SIZE / 10,
85 (CPU_STK_SIZE)TASK3_STK_SIZE,
86 (OS_MSG_QTY )0,
87 (OS_TICK )0,
88 (void *)0,
89 (OS_OPT )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
90 (OS_ERR *)&err);
91
92 OSTaskCreate( (OS_TCB *)&dispTCB,
93 (CPU_CHAR *)“LCD display“,
94 (OS_TASK_PTR)MainTask,
95 (void *)0,
96 (OS_PRIO )Disp_PRIO,
97 (CPU_STK *)&dispStk[0],
98 (CPU_STK_SIZE)TASK4_STK_SIZE / 10,
99 (CPU_STK_SIZE)TASK4_STK_SIZE,
100 (OS_MSG_QTY )0,
101 (OS_TICK )0,
102 (void *)0,
103 (OS_OPT )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
104 (OS_ERR *)&err);
105 |