⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 MiniGUI到ucOS-II的位图操作。通过该例子
💻 C
字号:
#include "..\ucos-ii\add\OSAddTask.h"
#include "..\ucos-ii\includes.h"               /* uC/OS interface */
#include "..\inc\drv.h"
#include "..\inc\drv\OSFile.h"
#include "..\inc\drv\Ustring.h"

#include <string.h>

#pragma import(__use_no_semihosting_swi)  // ensure no functions that use semihosting 


///******************任务定义***************///

OS_STK Main_Stack[STACKSIZE*8]={0, };   //Main_Test_Task堆栈
void Main_Task(void *Id);             //Main_Test_Task
#define Main_Task_Prio     12

/**************已经定义的OS任务*************
#define SYS_Task_Prio				1
#define Touch_Screen_Task_Prio		9
#define Main_Task_Prio     12
#define Key_Scan_Task_Prio      58
#define Lcd_Fresh_prio           59
#define Led_Flash_Prio           60

***************************************/////////



///*****************事件定义*****************///

OS_EVENT *Nand_Rw_Sem;                   //Nand_Flash读写控制权旗语
//and you can use it as folloeing:
//    Nand_Rw_Sem=OSSemCreate(1);        //创建Nand-Flash读写控制权旗语,初值为1满足互斥条件//
//    OSSemPend(Nand_Rw_Sem,0,&err);
//    OSSemPost(Nand_Rw_Sem);

OS_EVENT *Uart_Rw_Sem;                   //Uart读写控制权旗语
//and you can use it as folloeing:
//    Uart_Rw_Sem=OSSemCreate(1);        //创建Uart读写控制权旗语,初值为1满足互斥条件//
//    OSSemPend(Uart_Rw_Sem,0,&err);
//    OSSemPost(Uart_Rw_Sem);

/////////////////////////////////////////////////////
//                  Main function.                //
////////////////////////////////////////////////////
extern U8 isConfigsysLoad;
extern U8 sysCONFIG[];
extern U32 ConfigSysdata[];

int main(void)
{

	ARMTargetInit();        // do target (uHAL based ARM system) initialisation //

	OSInit();               // needed by uC/OS-II //
	uHALr_ResetMMU();

	LCD_Init();             //初始化LCD模块
	LCD_printf("LCD initialization is OK\n");
	LCD_printf("240 x 128  Text Mode\n");

	Uart_Printf("LCD initialization is OK\n");

	initOSFile();
	
//	LoadFont();
	LoadConfigSys();

	
  // create the tasks in uC/OS and assign increasing //
  // priorities to them so that Task3 at the end of  //
  // the pipeline has the highest priority.          //
	LCD_printf("Create task on uCOS-II...\n");
	OSTaskCreate(Main_Task,  (void *)0,  (OS_STK *)&Main_Stack[STACKSIZE*8-1],  Main_Task_Prio);// 1

	OSAddTask_Init();
  
	LCD_printf("Starting uCOS-II...\n");
	LCD_printf("Entering graph mode...\n");
	LCD_ChangeMode(DspGraMode);

	InitRtc();
	
	Nand_Rw_Sem=OSSemCreate(1);   //创建Nand-Flash读写控制权旗语,初值为1满足互斥条件//

	OSStart();              // start the OS //

	// never reached //
	return 0;
}//main


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Main_Task(void *Id)             //Main_Test_Task
{
	minigui_app_entry ();

	OSTaskDel(OS_PRIO_SELF);

/*	for(;;){
		OSTimeDly(1000);
	}*/
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -