static void uptime(Bitmap *bm) { gfx_bitmapClear(bm); text_xprintf(bm, 0, 0, TEXT_FILL | TEXT_CENTER, "Uptime"); while (1) { ticks_t clock = ticks_to_ms(timer_clock_unlocked()); /* Display uptime (in ticks) */ text_xprintf(&lcd_bitmap, 2, 0, TEXT_FILL | TEXT_CENTER, "seconds: %lu", clock / 1000); lcd_ili9225_blitBitmap(bm); timer_delay(5); if (kbd_peek() & KEY_MASK) break; } }
static void check_run_mode(void){ if(currentMode == g_settings.run_mode){ return; } static ticks_t start = 0; ticks_t now = timer_clock_unlocked(); if(start == 0){ start = now; }else if(now - start > ms_to_ticks(10000)){ if(currentMode != g_settings.run_mode){ char c[2]; c[0] = (g_settings.run_mode + 48); c[1] = 0; cmd_switch_mode(&g_serial,c,1); } } }
INLINE hptime_t get_hp_ticks(void) { return (timer_clock_unlocked() * TIMER_HW_CNT) + timer_hw_hpread(); }
int main(void){ init(); while (1){ /* * This function will look for new messages from the AFSK channel. * It will call the message_callback() function when a new message is received. * If there's nothing to do, this function will call cpu_relax() */ ax25_poll(&g_ax25); check_run_mode(); switch(currentMode){ case MODE_CFG: #if MOD_CONSOLE console_poll(); #endif #if MOD_BEACON beacon_broadcast_poll(); #endif break; #if MOD_TRACKER case MODE_TRACKER: tracker_poll(); break; #endif #if MOD_KISS case MODE_KISS:{ kiss_poll(); break; } #endif #if MOD_DIGI case MODE_DIGI:{ console_poll(); beacon_broadcast_poll(); break; } #endif default: break; }// end of switch(runMode) #if DEBUG_FREE_RAM { static ticks_t ts = 0; if(timer_clock_unlocked() - ts > ms_to_ticks(5000)){ ts = timer_clock_unlocked(); uint16_t ram = freeRam(); SERIAL_PRINTF((&g_serial),"%u\r\n",ram); } } #endif #if DEBUG_SOFT_SER // Dump the isr changes { SoftSerial *softSer = radioPort; static uint32_t i = 0; //static uint32_t j = 0; if(i++ == 30000){ i = 0; char c; while(softser_avail(softSer)){ c = softser_read(softSer); kfile_putc(c,&(g_serial.fd)); } char buf[8]; sprintf_P(buf,PSTR("0K\n\r")); softser_print(softSer,buf); } } #endif } // end of while(1) return 0; }