Trait wasefire_board_api::Api
source · 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§
Required Methods§
sourcefn try_event() -> Option<Event<Self>>
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.
sourcefn wait_event() -> Event<Self>
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§
sourcefn syscall(_x1: u32, _x2: u32, _x3: u32, _x4: u32) -> Option<Result<u32, Error>>
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.