Skip to main content

Crate xpanse_api

Crate xpanse_api 

Source
Expand description

Shared API for xpanse apps, module drivers, and platform firmware.

Module drivers implement driver::Driver to turn an owned gpio_bank::GpioBank into capabilities stored in a registry::Registry. Apps implement app::App and lease those capabilities for the duration of their run. The platform constructs buses through bus::allocator::BusAllocator while drivers are being initialized.

§Runtime requirements

This crate is no_std, but uses alloc for registry storage, trait objects, and boxed futures. Firmware using the API must install a global allocator before creating drivers, resources, or apps.

§Typical lifecycle

  1. Detect a module and select a driver using metadata::ModuleID.
  2. Call driver::Driver::create with the module’s GPIO bank.
  3. Check app::App::can_run and construct an app with app::App::new.
  4. Run the app, then call app::App::release to return its resource leases.

Exact versions of HAL traits used by this API are available through reexports, avoiding version mismatches in app and driver crates.

Modules§

app
Application lifecycle and resource ownership.
bus
Bus allocation, type-erased handles, and RP235x bus backends.
driver
Module driver traits.
gpio_bank
Strongly typed GPIO banks assigned to expansion modules.
interfaces
App- and driver-facing hardware capabilities.
metadata
Metadata for apps about the drivers, like what physical slot the module is in, that the driver uses, and what type of module is used by the driver.
reexports
Exact versions of dependencies whose types and traits appear in this crate’s public API.
registry
Exclusive capability registry shared by drivers and apps.

Macros§

with_pio
Dispatch over a PioAccess handle, recovering the typed Common and StateMachine so a driver can load a custom PIO program.