File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change 26
26
#include " mbed/rtos/rtos.h"
27
27
#include " mbed/platform/mbed_wait_api.h"
28
28
29
+ using namespace std ::chrono_literals;
30
+ using namespace std ::chrono;
31
+
32
+ static mbed::Timer timer;
33
+
29
34
#if DEVICE_LPTICKER
30
- static mbed::LowPowerTimer t ;
35
+ static mbed::LowPowerTimer lowPowerTimer ;
31
36
#else
32
- static mbed::Timer t;
37
+ // Fallback for devices which don't support
38
+ // a low power ticker.
39
+ static mbed::Timer lowPowerTimer;
33
40
#endif
34
41
35
- using namespace std ::chrono_literals;
36
- using namespace std ::chrono;
37
-
38
42
unsigned long millis ()
39
43
{
40
- return duration_cast<milliseconds>(t .elapsed_time ()).count ();
44
+ return duration_cast<milliseconds>(lowPowerTimer .elapsed_time ()).count ();
41
45
}
42
46
43
47
unsigned long micros () {
44
- return t .elapsed_time ().count ();
48
+ return timer .elapsed_time ().count ();
45
49
}
46
50
47
51
void delay (unsigned long ms)
@@ -60,7 +64,8 @@ void delayMicroseconds(unsigned int us)
60
64
61
65
void init ()
62
66
{
63
- t.start ();
67
+ timer.start ();
68
+ lowPowerTimer.start ();
64
69
}
65
70
66
71
void yield () {
You can’t perform that action at this time.
0 commit comments