static portTASK_FUNCTION(MainTask, pvParameters) { uint16_t msCnt; (void) pvParameters; /* parameter not used */ #if PL_HAS_ACCEL ACCEL_LowLevelInit(); #endif for (;;) { EVNT_HandleEvent(APP_EvntHandler); #if PL_HAS_KEYS && !PL_HAS_KBI KEY_Scan(); /* poll keys */ #endif FRTOS1_vTaskDelay(20/portTICK_RATE_MS); msCnt += 20; if (msCnt > 280) { #if PL_HAS_ULTRASONIC (void)US_Measure_us(); /* Measure distance */ #endif msCnt = 0; } } }
void APP_Start(void) { EVNT_SetEvent(EVNT_INIT); #if PL_HAS_RTOS if (FRTOS1_xTaskCreate( MainTask, /* pointer to the task */ "Main", /* task name for kernel awareness debugging */ configMINIMAL_STACK_SIZE, /* task stack size */ (void*)NULL, /* optional task startup argument */ tskIDLE_PRIORITY, /* initial priority */ (xTaskHandle*)NULL /* optional task handle to create */ ) != pdPASS) { /*lint -e527 */ for(;;){} /* error! probably out of memory */ /*lint +e527 */ } FRTOS1_vTaskStartScheduler(); #else for(;;) { /* application main loop */ #if PL_HAS_SHELL SHELL_Process(); #endif #if PL_HAS_KEYS && !PL_HAS_KBI /* poll keys */ KEY_Scan(); /* poll keys */ #endif EVNT_HandleEvent(APP_HandleEvent); WAIT1_Waitms(10); } #endif }
int main(void) { u8 key; delay_init(168); LED_Init(); KEY_Init(); LED0 = 1; while(1) { key = KEY_Scan(0); if(key) { switch ( key) { case 1: LED0 = !LED0; break; default: break; } } } }
static void App(void) { #if PL_CONFIG_HAS_SHELL int cntr = 0; #endif EVNT_SetEvent(EVNT_STARTUP); for(;;) { #if PL_CONFIG_HAS_EVENTS #if PL_CONFIG_EVENTS_AUTO_CLEAR EVNT_HandleEvent(APP_EvntHandler, TRUE); #else EVNT_HandleEvent(APP_EvntHandler, FALSE); #endif #endif #if PL_CONFIG_HAS_KEYS KEY_Scan(); #endif #if PL_CONFIG_HAS_TETIRS WAIT1_Waitms(50); if (TETRIS_Run()==0) { TETRIS_Start(); } #else #if PL_CONFIG_HAS_SHELL #endif #endif } }
//ALIENTEK战舰STM32开发板实验3 //按键输入实验 //技术支持:www.openedv.com //广州市星翼电子科技有限公司 int main(void) { u8 t; delay_init(); //延时函数初始化 LED_Init(); //LED端口初始化 KEY_Init(); //初始化与按键连接的硬件接口 BEEP_Init(); //初始化蜂鸣器端口 LED0=0; //先点亮红灯 while(1) { t=KEY_Scan(0); //得到键值 if(t) { switch(t) { case KEY_UP: //控制蜂鸣器 LED4=!LED4; LED1=!LED1; LED2=!LED2; LED3=!LED3; break; case KEY_LEFT: //控制LED0翻转 LED1=!LED1; break; case KEY_DOWN: //控制LED1翻转 LED2=!LED2; break; case KEY_RIGHT: //同时控制LED0,LED1翻转 LED3=!LED3; break; } }else delay_ms(10); } }
int main(void) { u8 key; Stm32_Clock_Init(336,8,2,7); delay_init(168); LED_Init(); BEEP_Init(); KEY_Init(); LED0 = 0; //点亮红灯 while(1) { key = KEY_Scan(0); // key = KEY_Scan_Custom(0); if(key)//有按键按下 { switch(key) { case WKUP_PRES: BEEP = !BEEP;break; case KEY2_PRES: LED0 = !LED0;break; case KEY1_PRES: LED1 = ~LED1;break; case KEY0_PRES: LED1 = !LED1; LED0 = !LED0;break; } } else delay_ms(10); } }
int main(void) { Key_Def key; LED_Init(); Key_Init(); //Set_Keyint();//设置按键中断方式 while (1) { /* 按键查询方式 */ key = KEY_Scan(); switch (key) { case KEY1: LEDTog(LED1); break; case KEY2: LEDTog(LED2); break; case KEYNULL: break; default : break; } } }
//主任务的任务函数 void main_task(void *p_arg) { u8 key,num; OS_ERR err; u8 *p; while(1) { key = KEY_Scan(0); //扫描按键 if(key==WKUP_PRES) { tmr1sta = !tmr1sta; if(tmr1sta) { OSTmrStart(&tmr1,&err); LCD_ShowString(40,150,100,16,16,"TMR1 START!"); } else { OSTmrStop(&tmr1,OS_OPT_TMR_NONE,0,&err); //停止定时器1 LCD_ShowString(40,150,100,16,16,"TMR1 STOP! "); } } num++; if(num%10==0) check_msg_queue(p);//检查DATA_Msg消息队列的容量 if(num==50) { num=0; LED0 = ~LED0; } OSTimeDlyHMSM(0,0,0,10,OS_OPT_TIME_PERIODIC,&err); //延时10ms } }
void main(void) { u16 trigpos; u8 keycode; SystemState = AutoRunMode; // 现在还是使用软件触发 ADCState = Triggered; // ADCState = WaitTrigger; CLK_Init(); // 主时钟初始化 TIM4_Init(); // TIM4 用于产生系统运行需要的定时信号 KEY_Init(); // 按键驱动初始化 KeyParse_Init(); // 按键处理模块初始化 LCD_Init(); // LCD驱动初始化 WDraw_Init(); // 波形显示模块初始化 TriggerInterruptInit(); // 外部触发中断初始化 ADC_Init(); // ADC采样程控模块初始化 DProc_Init(); // 数据处理模块初始化 enableInterrupts(); /* Infinite loop */ while (1) { if(flag_10ms_ok) { flag_10ms_ok = 0; keycode = KEY_Scan(); switch(GET_KTYPE(keycode)) { case KTYPE_NORMAL: KeyParse(GET_KCODE(keycode)); default: break; } } switch(SystemState) { // to do case AutoRunMode: case ManualMode: // 处理数据 if( ADCState == ADC_Buffer_Full ) { trigpos = GetTriggerPostion(0, 64); WDraw_DisplayUpdate(&ADC_Buffer[trigpos]); ADCState = Triggered; ADC_Index = 0; } break; default: break; } } }
static void APP_Loop(void) { for(;;) { EVNT_HandleEvent(APP_EvntHandler); #if PL_HAS_KEYS && !PL_HAS_KBI KEY_Scan(); /* poll keys */ #endif } /* for */ }
static portTASK_FUNCTION(App_loop, pvParameters) { for(;;) { KEY_Scan(); EVNT_HandleEvent(APP_HandleEvent ) ; FRTOS1_vTaskDelay(10/TRG_TICKS_MS); } }
int main(void) { u16 i,rxlen; u16 lenx; u8 key=0XFF; u8 upload=0; delay_init(); //延时函数初始化 uart_init(38400); //串口初始化为9600 USART2_Init(38400); //初始化串口2 LED_Init(); //初始化与LED连接的硬件接口 KEY_Init(); //初始化与LED连接的硬件接口 LCD_Init(); //初始化LCD POINT_COLOR=RED; LCD_ShowString(30,20,200,16,16,"ALIENTEK STM32 ^_^"); LCD_ShowString(30,40,200,16,16,"NE0-6M GPS TEST"); LCD_ShowString(30,60,200,16,16,"ATOM@ALIENTEK"); LCD_ShowString(30,80,200,16,16,"KEY0:Upload NMEA Data SW"); LCD_ShowString(30,100,200,16,16,"NMEA Data Upload:OFF"); if(Ublox_Cfg_Rate(1000,1)!=0) //设置定位信息更新速度为1000ms,顺便判断GPS模块是否在位. { LCD_ShowString(30,120,200,16,16,"NEO-6M Setting..."); while((Ublox_Cfg_Rate(1000,1)!=0)&&key) //持续判断,直到可以检查到NEO-6M,且数据保存成功 { USART2_Init(9600); //初始化串口2波特率为9600(EEPROM没有保存数据的时候,波特率为9600.) Ublox_Cfg_Prt(38400); //重新设置模块的波特率为38400 USART2_Init(38400); //初始化串口2波特率为38400 Ublox_Cfg_Tp(1000000,100000,1); //设置PPS为1秒钟输出1次,脉冲宽度为100ms key=Ublox_Cfg_Cfg_Save(); //保存配置 } LCD_ShowString(30,120,200,16,16,"NEO-6M Set Done!!"); delay_ms(500); LCD_Fill(30,120,30+200,120+16,WHITE);//清除显示 } while(1) { delay_ms(1); if(USART2_RX_STA&0X8000) //接收到一次数据了 { rxlen=USART2_RX_STA&0X7FFF; //得到数据长度 for(i=0;i<rxlen;i++)USART1_TX_BUF[i]=USART2_RX_BUF[i]; USART2_RX_STA=0; //启动下一次接收 USART1_TX_BUF[i]=0; //自动添加结束符 GPS_Analysis(&gpsx,(u8*)USART1_TX_BUF);//分析字符串 Gps_Msg_Show(); //显示信息 if(upload)printf("\r\n%s\r\n",USART1_TX_BUF);//发送接收到的数据到串口1 } key=KEY_Scan(0); if(key==KEY0_PRES) { upload=!upload; POINT_COLOR=RED; if(upload)LCD_ShowString(30,100,200,16,16,"NMEA Data Upload:ON "); else LCD_ShowString(30,100,200,16,16,"NMEA Data Upload:OFF"); } if((lenx%500)==0)LED0=!LED0; lenx++; } }
int main(void) { u8 key; u16 i=0; u8 datatemp[SIZE]; SystemInit(); delay_init(72); //延时初始化 NVIC_Configuration(); uart_init(9600); LED_Init(); KEY_Init(); LCD_Init(); AT24CXX_Init(); //IIC初始化 POINT_COLOR=RED;//设置字体为蓝色 LCD_ShowString(60,50,"Mini STM32"); LCD_ShowString(60,70,"IIC TEST"); LCD_ShowString(60,90,"ATOM@ALIENTEK"); LCD_ShowString(60,110,"2011/1/1"); while(AT24CXX_Check())//检测不到24c02 { LCD_ShowString(60,130,"24C02 Check Failed!"); delay_ms(500); LCD_ShowString(60,130,"Please Check! "); delay_ms(500); LED0=!LED0;//DS0闪烁 } LCD_ShowString(60,130,"24C02 Ready!"); //显示提示信息 LCD_ShowString(60,150,"KEY0:Write KEY2(WK_UP):Read"); POINT_COLOR=BLUE;//设置字体为蓝色 while(1) { key=KEY_Scan(); if(key==1)//KEY0按下,写入24C02 { LCD_Fill(0,170,239,319,WHITE);//清除半屏 LCD_ShowString(60,170,"Start Write 24C02...."); AT24CXX_Write(0,(u8*)TEXT_Buffer,SIZE); LCD_ShowString(60,170,"24C02 Write Finished!");//提示传送完成 } if(key==3)//KEY_UP按下,读取字符串并显示 { LCD_ShowString(60,170,"Start Read 24C02.... "); AT24CXX_Read(0,datatemp,SIZE); LCD_ShowString(60,170,"The Data Readed Is: ");//提示传送完成 LCD_ShowString(60,190,datatemp);//显示读到的字符串 } i++; delay_ms(10); if(i==20) { LED0=!LED0;//提示系统正在运行 i=0; } } }
int main(void) { u8 key; u8 i=0; SystemInit(); delay_init(72); //延时初始化 NVIC_Configuration(); uart_init(9600); LED_Init(); KEY_Init(); LCD_Init(); POINT_COLOR=RED;//设置字体为蓝色 LCD_ShowString(60,50,"Mini STM32"); LCD_ShowString(60,70,"TOUCH TEST"); LCD_ShowString(60,90,"ATOM@ALIENTEK"); LCD_ShowString(60,110,"2011/1/1"); LCD_ShowString(60,130,"Press KEY0 to Adjust"); Touch_Init(); delay_ms(1500); Load_Drow_Dialog(); while(1) { key=KEY_Scan(); if(Pen_Point.Key_Sta==Key_Down)//触摸屏被按下 { Pen_Int_Set(0);//关闭中断 do { Convert_Pos(); Pen_Point.Key_Sta=Key_Up; if(Pen_Point.X0>216&&Pen_Point.Y0<16)Load_Drow_Dialog();//清除 else { Draw_Big_Point(Pen_Point.X0,Pen_Point.Y0);//画图 GPIOC->ODR|=1<<1; //PC1 上拉 } }while(PEN==0);//如果PEN一直有效,则一直执行 Pen_Int_Set(1);//开启中断 }else delay_ms(10); if(key==1)//KEY0按下,则执行校准程序 { LCD_Clear(WHITE);//清屏 Touch_Adjust(); //屏幕校准 Save_Adjdata(); Load_Drow_Dialog(); } i++; if(i==20) { i=0; LED0=!LED0; } }; }
static void APP_Loop(){ for(;;){ #if PL_HAS_KEYS KEY_Scan(); #endif #if PL_HAS_EVENTS EVNT_HandleEvent(APP_EventHandler); #endif WAIT1_Waitms(50); } }
void TaskLoop(void *pvParameters){ int16_t x,y,z; #if PL_HAS_ACCEL ACCEL_LowLevelInit(); #endif (void)pvParameters; for(;;){ #if PL_HAS_KEYS KEY_Scan(); #endif #if PL_HAS_LINE_SENSOR typ = Line_Detection(); if(typ!=LINE_STATE_NO_LINE){ EVNT_SetEvent(EVNT_LINE); } switch(typ) { case LINE_STATE_LEFT: EVNT_SetEvent(EVNT_LINE_LEFT); break; case LINE_STATE_RIGHT: EVNT_SetEvent(EVNT_LINE_RIGHT); break; case LINE_STATE_AHEAD: EVNT_SetEvent(EVNT_LINE); break; case LINE_STATE_MIDDLE: EVNT_SetEvent(EVNT_LINE); break; case LINE_STATE_NO_LINE: /* No event */ break; case LINE_STATE_LINE: EVNT_SetEvent(EVNT_LINE); break; case LINE_STATE_ERR: EVNT_SetEvent(EVNT_LINE); break; default: /* No event */ break; } #endif #if PL_HAS_ACCEL ACCEL_GetValues(&x,&y,&z); if(z < Z_ACCEL_THRESHOLD){ EVNT_SetEvent(EVNT_ACCEL); } #endif #if PL_HAS_EVENTS EVNT_HandleEvent(APP_EventHandler); #endif FRTOS1_vTaskDelay(5/portTICK_RATE_MS); } }
int main(void) { u8 key,fontok=0; Stm32_Clock_Init(9); //系统时钟设置 delay_init(72); //延时初始化 uart_init(72,115200); //串口1初始化 LCD_Init(); //初始化液晶 LED_Init(); //LED初始化 KEY_Init(); //按键初始化 usmart_dev.init(72); //usmart初始化 USART2_Init(36,115200); //初始化串口2 TP_Init(); //初始化触摸屏 mem_init(SRAMIN); //初始化内部内存池 exfuns_init(); //为fatfs相关变量申请内存 f_mount(0,fs[0]); //挂载SD卡 key=KEY_Scan(0); if(key==KEY_RIGHT) //强制校准 { LCD_Clear(WHITE); //清屏 TP_Adjust(); //屏幕校准 TP_Save_Adjdata(); LCD_Clear(WHITE); //清屏 } fontok=font_init(); //检查字库是否OK if(fontok||key==KEY_DOWN)//需要更新字库 { LCD_Clear(WHITE); //清屏 POINT_COLOR=RED; //设置字体为红色 LCD_ShowString(60,50,200,16,16,"ALIENTEK STM32"); while(SD_Initialize()) //检测SD卡 { LCD_ShowString(60,70,200,16,16,"SD Card Failed!"); delay_ms(200); LCD_Fill(60,70,200+60,70+16,WHITE); delay_ms(200); } LCD_ShowString(60,70,200,16,16,"SD Card OK"); LCD_ShowString(60,90,200,16,16,"Font Updating..."); key=update_font(20,110,16,0);//从SD卡更新 while(key)//更新失败 { LCD_ShowString(60,110,200,16,16,"Font Update Failed!"); delay_ms(200); LCD_Fill(20,110,200+20,110+16,WHITE); delay_ms(200); } LCD_ShowString(60,110,200,16,16,"Font Update Success!"); delay_ms(1500); LCD_Clear(WHITE);//清屏 } sim900a_test(); }
//key任务 void key_task(void *pdata) { u8 key; while(1) { key = KEY_Scan(0); if(key==KEY0_PRES) //发送数据 { tcp_server_flag |= LWIP_SEND_DATA; //标记LWIP有数据要发送; } OSTimeDlyHMSM(0,0,0,10); //延时10ms } }
static void AppTask(void* param) { EVNT_SetEvent(EVNT_STARTUP); /* set startup event */ for(;;) { #if PL_CONFIG_HAS_EVENTS #if PL_CONFIG_EVENTS_AUTO_CLEAR EVNT_HandleEvent(APP_EvntHandler, TRUE); #else EVNT_HandleEvent(APP_EvntHandler, FALSE); #endif #endif #if PL_CONFIG_HAS_KEYS && PL_CONFIG_NOF_KEYS>0 && !PL_CONFIG_HAS_KBI KEY_Scan(); /* scan keys */ #endif //LED1_Neg(); FRTOS1_vTaskDelay(5/portTICK_RATE_MS); } }
void key_diy(void) { key=KEY_Scan(0); switch(key) { case KEY0_PRES: //基础分控制按键 if(key_status==0) key_status=1; //摆脚自然下垂,尽快使之摆脚大于±60° else if(key_status==1) key_status=2; //摆脚自然下垂,尽快使之做圆周运动 else if(key_status==2) key_status=3; //摆脚外力拉起到165°左右,使之倒立不少于5s,横杆转动不大于90° else key_status=0; //显示按键状态 LCD_ShowxNum(150,150,key_status,2,16,0); break; case KEY1_PRES: //发挥部分控制按键 if(key_status==0) key_status=4; //摆脚自然下垂状态下使之尽快摆起倒立,持续10s以上 else if(key_status==4) key_status=5; //摆脚倒立状态下,施加干扰使之能继续保持倒立 else if(key_status==5) key_status=6; //摆脚倒立状态下,使之做圆周转动,尽快转动超过360°(单方向) else if(key_status==6) key_status=7; //其他:加上位置闭环,使摆脚保持在某一位置实现倒立 else key_status=0; //显示按键状态 LCD_ShowxNum(150,150,key_status,2,16,0); break; case KEY2_PRES: flag=1; LCD_ShowString(250,150,50,20,16,(u8 *)"run.."); break; case WKUP_PRES: key_status=0; flag=!flag; //显示按键状态 LCD_ShowxNum(150,150,key_status,2,16,0); LCD_ShowxNum(260,200,flag,2,16,0); break; default: break; } }
int main(void) { /* 初始化 Delay */ DelayInit(); /* 将GPIO设置为输入模式 芯片内部自动配置上拉电阻 */ GPIO_QuickInit(HW_GPIOE, 26, kGPIO_Mode_IPU); /* 设置为输出 */ GPIO_QuickInit(HW_GPIOE, 6, kGPIO_Mode_OPP); while(1) { KEY_Scan(); //调用按键扫描程序 DelayMs(10); if(gRetValue == KEY_SINGLE) //按键按下,小灯反正 { LED1 = !LED1; } } }
static void AppTask(void *pvParameters) { (void)pvParameters; /* not used */ #if PL_HAS_SHELL //CLS1_SendStr("Hello World!\r\n", CLS1_GetStdio()->stdOut); #endif for(;;) { #if PL_HAS_EVENTS EVNT_HandleEvent(APP_EventHandler); /* handle pending events */ #endif #if PL_HAS_KEYS && PL_NOF_KEYS>0 KEY_Scan(); /* scan keys */ #endif #if PL_HAS_MEALY MEALY_Step(); #endif FRTOS1_vTaskDelay(100/portTICK_RATE_MS); } }
/* * Task for Handling the Events and the KeyScan. */ static void APPTask(void *pvParameters) { (void)pvParameters; /* not used */ #if PL_HAS_ACCEL //Initialize Accelometer in a task because it used interrupts, which are disabled when the RTOS is not running. ACCEL_LowLevelInit(); #endif for(;;) { #if PL_HAS_EVENTS EVNT_HandleEvent(APP_EventHandler); /* handle pending events */ #endif #if PL_HAS_KEYS && PL_NOF_KEYS>0 KEY_Scan(); /* scan keys */ #endif FRTOS1_vTaskDelay(100/portTICK_RATE_MS); } }
//选择模式 void select_lwip_mode(void){ u16 times=0; u8 key=0; u8 mode=0; u8 flag=0; POINT_COLOR = BLUE; do{ key=KEY_Scan(); if(key==KEY_UP){ mode++; switch(mode%5){ case 0: lwip_test_mode = LWIP_TCP_SERVER; break; case 1: lwip_test_mode = LWIP_TCP_CLIENT; break; case 2: lwip_test_mode = LWIP_UDP_SERVER; break; case 3: lwip_test_mode = LWIP_UDP_CLIENT; break; case 4: lwip_test_mode = LWIP_WEBSERVER; break; default:break; } } delay_ms(1); times++; if((times%500==0)){ if(!flag){ show_connect_status(); }else{ LCD_ShowString(30,180,200,16,16," "); } flag = !flag; } }while(key!=KEY_DOWN); show_connect_status(); }
static void APP_Loop(void) { int i; #if PL_HAS_SHELL CLS1_SendStr("Hello World!\r\n", CLS1_GetStdio()->stdOut); #endif for(;;) { #if PL_HAS_EVENTS EVNT_HandleEvent(APP_EventHandler); /* handle pending events */ #endif #if PL_HAS_KEYS && PL_NOF_KEYS>0 KEY_Scan(); /* scan keys */ #endif #if PL_HAS_MEALY MEALY_Step(); #endif WAIT1_Waitms(100); } }
void Sys_Init(void) { u8 key,fontok=0; Stm32_Clock_Init(9); //系统时钟设置 delay_init(72); //延时初始化 uart_init(72,115200); //串口1初始化 LCD_Init(); //初始化液晶 LED_Init(); //LED初始化 KEY_Init(); //按键初始化 USART2_Init(36,115200); //初始化串口2 mem_init(); //初始化内部内存池 exfuns_init(); //为fatfs相关变量申请内存 f_mount(fs[0],"0:",1); //挂载SD卡 key = KEY_Scan(0); fontok = font_init(); //检查字库是否OK if(fontok||key == KEY1_PRES)//需要更新字库 (KEY1按下或字库丢失) { LCD_Clear(WHITE); //清屏 POINT_COLOR=RED; //设置字体为红色 LCD_ShowString(70,50,200,16,16,"GSM TEST"); while(SD_Initialize()) //检测SD卡 { LCD_ShowString(60,70,200,16,16,"SD Card Failed!"); delay_ms(200); LCD_Fill(60,70,200+60,70+16,WHITE); delay_ms(200); } LCD_ShowString(60,70,200,16,16,"SD Card OK"); LCD_ShowString(60,90,200,16,16,"Font Updating..."); key = update_font(20,110,16); //更新字库 while(key) //更新失败 { LCD_ShowString(60,110,200,16,16,"Font Update Failed!"); delay_ms(200); LCD_Fill(20,110,200+20,110+16,WHITE); delay_ms(200); } LCD_ShowString(60,110,200,16,16,"Font Update Success!"); delay_ms(1500); LCD_Clear(WHITE);//清屏 } }
static void AppTask(void* param) { const int *whichLED = (int*)param; //(void)param; /* avoid compiler warning */ for(;;) { if (*whichLED==1) { LED1_Neg(); } else if (*whichLED==2) { LED2_Neg(); } #if PL_CONFIG_HAS_KEYS KEY_Scan(); #endif #if PL_CONFIG_HAS_EVENTS EVNT_HandleEvent(APP_EventHandler, TRUE); #endif //FRTOS1_vTaskDelay(500/portTICK_PERIOD_MS); FRTOS1_vTaskDelay(pdMS_TO_TICKS(500)); } }
//char status = 0; static portTASK_FUNCTION(T3, pvParameters) { //char* pstatus = (char*)NVMC_GetStatus(); ACCEL_LowLevelInit(); //if(pstatus != NULL) // { // status = *pstatus; // } for(;;) { /* switch(status) { case 0: //LED_Red_On(); //LED_Green_Off(); break; case 1: //LED_Red_Off(); //LED_Green_Off(); break; case 2: //LED_Red_Off(); //LED_Green_On(); break; } */ KEY_Scan(); FRTOS1_vTaskDelay(50); //status = (status+1) % 3; } }
static void AppTask(void* param) { //CLS1_SendStr("INFO: Application startup!\r\n", CLS1_GetStdio()->stdOut); EVENT_Set(EVENT_Start); ///*Sets the start up event while(1) { EVENT_HandleEvent(APP_HandleEvents); #if PL_HAS_KEYS && PL_NUM_KEYS > 0 KEY_Scan(); ///*Scans the Joystick shield for input #endif #if PL_HAS_MEALY MEALY_Step(); #endif LED1_TOGGLE; FRTOS1_vTaskDelay(10 / portTICK_RATE_MS); } }
static portTASK_FUNCTION(MainTask, pvParameters) { (void)pvParameters; /* parameter not used */ #if PL_HAS_ACCEL (void)ACCEL_LowLevelInit(); #endif for(;;) { #if PL_HAS_KEYS && !PL_HAS_KBI /* poll keys */ KEY_Scan(); /* poll keys */ #endif EVNT_HandleEvent(APP_HandleEvent); #if PL_HAS_FREEMASTER FMSTR1_Poll(); FMSTR1_Recorder(); #endif #if PL_HAS_ULTRASONIC //(void)US_Measure_us(); #endif FRTOS1_vTaskDelay(20/portTICK_RATE_MS); } }