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 2626#include  " mbed/rtos/rtos.h" 
2727#include  " mbed/platform/mbed_wait_api.h" 
2828
29+ using  namespace  std ::chrono_literals; 
30+ using  namespace  std ::chrono; 
31+ 
32+ static  mbed::Timer timer;
33+ 
2934#if  DEVICE_LPTICKER
30- static  mbed::LowPowerTimer t ;
35+   static  mbed::LowPowerTimer lowPowerTimer ;
3136#else 
32- static  mbed::Timer t;
37+  //  Fallback for devices which don't support
38+  //  a low power ticker.
39+  static  mbed::Timer lowPowerTimer;
3340#endif 
3441
35- using  namespace  std ::chrono_literals; 
36- using  namespace  std ::chrono; 
37- 
3842unsigned  long  millis ()
3943{
40-  return  duration_cast<milliseconds>(t .elapsed_time ()).count ();
44+  return  duration_cast<milliseconds>(lowPowerTimer .elapsed_time ()).count ();
4145}
4246
4347unsigned  long  micros () {
44-  return  t .elapsed_time ().count ();
48+  return  timer .elapsed_time ().count ();
4549}
4650
4751void  delay (unsigned  long  ms)
@@ -60,7 +64,8 @@ void delayMicroseconds(unsigned int us)
6064
6165void  init ()
6266{
63-  t.start ();
67+  timer.start ();
68+  lowPowerTimer.start ();
6469}
6570
6671void  yield () {
                         You can’t perform that action at this time. 
           
                  
0 commit comments