void APP_Run(void) { appState = APP_STATE_INIT; MOT_Init(); SHELL_Init(); #if PL_HAS_LINE_SENSOR REF_Init(); LF_Init(); TURN_Init(); #endif #if PL_HAS_ULTRASONIC US_Init(); #endif #if PL_HAS_BUZZER BUZ_Init(); #endif #if PL_HAS_EVENTS EVNT_Init(); #endif #if PL_HAS_RADIO RADIO_Init(); #endif #if PL_HAS_REMOTE REMOTE_Init(); #endif #if PL_HAS_QUEUE QUEUE_Init(); #endif if (FRTOS1_xTaskCreate(MainTask, (signed portCHAR *)"Main", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+1, NULL) != pdPASS) { for(;;){} /* error */ } FRTOS1_vTaskStartScheduler(); }
void APP_Run(void) { SHELL_Init(); US_Init(); INF_Init(); FRTOS1_vTaskStartScheduler(); }
void APP_Run(void) { appState = APP_STATE_INIT; REF_Init(); MOT_Init(); SHELL_Init(); LF_Init(); TURN_Init(); #if 0 US_Init(); #endif #if PL_HAS_BUZZER BUZ_Init(); #endif if (FRTOS1_xTaskCreate(MainTask, (signed portCHAR *)"Main", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY+1, NULL) != pdPASS) { for(;;){} /* error */ } FRTOS1_vTaskStartScheduler(); }
/**\fn US_Main(void) * \brief Main task loop for US sensors * * Main task loop for Ultrasonic sensors */ void US_Main(void) { uint16_t microseconds, distance, tMessage = 0; US_Init(); /* delay for 1/4 second to allow other sensors to init */ FRTOS1_vTaskDelay(250/portTICK_RATE_MS); US_Message message; for(;;) { /* check for a temperature message and update temperature */ if(xQueueReceive(musQueueHandle, &tMessage, (portTickType)1)) { temperature = tMessage; } /* Loop through each sensor, measure, and send off to the queue */ for (usCounter = 0; usCounter < 4; usCounter++) { usDevices.currentDevice = usCounter; microseconds = US_Measure_us(usCounter); if (microseconds > 0) { distance = US_usToMM(microseconds, temperature); } else { distance = 0; /* overflowed */ } message.sensor = usCounter; message.distance = distance; xQueueSend(usQueueHandle, (void*)&message, (portTickType)5); /*send the message, block up to 5 ticks if queue isn't free */ FRTOS1_vTaskDelay(10/portTICK_RATE_MS); } } }
void PL_Init(void) { #if PL_CONFIG_HAS_LED LED_Init(); #endif #if PL_CONFIG_HAS_EVENTS EVNT_Init(); #endif #if PL_CONFIG_HAS_TIMER TMR_Init(); #endif #if PL_CONFIG_HAS_TRIGGER TRG_Init(); #endif #if PL_CONFIG_HAS_BUZZER BUZ_Init(); #endif #if PL_CONFIG_HAS_RTOS RTOS_Init(); #endif #if PL_CONFIG_HAS_SHELL SHELL_Init(); #endif #if PL_CONFIG_HAS_SHELL_QUEUE SQUEUE_Init(); #endif #if PL_CONFIG_HAS_MOTOR MOT_Init(); #endif #if PL_CONFIG_HAS_LINE_SENSOR REF_Init(); #endif #if PL_CONFIG_HAS_MOTOR_TACHO TACHO_Init(); #endif #if PL_CONFIG_HAS_MCP4728 MCP4728_Init(); #endif #if PL_CONFIG_HAS_ULTRASONIC US_Init(); #endif #if PL_CONFIG_HAS_PID PID_Init(); #endif #if PL_CONFIG_HAS_DRIVE DRV_Init(); #endif #if PL_CONFIG_HAS_TURN TURN_Init(); #endif #if PL_CONFIG_HAS_LINE_FOLLOW LF_Init(); #endif #if PL_CONFIG_HAS_RADIO RNETA_Init(); #endif #if PL_CONFIG_HAS_REMOTE REMOTE_Init(); #endif #if PL_CONFIG_HAS_IDENTIFY ID_Init(); #endif #if PL_CONFIG_HAS_LINE_MAZE MAZE_Init(); #endif }