RTLib
|
HAL implementation for system clock. More...
#include <system.h>
Public Types | |
enum | ClockResolution : uint32_t { kLowRes = 1, kStdRes = 1000, kHighRes = 1000000 } |
Enumeration of clock resolution. More... | |
Public Member Functions | |
System ()=delete | |
Default constructor for System. More... | |
Static Public Member Functions | |
static void | Init (ClockResolution clock_res=kStdRes) |
Initializes the timekeeping functionality. More... | |
static uint64_t | GetUs () |
Returns the time since clock initialization. More... | |
static uint64_t | GetMs () |
Returns the time since clock initialization. More... | |
static uint64_t | GetS () |
Returns the time since clock initialization. More... | |
static void | DelayUs (uint64_t wait_us) |
Temporarily halt program execution. More... | |
static void | DelayMs (uint64_t wait_ms) |
Temporarily halt program execution. More... | |
static void | DelayS (uint64_t wait_s) |
Temporarily halt program execution. More... | |
HAL implementation for system clock.
This abstraction layer provides timekeeping functionality. Since there is only one system clock, member functions can be called directly.
To use this class, Init() must be called. Otherwise, any of the member functions will not work as intended.
enum System::ClockResolution : uint32_t |
Enumeration of clock resolution.
Generally, System::kStdRes will be used for its balance between accuracy and performance. Other accuracies are only for testing purposes.
|
delete |
Default constructor for System.
This constructor is disabled to enforce a static class (singleton) pattern.
|
static |
Temporarily halt program execution.
It is recommended to use this function if you use a standard resolution clock.
wait_ms | Milliseconds to wait. |
|
static |
Temporarily halt program execution.
It is recommended to use this function if you use a low resolution clock.
wait_s | Seconds to wait. |
|
static |
Temporarily halt program execution.
It is recommended to use this function if you use a high resolution clock.
wait_us | Microseconds to wait. |
|
static |
Returns the time since clock initialization.
It is recommended to use this function if you use a standard resolution clock.
|
static |
Returns the time since clock initialization.
It is recommended to use this function if you use a low resolution clock.
|
static |
Returns the time since clock initialization.
It is recommended to use this function if you use a high resolution clock.
|
static |
Initializes the timekeeping functionality.
clock_res | Resolution of the clock. Defaults to 1 ms/update. |