pub struct TimeBase { /* private fields */ }Expand description
A handle to an OSAL time base.
A time base is an abstraction of a “timer tick” that can be used for measuring elapsed time or scheduling timer callbacks. This wrapper manages a software-simulated time base provided by the OSAL.
Implementations§
Source§impl TimeBase
impl TimeBase
Sourcepub fn new(name: &str) -> Result<Self>
pub fn new(name: &str) -> Result<Self>
Creates a new software-simulated OSAL time base.
This time base will use the underlying OS kernel’s timing
facilities. The timer does not start until set() is called.
This creates a servicing task at elevated priority that may
interrupt user tasks. The kernel must be configured for
OS_MAX_TASKS + OS_MAX_TIMEBASES threads.
Must not be called from the context of a timer callback.
§Arguments
name: A unique string to identify the time base.
Sourcepub fn set(&self, start: Duration, interval: Duration) -> Result<()>
pub fn set(&self, start: Duration, interval: Duration) -> Result<()>
Programs the time base for a one-shot or periodic tick.
Must not be called from the context of a timer callback.
§Arguments
start:Durationuntil the first tick.interval:Durationbetween subsequent ticks. IfDuration::ZERO, the time base will only tick once.
Sourcepub fn id(&self) -> TimeBaseId
pub fn id(&self) -> TimeBaseId
Returns the underlying TimeBaseId.
Sourcepub fn info(&self) -> Result<TimeBaseProp>
pub fn info(&self) -> Result<TimeBaseProp>
Retrieves information about this time base.