The SystemTimer allows an ExpiryCallback be executed at a set time in the future.
The base SystemTimer only supports a one-shot style timer with a callback. A periodic timer can be implemented by rescheduling the timer in the callback through InvokeAt(kDesiredPeriod + expired_deadline).
When implementing a periodic layer on top, the user should be mindful of handling missed periodic callbacks. They could opt to invoke the callback multiple times with the expected expired_deadline values or instead saturate and invoke the callback only once with the latest expired_deadline.
The entire API is thread safe, however it is NOT always IRQ safe.
Public Types | |
| using | native_handle_type = backend::NativeSystemTimerHandle |
| using | ExpiryCallback = Function< void(SystemClock::time_point expired_deadline)> |
Public Member Functions | |
| SystemTimer (ExpiryCallback &&callback) | |
| ~SystemTimer () | |
| SystemTimer (const SystemTimer &)=delete | |
| SystemTimer (SystemTimer &&)=delete | |
| SystemTimer & | operator= (const SystemTimer &)=delete |
| SystemTimer & | operator= (SystemTimer &&)=delete |
| void | InvokeAfter (SystemClock::duration delay) |
| void | InvokeAt (SystemClock::time_point timestamp) |
| void | Cancel () |
| native_handle_type | native_handle () |