#include "timer.h" #include "io.h" static uint64_t __time_us; static uint64_t __delta_time_us; unsigned long time_micros() { #ifdef __linux__ return 0; #else return millis()*1000; #endif } void micro_sleep(unsigned long x) { #ifdef __linux__ usleep(x); #else delay(x/1000); #endif } void timer_init() { __time_us=0; } uint64_t get_time_us() { return millis()*1000; } void set_delta() { __delta_time_us=__time_us; } uint64_t get_delta() { return __time_us-__delta_time_us; }