Arduino Core API Library besed on mbed platform.
Dependents: WeeESP8266 ESP8266_moj
time.cpp
00001 #include "time.h" 00002 00003 static unsigned long one_millisecond_counter = 0; 00004 static void one_millisecond_callback(void) { 00005 one_millisecond_counter++; 00006 } 00007 00008 unsigned long millis(void) { 00009 static Ticker milli_timer; 00010 static bool attach_flag = true; 00011 if (attach_flag) { 00012 attach_flag = false; 00013 milli_timer.attach_us(&one_millisecond_callback, 1000); 00014 } 00015 return one_millisecond_counter; 00016 } 00017 00018 void delay(int t) 00019 { 00020 wait_ms(t); 00021 }
Generated on Mon Jul 25 2022 12:21:32 by 1.7.2