📄 main.c
字号:
#include "../../ucos-ii/includes.h" /* uC/OS interface */
//task stack size
#ifdef SEMIHOSTED
#define TASK_STACK_SIZE (64+SEMIHOSTED_STACK_NEEDS)
#else
#define TASK_STACK_SIZE 10*1024
#endif
//Task definition
/* allocate memory for tasks' stacks */
#define STACKSIZE 64
/* Global Variable */
unsigned int Stack1[STACKSIZE];
unsigned int Stack2[STACKSIZE];
unsigned int Stack3[STACKSIZE];
unsigned int StackMain[STACKSIZE];
void Task1(void *Id)
{
while(1)
{
Led1_Flash();
Led2_Flash();
OSTimeDly(160);
}
}
void Task2(void *Id)
{
while(1)
{
Led3_Flash();
Led4_Flash();
OSTimeDly(80);
}
}
void Task3(void *Id)
{
int i=0;
// print To UART0
uHALr_printf("*==================================*\n");
uHALr_printf("*= 深圳市英蓓特信息技术有限公司 =*\n");
uHALr_printf("*==================================*\n");
uHALr_printf("*========== 产品研发中心 ==========*\n");
uHALr_printf("*======= 86-755-25631365 ========*\n");
uHALr_printf("*===== support@embedinfo.com ======*\n");
uHALr_printf("*=== ===*\n");
while(1)
{
i++;
uHALr_printf(" **** %d ****\r",i);
OSTimeDly(90);
}
}
void TaskStart (void *i)
{
char Id1 = '1';
char Id2 = '2';
char Id3 = '3';
uHALr_InitTimers(); // enable timer counter interrupt
/*
* create the tasks in uC/OS and assign decreasing
* priority to them
*/
OSTaskCreate(Task1, (void *)0, &Stack1[STACKSIZE - 1], 2);
OSTaskCreate(Task2, (void *)0, &Stack2[STACKSIZE - 1], 3);
OSTaskCreate(Task3, (void *)0, &Stack3[STACKSIZE - 1], 4);
// Delete current task
OSTaskDel(OS_PRIO_SELF);
}
int Main(void)//int argc, char **argv
{
char Id4 = '4';
ARMTargetInit();
/* needed by uC/OS */
OSInit();
OSTimeSet(0);
/* create the start task */
OSTaskCreate(TaskStart,(void *)0, &StackMain[STACKSIZE - 1], 0);
ARMTargetStart();
/* start the operating system */
OSStart();
return(0);
//* End
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -