zephyr::timer

Type Alias StaticStoppedTimer

Source
pub type StaticStoppedTimer = StaticKernelObject<k_timer>;
Expand description

A statically allocated k_timer (StoppedTimer).

This is intended to be used from within the kobj_define! macro. It declares a static k_timer that will be properly registered with the Zephyr object system (and can be used from userspace). Call [init_once] to get the StoppedTimer that it represents.

Aliased Type§

struct StaticStoppedTimer {
    pub value: UnsafeCell<k_timer>,
    pub init: AtomicUsize,
}

Fields§

§value: UnsafeCell<k_timer>

The underlying zephyr kernel object.

§init: AtomicUsize

Initialization status of this object. Most objects will start uninitialized and be initialized manually.

Implementations

Source§

impl<T> StaticKernelObject<T>

Source

pub const unsafe fn new() -> StaticKernelObject<T>

Construct an empty of these objects, with the zephyr data zero-filled.

§Safety

This is safe in the sense that Zephyr we track the initialization, they start in the uninitialized state, and the zero value of the initialize atomic indicates that it is uninitialized.

Source

pub fn init_once( &self, args: <Self as Wrapped>::I, ) -> Option<<Self as Wrapped>::T>

Get the instance of the kernel object.

Will return a single wrapped instance of this object. This will invoke the initialization, and return Some<Wrapped> for the wrapped containment type.

If it is called an additional time, it will return None.

Trait Implementations

Source§

impl Wrapped for StaticKernelObject<k_timer>

Source§

type I = ()

No initializers.

Source§

type T = StoppedTimer

The wrapped type. This is what init_once() on the StaticKernelObject will return after initialization.
Source§

fn get_wrapped(&self, _arg: Self::I) -> StoppedTimer

Initialize this kernel object, and return the wrapped pointer.