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 } }
static portTASK_FUNCTION(MainTask, pvParameters) { (void)pvParameters; /* not used */ #if PL_HAS_TSS Configure(); /* initialize TSS library */ #endif for(;;) { #if PL_HAS_TSS TSS_Task(); /* call TSS library to process touches */ #else CheckButton(); #endif #if PL_APP_FOLLOW_OBSTACLE FollowObstacle(); #endif #if PL_HAS_LED_BLUE LEDB_Neg(); #endif #if PL_HAS_RADIO (void)RADIO_Handle(); #endif #if PL_HAS_EVENTS EVNT_HandleEvent(RADIO_AppHandleEvent); #endif StateMachine(FALSE); FRTOS1_vTaskDelay(10/portTICK_RATE_MS); } }
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 }
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; } } }
static portTASK_FUNCTION(App_loop, pvParameters) { for(;;) { KEY_Scan(); EVNT_HandleEvent(APP_HandleEvent ) ; FRTOS1_vTaskDelay(10/TRG_TICKS_MS); } }
static void APP_Loop(void) { for(;;) { EVNT_HandleEvent(APP_EvntHandler); #if PL_HAS_KEYS && !PL_HAS_KBI KEY_Scan(); /* poll keys */ #endif } /* for */ }
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 MainTask(void *pvParameters){ while(1) { KEYDBNC_Process(); EVNT_HandleEvent(myEvents); FRTOS1_vTaskDelay(50/portTICK_RATE_MS); } }
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); } }
/* * 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); } }
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); } }
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); } }
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)); } }
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); } }