/** * @function main * @brief entry point * @param none * @return dummy */ int32_t main(void) { timer_t tmInit; UcInit(); /*uc init; shall be the first one*/ TicksInit(); /*software clock init*/ LCD_Init(); /*start the ILI932X*/ /* start a timer; backlight will be turned on once this timer will elapse * -> this avoids a white flash*/ tmInit = GetTimeout(120); P2D_Init(); GUI_Init(); TouchScreenCalib(NULL); TouchScreenEnable(); /*mount the file system*/ disk_initialize(0); f_mount(0, &Fatfs); /* wait the 120ms timeout */ while(IsTimerElapsed(tmInit) == false) DelayMs(1); BacklightInit(); /*set the main task*/ pCurrentTask = &SetupTask; /*main loop*/ while(1) { /*execute the main task, if any*/ if(pCurrentTask != NULL) pCurrentTask(); /*GUI task*/ GUI_DrawObjects(); GUI_DBG_Task(); /*software RTC task*/ RtcTask(); /*CPU limiter; reduces the power consumption*/ DelayMs(1); } /*never arrive here*/ return -1; }
/* Semantik: Event tasks are functions, that need to be called when a signal is set. In most cases the signal is set by an IRQ handler and the event task is the bottom half. Events therefore have a higher priority than normal tasks. Before a normal task is allowed to run, all pending events are handled. TODO priority within events is not implemented and fast recurring events are not handled here. TODO we could add some functions to attach/detach a handler to/from each signal */ static void handle_events(){ if (signal_is_set(SIG_TIMER)) timer_tick(); #if 0 if (signal_is_set(SIG_NEW_TIME)) NewTimeTask(); #endif #if 0 if (signal_is_set(SIG_RTC)) RtcTask(); #endif #if 0 if (pending_tasks & (1<<5)){ RTCget_busy = 0; RTCtest(task3_dat); }; #endif if (signal_is_set(SIG_RX_PACKET)) { rfRcvPacket(); }; #if 0 if (signal_is_set(SIG_NEW_PACKET)) { signal_clr(SIG_NEW_PACKET); pkt_cnt++; packet[packet_length] = 0; process_packet((char *)packet, packet_length); }; #endif #if 0 if (signal_is_set(SIG_TX)){ do_tx(); }; #endif #if 0 if (signal_is_set(SIG_KEYSCAN)) { key_scan(); }; #endif #if 1 if (signal_is_set(SIG_KEY_CHG)) { key_change(); }; #endif #if 0 if (signal_is_set(SIG_RTC_INT)) { Task30(); }; #endif #if 0 if (signal_is_set(SIG_RTC_UNLOCK)) { rtc_unlock(); }; #endif #if 1 // SIG_NONE is used, when the API needs a signal, but no handler needs to be invoked if (signal_is_set(SIG_NONE)) { signal_clr(SIG_NONE); }; #endif }