pub struct Ticktimer { /* private fields */ }
Implementations§
Source§impl Ticktimer
impl Ticktimer
pub fn new() -> Result<Self, Error>
Sourcepub fn elapsed_ms(&self) -> u64
pub fn elapsed_ms(&self) -> u64
Return the number of milliseconds that have elapsed since boot. The returned value is guaranteed to always be the same or greater than the previous value, even through suspend/resume cycles. During suspend, the counter does not advance, so loops which rely on this value will not perceive any extra time passing through a suspend/resume cycle.
This call is expected to be infalliable, and removing the error handling path makes it a little more efficient in a tight loop.
§Returns:
* A `u64` that is the number of milliseconds elapsed since boot.
Sourcepub fn sleep_ms(&self, ms: usize) -> Result<(), Error>
pub fn sleep_ms(&self, ms: usize) -> Result<(), Error>
Sleep for at least ms
milliseconds. Blocks until the requested time has passed.
§Arguments:
* ms: A `usize` specifying how many milliseconds to sleep for
Sourcepub fn ping_wdt(&self)
pub fn ping_wdt(&self)
Ping the watchdog timer. Processes may use this to periodically ping the WDT to prevent
the system from resetting itself. Note that every call to sleep_ms()
also implicitly
pings the WDT, so in more complicated systems an explicit call is not needed.
Sourcepub fn get_version(&self) -> String
pub fn get_version(&self) -> String
Query version information embedded in this implementation crate by the build system.
§Returns:
* A `String` containing the version information of the latest build
pub fn get_version_semver(&self) -> SemVer
Sourcepub fn lock_mutex(&self, mtx: usize)
pub fn lock_mutex(&self, mtx: usize)
Lock the given Mutex. Blocks until the Mutex is locked.
Note that Mutexes start out in a Locked
state and move into an Unlocked
state by calling
Unlock
on their pointer. For example, the following will probably block forever:
`TickTimer.lock_mutex(1)`
In order to create a new Mutex, you must first Unlock
it. For example, the following is
allowed:
`TickTimer.unlock_mutex(1)`
`TickTimer.lock_mutex(1)`
`TickTimer.unlock_mutex(1)`
§Arguments:
* mtx: A `usize` referring to the Mutex. This is probably a pointer, but can be any `usize`
Sourcepub fn unlock_mutex(&self, mtx: usize)
pub fn unlock_mutex(&self, mtx: usize)
Unlock the given Mutex. Does not block. If the Mutex is not locked, then it will be “doubly-unlocked”. That is, if you Unlock a mutex twice, then you can Lock it twice without blocking.
§Arguments:
* mtx: A `usize` referring to the Mutex. This is probably a pointer, but can be any `usize`
Sourcepub fn wait_condition(&self, condvar: usize, duration: Option<Duration>) -> bool
pub fn wait_condition(&self, condvar: usize, duration: Option<Duration>) -> bool
Wait for a Condition on the given condvar, with an optional Duration
§Arguments:
* condvar: A `usize` referring to the Condvar. This is probably a pointer, but can be any `usize`
* duration: The amount of time to wait for a signal, if any
§Returns:
* true: the condition was successfully received
* false: the condition was not received and the operation itmed out
Sourcepub fn notify_condition(&self, condvar: usize, count: usize)
pub fn notify_condition(&self, condvar: usize, count: usize)
Notify a condition to one or more Waiters
§Arguments:
* condvar: A `usize` referring to the Condvar. This is probably a pointer, but can be any `usize`
* count: The number of Waiters to wake up
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Ticktimer
impl RefUnwindSafe for Ticktimer
impl Send for Ticktimer
impl Sync for Ticktimer
impl Unpin for Ticktimer
impl UnwindSafe for Ticktimer
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out
indicating that a T
is niched.