int main(void) { /* Watchdog timer disabled */ WDTCTL = WDTPW + WDTHOLD; BspInit(); DioInit(); DioSet(BUTTON0); UartInit(9600, UartCallback); LedInit(); ButtonInit(); ButtonSetup(0, Button0Cbf, 20); LedOn(0); SchedulerInit(100, 1, 2); // 1ms tick, 1 timed task, 2 loop task SetSchedulerTimedTask(LedRedFlash, 0, 500, 0); // schedule timed_task[0] as led_red_flash, set off every 500ms SetSchedulerLoopTask(ButtonLoop, 0); // schedule loop_task[0] as button_loop SetSchedulerLoopTask(UartManage, 1); // schedule loop_task[1] as uart_loop __eint(); SchedulerRun(); while(1) { } }
void main (void) { TTaskHandle xdata A2DTaskHandle, HeaterStatusTaskHandle, HeaterControlTaskHandle; TTaskHandle xdata EdenProtocolTaskHandle, OHDBMessageDecodeTaskHandle; WDTCN = 0xde; // disable watchdog timer WDTCN = 0xad; XBR_Init(); // Initialize cross bars SysClkInit(); Uart0Init(); Timer_0_Init(); SchedulerInit(); InitCoolingFans(); // Material and UV XilinxWatchdogInit(); SpiA2D_Init(); A2D_Init(); SpiInit(); E2PROMInit(); XilinxInit(); OHDBPotenmtrInit(); Roller_Init(); Bumper_Init(); CommunicationLossTaskInit(); EdenProtocolInit(); MessageDecodeInitOHDB(); HeadData_Init(); EA |= ENABLE; HeaterControlInit(); PrintDrv_Init(); SendWakeUpNotification(); HeadData_ReadDataFromAllE2PROMs(); A2DTaskHandle = SchedulerInstallTask(SpiA2D_Task); EdenProtocolTaskHandle = SchedulerInstallTask(EdenProtocolDecodeTask); OHDBMessageDecodeTaskHandle = SchedulerInstallTask(OHDBMessageDecodeTask); HeaterStatusTaskHandle = SchedulerInstallTask(HeaterStatusTask); HeaterControlTaskHandle = SchedulerInstallTask(HeaterControlTask); HeaterSetTasksHandles(HeaterStatusTaskHandle, HeaterControlTaskHandle); SchedulerResumeTask(GetXilinxWatchdogTaskHandle(),0); SchedulerResumeTask(A2DTaskHandle,0); SchedulerResumeTask(HeaterStatusTaskHandle,0); SchedulerResumeTask(EdenProtocolTaskHandle,0); SchedulerResumeTask(OHDBMessageDecodeTaskHandle,0); while(1) { SchedulerRun(); } }
/** * Main function - leader_follower */ int main(void) { // Seed the pseudo-random number generator unsigned int seed = 0; usrand(seed); initialize(); while(1) { // Tell the scheduler to call any periodic tasks that are due to be called. SchedulerRun(); } return 0; }
//***************************************************************************** // // The main entry point for the qs-autonomous example. It initializes the // system, then eners a forever loop where it runs the scheduler. The // scheduler then periodically calls all the tasks in the example to keep // the program running. // //***************************************************************************** int main (void) { // // Set the system clock to run at 50MHz from the PLL // ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); // // Enable UART0, to be used as a serial console. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); // // Initialize the UART standard I/O. // UARTStdioInit(0); UARTprintf("EVALBOT starting\n"); // // Initialize the simple scheduler to use a tick rate of 100 Hz. // SchedulerInit(100); // // Initialize all the tasks used in the example. // DriveInit(); DisplayTaskInit(); LEDTaskInit(); SoundTaskInit(); AutoTaskInit(); // // Enter a forever loop and call the scheduler. The scheduler will // periodically call all the tasks in the system according to the timeout // value of each task. // for(;;) { SchedulerRun(); } }
int main(int argc, char* argv[], char** envp) { scheduler_t *s1 = NULL; uuid_t uid1; /*-----------SchedulerCreate_1----------*/ printf("\n[%s %s %d]SchedulerCreate_1\n", __FILE__, __func__, __LINE__); s1 = SchedulerCreate(); assert(s1); /*-----------SchedulerIsEmpty_1----------*/ printf("\n[%s %s %d]SchedulerIsEmpty_1\n", __FILE__, __func__, __LINE__); printf("SchedulerIsEmpty(s1):%d\n", SchedulerIsEmpty(s1)); /*-----------SchedulerInsertTask_1----------*/ printf("\n[%s %s %d]SchedulerInsertTask_1\n", __FILE__, __func__, __LINE__); uid1 = SchedulerInsertTask(s1, &DoFunc, (void*)1, (time_t)2); printf("uid1.counter:%lu expected result:1\n", uid1.counter); printf("uid1.tmal.tv_usec:%lu\n", uid1.tval.tv_usec); /*-----------SchedulerRemove_1----------*/ printf("\n[%s %s %d]SchedulerRemove_1\n", __FILE__, __func__, __LINE__); /* printf("SchedulerRemove(s1, uid1):%d", SchedulerRemove(s1, uid1));*/ /*-----------SchedulerRun_1----------*/ printf("\n[%s %s %d]SchedulerRun_1\n", __FILE__, __func__, __LINE__); printf("SchedulerRun(s1):%d\n", SchedulerRun(s1)); /*-----------SchedulerDestroy_1----------*/ printf("\n[%s %s %d]SchedulerDestroy_1\n", __FILE__, __func__, __LINE__); SchedulerDestroy(s1); return(0); }
/***************************************************************************** * FUNCTION IMPLEMENTATIONS *****************************************************************************/ int main(void) { /* One-time initialization of hardware */ vInit(); SchedulerInit(TICKS_PER_SECOND); char statusStr[96]; int sounddemo=0; // sound demo SoundVolumeSet(80); // less obnoxious during testing while (1) { SchedulerRun(); // to get measurements // currentMeasuredDistance // to play sound // soundStart(sounddemo) where soundemo is 0-9 // A DEMO OF SOUNDS /////////////////////////////////////////////////// if(GamepadButtons.buttonA && bWavPlaying==false) { usprintf(statusStr,"sound=%d\r",sounddemo); Display96x16x1StringDrawCentered(statusStr,0,false); sounddemo = soundStart(sounddemo); // returns the actual sound index used sounddemo++; } } /* This should never happen */ return 0; }