實驗目的:

 1.  瞭解 GUI 的基本概念及工作原理。

 2.  熟悉 uC/GUI 的基本框架。

 3.  掌握 uC/GUI 的使用方法。



#include "../ucos-ii/includes.h" /* uC/OS interface */

#include "../target/option.h"
#include "../target/2410lib.h"

//task stack size
#ifdef SEMIHOSTED
#define TASK_STACK_SIZE (64+SEMIHOSTED_STACK_NEEDS)
#else
#define TASK_STACK_SIZE 100*1024
#endif

//Task definition

//Main Task
OS_STK Main_Stack[TASK_STACK_SIZE]= {0, };
extern void Main_Task(void *Id);
#define Main_PRIO 10



//Task1
OS_STK Task1_Stack[TASK_STACK_SIZE]= {0, };
extern void Task1_Task(void *Id);
#define Task1_PRIO 12

//Task2
OS_STK Task2_Stack[TASK_STACK_SIZE]= {0, };
extern void Task2_Task(void *Id);
#define Task2_PRIO 14

//GUI Task
OS_STK GUI_Stack[TASK_STACK_SIZE]= {0, };
extern void GUI_Task(void *Id);
#define GUI_PRIO 16


void Task1_Task(void *Id)
{
int i;
while(1)
{
i++;
OSTimeDly(10);
}
}
void Task2_Task(void *Id)
{
int i;
while(1)
{
i++;
OSTimeDly(20);
}
}
extern void GUI_Init(void);
extern void GUI_TOUCH_Init(void);
extern void GUIDEMO_main(void);

extern void Lab_Demo(void);

void GUI_Task(void *Id)
{
GUI_Init();
GUI_TOUCH_Init();
while (1) {
Lab_Demo();
OSTimeDly(40);
}
}
void Main_Task(void *Id)
{
//OSStatInit();
/* Start the S3C44B0X BSP Running */
ARMTargetStart();

OSTaskCreate(Task1_Task, (void *)0, (OS_STK *)&Task1_Stack[TASK_STACK_SIZE-1], Task1_PRIO);
OSTaskCreate(Task2_Task, (void *)0, (OS_STK *)&Task2_Stack[TASK_STACK_SIZE-1], Task2_PRIO);
OSTaskCreate(GUI_Task, (void *)0, (OS_STK *)&GUI_Stack[TASK_STACK_SIZE-1], GUI_PRIO);

while (1)
{
OSTimeDly(40);
}
}

extern int __rt_lib_init(void);
//===================================================================
void Main(void)
{
Led_Display(15);


#if ADS10
__rt_lib_init(); //for ADS 1.x
#endif

ChangeClockDivider(1,1); // 1:2:4
ChangeMPllValue(0xa1,0x3,0x1); // FCLK=202.8MHz

ARMTargetInit();

// Init uCOS-II
OSInit();

//Create the Main Task
OSTaskCreate(Main_Task, (void *)0, (OS_STK *)&Main_Stack[TASK_STACK_SIZE-1], Main_PRIO);

// Start uCOS-II
OSStart();

}