Status startScheduler() { if (startScheduler(FLAGS_schedule_timeout, 1).ok()) { Dispatcher::joinServices(); return Status(0, "OK"); } return Status(1, "Could not start scheduler"); }
//#define analogTime 10 //static RunEveryData asyncSched = {0,analogTime}; void runDyIOMain(void) { startScheduler(); AVR_Bowler_HAL_Init(); Bowler_Init();// Com Stack Init. Sets up timeout timer, uart 0 and if debug enabled, uart 1 UserInit();// User code init while (1) { //start = getMs(); UserRun(); server(); // //float one = getMs(); // if(FlagAsync == FLAG_OK ){ // if(checkDigital()) // server(); // }else{ // //println_I("Skipping D async"); // } // //float two = getMs(); // server(); // //float three = getMs(); // if(FlagAsync == FLAG_OK ){ // if (RunEvery(&asyncSched)>0){ // if(checkAnalog()) // server(); // }else{ // now = getMs(); // if(!((asyncSched.MsTime >= 0) && (asyncSched.MsTime <= now))){ //#if ! defined(__AVR_ATmega324P__) // println_E("Reseting async time, was=");p_fl_E(asyncSched.MsTime);print_E(" is=");p_fl_E(now); // println_E("Timer in ticks:");p_int_E(GetTimeTicks()); //#endif // asyncSched.setPoint = analogTime; // asyncSched.MsTime=now; // server(); // } // // } // }else{ // //println_I("Skipping A async"); // } // //float four = getMs(); // server(); // float five = getMs(); // println_I("TOTAL ");p_fl_I(start-five); // println_I("\t\tDone servo ");p_fl_I(start-one); // println_I("\t\tDone Dig ");p_fl_I(one-two); // println_I("\t\tDone Server 1");p_fl_I(two-three); // println_I("\t\tDone Analog ");p_fl_I(three-four); // println_I("\t\tDone Server 2");p_fl_I(four-five); } }
int main ( void ) { init_print (); int0_init (); initializeScheduler (); createTask ( &function_1, "fun_one", 1, 200 ); createTask ( &function_2, "fun_two", 2, 200 ); createTask ( &function_3, "fun_three", 3, 200 ); createTask ( &function_4, "fun_four", 4, 50 ); startScheduler (); return 0; }
//#define analogTime 10 // RunEveryData asyncSched = {0,analogTime}; void runDyIOMain(void) { UCSR1B=0; UCSR1C=0; UCSR1A=0; // // UCSR0B=0; // UCSR0C=0; // UCSR0A=0; startScheduler(); AVR_Bowler_HAL_Init(); Bowler_Init();// Com Stack Init. Sets up timeout timer, uart 0 and if debug enabled, uart 1 UserInit();// User code init setPrintLevelWarningPrint(); // GetIOChannelCountFromPacket(&Packet); // FixPacket(&Packet); // printPacket(&Packet,WARN_PRINT); while (1) { //Run from Interrupts only Server(); } }
void startScheduler() { startScheduler(static_cast<unsigned long int>(FLAGS_schedule_timeout), 1); }