Arduino Core API Library besed on mbed platform.
Dependents: WeeESP8266 ESP8266_moj
Diff: time.cpp
- Revision:
- 0:5ebc917ebd09
diff -r 000000000000 -r 5ebc917ebd09 time.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/time.cpp Thu Feb 05 07:24:30 2015 +0000 @@ -0,0 +1,21 @@ +#include "time.h" + +static unsigned long one_millisecond_counter = 0; +static void one_millisecond_callback(void) { + one_millisecond_counter++; +} + +unsigned long millis(void) { + static Ticker milli_timer; + static bool attach_flag = true; + if (attach_flag) { + attach_flag = false; + milli_timer.attach_us(&one_millisecond_callback, 1000); + } + return one_millisecond_counter; +} + +void delay(int t) +{ + wait_ms(t); +} \ No newline at end of file