int main(void) { tm gmt; WatchDogDisable(); NutDelay(100); SysInitIO(); SPIinit(); LedInit(); LcdLowLevelInit(); Uart0DriverInit(); Uart0DriverStart(); LogInit(); LogMsg_P(LOG_INFO, PSTR("-----------------------------------------------------------------------------------------------")); CardInit(); X12Init(); if (X12RtcGetClock(&gmt) == 0) { LogMsg_P(LOG_INFO, PSTR("RTC time [%02d:%02d:%02d]\n"), gmt.tm_hour, gmt.tm_min, gmt.tm_sec ); } if (At45dbInit() == AT45DB041B) { } RcInit(); KbInit(); SysControlMainBeat(ON); // enable 4.4 msecs hartbeat interrupt NutThreadSetPriority(1); NutTimerInit(); sei(); printf("\nreading EEPROM\n"); NutSleep(1000); readEEPROM(); printf("UTC: %d\n",IMCconfig.UTC); NutSleep(1000); IMCconfig.UTC++; printf("na ophoging UTC: %d\n",IMCconfig.UTC); saveEEPROM(); NutSleep(1000); readEEPROM(); printf("na saving en reading UTC: %d\n",IMCconfig.UTC); printf("\nResetting EEPROM\n"); NutSleep(1000); resetEEPROM(); NutSleep(1000); readEEPROM(); for (;;) { } return(0); // never reached, but 'main()' returns a non-void, so..... }
THREAD(idle, arg) { NutTimerInit(); NutThreadCreate("main", WebDemo, 0, 768); NutThreadSetPriority(254); for (;;) { #ifdef HEARTBEAT_BIT HeartBeat(); #endif NutThreadYield(); } }
int main(void) { tm gmt; WatchDogDisable(); NutDelay(100); SysInitIO(); SPIinit(); LedInit(); LcdLowLevelInit(); Uart0DriverInit(); Uart0DriverStart(); LogInit(); LogMsg_P(LOG_INFO, PSTR("-----------------------------------------------------------------------------------------------")); CardInit(); X12Init(); if (X12RtcGetClock(&gmt) == 0) { LogMsg_P(LOG_INFO, PSTR("RTC time [%02d:%02d:%02d]\n"), gmt.tm_hour, gmt.tm_min, gmt.tm_sec ); } if (At45dbInit() == AT45DB041B) { } RcInit(); KbInit(); SysControlMainBeat(ON); // enable 4.4 msecs hartbeat interrupt initMenu(); sei(); NutTimerInit(); NutThreadSetPriority(1); int keyvalue = KbGetKey(); int old; LcdBackLight(LCD_BACKLIGHT_ON); if(NutRegisterDevice(&DEV_ETHER, 0x8300, 5))printf("Error: No LAN device\n"); else printf("Lan device initialized\n"); for (;;) { keyvalue = KbGetKey(); if(old != keyvalue){ stateMenu(keyvalue); old = keyvalue; } NutSleep(100); WatchDogRestart(); } return(0); // never reached, but 'main()' returns a non-void, so..... }
/* \fn NutIdle(void *arg) * \brief Idle thread. * * After initializing the timers, the idle thread switches to priority 254 * and enters an endless loop. */ THREAD(NutIdle, arg) { /* Initialize system timers. */ NutTimerInit(); /* Create the main application thread. */ NutThreadCreate("main", main, 0, 768); /* * Run in an idle loop at the lowest priority. We can still * do something useful here, like killing terminated threads * or putting the CPU into sleep mode. */ NutThreadSetPriority(254); for (;;) { NutThreadYield(); NutThreadDestroy(); } }
/*! * \brief Emulated idle thread. * * After initializing the timers, the idle thread switches to priority 254 * and enters an endless loop. */ THREAD(NutIdle, arg) { /* Initialize system timers. */ NutTimerInit(); /* Create the main application thread. */ NutThreadCreate("main", NutAppMain, 0, NUT_THREAD_MAINSTACK); // printf("main task created, idling now..\n"); /* * Run in an idle loop at the lowest priority. We can still * do something useful here, like killing terminated threads * or putting the CPU into sleep mode. */ NutThreadSetPriority(254); for (;;) { NutThreadYield(); NutThreadDestroy(); // sleep(); ... sleeping would be fine. } }