https://github.com/WebBluetoothCG/demos/pull/42
Dependencies: BLE_API mbed-dev-bin nRF51822
Fork of microbit-dal by
Diff: inc/core/MicroBitSystemTimer.h
- Revision:
- 31:87789e55bac7
- Parent:
- 1:8aa5cdb4ab67
- Child:
- 32:ece16b5987dd
diff -r db87179335d5 -r 87789e55bac7 inc/core/MicroBitSystemTimer.h --- a/inc/core/MicroBitSystemTimer.h Wed Jul 13 12:18:08 2016 +0100 +++ b/inc/core/MicroBitSystemTimer.h Wed Jul 13 12:18:10 2016 +0100 @@ -43,7 +43,7 @@ #include "MicroBitComponent.h" /** - * Initialises the system wide timer. + * Initialises a system wide timer, used to drive the various components used in the runtime. * * This must be called before any components register to receive periodic periodic callbacks. * @@ -70,11 +70,26 @@ int system_timer_get_period(); /** + * Updates the current time in microseconds, since power on. + * + * If the mbed Timer hasn't been initialised, it will be initialised + * on the first call to this function. + */ +inline void update_time(); + +/** * Determines the time since the device was powered on. * * @return the current time since power on in milliseconds */ -unsigned long system_timer_current_time(); +uint64_t system_timer_current_time(); + +/** + * Determines the time since the device was powered on. + * + * @return the current time since power on in microseconds + */ +uint64_t system_timer_current_time_us(); /** * Timer callback. Called from interrupt context, once per period. @@ -146,4 +161,4 @@ } }; -#endif +#endif \ No newline at end of file