pub trait Api: Send + 'static {
    type Button: Api;
    type Crypto: Api;
    type Debug: Api;
    type Gpio: Api;
    type Led: Api;
    type Platform: Api;
    type Radio: Api;
    type Rng: Api;
    type Storage: Singleton + Storage + Send;
    type Timer: Api;
    type Uart: Api;
    type Usb: Api;

    // Required methods
    fn try_event() -> Option<Event<Self>>;
    fn wait_event() -> Event<Self>;

    // Provided method
    fn syscall(
        _x1: u32,
        _x2: u32,
        _x3: u32,
        _x4: u32
    ) -> Option<Result<u32, Error>> { ... }
}
Expand description

Board interface.

This is essentially a type hierarchy. The implementation is responsible for handling a possible explicit global state. The type implementing this API may be equivalent to the never type (e.g. an empty enum) because it is never used, i.e. there are no functions which take self.

Required Associated Types§

source

type Button: Api

Available on crate feature api-button only.
source

type Crypto: Api

Available on crate feature internal-api-crypto only.
source

type Debug: Api

source

type Gpio: Api

Available on crate feature api-gpio only.
source

type Led: Api

Available on crate feature api-led only.
source

type Platform: Api

Available on crate feature internal-api-platform only.
source

type Radio: Api

Available on crate feature internal-api-radio only.
source

type Rng: Api

Available on crate feature api-rng only.
source

type Storage: Singleton + Storage + Send

Available on crate feature api-storage only.
source

type Timer: Api

Available on crate feature api-timer only.
source

type Uart: Api

Available on crate feature api-uart only.
source

type Usb: Api

Available on crate feature internal-api-usb only.

Required Methods§

source

fn try_event() -> Option<Event<Self>>

Returns the oldest triggered event, if any.

This function is non-blocking. See Self::wait_event() for a blocking version.

source

fn wait_event() -> Event<Self>

Returns the oldest triggered event, possibly waiting until one triggers.

This function is non-blocking if an event already triggered. However, if there are no event available, this function blocks and enters a power-saving state until an event triggers.

Provided Methods§

source

fn syscall(_x1: u32, _x2: u32, _x3: u32, _x4: u32) -> Option<Result<u32, Error>>

Board-specific syscalls.

Those calls are directly forwarded from the applet by the scheduler. The default implementation traps by returning None. The platform will panic if Some(Ok(x)) is returned when x as i32 would be negative.

Object Safety§

This trait is not object safe.

Implementors§