Skip to main content

EmbassyBoardEntry

Trait EmbassyBoardEntry 

Source
pub trait EmbassyBoardEntry: Board {
    type Spawner: 'static;
    type Executor: 'static;
    type Runtime: NodeDispatchRuntime + 'static;

    const CHANNEL_CAPACITY: usize = 32;

    // Required method
    fn init_hardware(spawner: Self::Spawner) -> (Self::Executor, Self::Runtime);

    // Provided method
    fn init_hardware_with_deploy(
        spawner: Self::Spawner,
        _deploy: &DeployOverlay,
    ) -> (Self::Executor, Self::Runtime) { ... }
}
Expand description

Board-side hook for Embassy integration (Phase 216.C.1).

Implementations live in per-board Embassy crates such as nros-board-embassy-stm32f4 (Phase 216.C.2). Each impl wires the Embassy Self::Spawner handle through to the board’s peripheral init code and hands back the (Self::Executor, Self::Runtime) pair the proc-macro-generated entry point then drives.

Provided Associated Constants§

Source

const CHANNEL_CAPACITY: usize = 32

Capacity of the per-board embassy_sync::channel::Channel used by signal_callback to enqueue callbacks for the dispatch task. 32 covers typical Node loads without exhausting RAM; boards with very high callback density override.

Required Associated Types§

Source

type Spawner: 'static

Embassy spawner handle. Typically embassy_executor::Spawner on real boards; kept abstract so nros-platform doesn’t take a transitive embassy_executor dep (see the module-level “Layering” note).

Source

type Executor: 'static

Executor type the board hands back. Concrete board impls plug in nros::Executor; the assoc type keeps nros-platform free of an nros dep.

Source

type Runtime: NodeDispatchRuntime + 'static

Dispatch sink the macro spawns into an Embassy task. Required to be a NodeDispatchRuntime so signaled callbacks can be enqueued from the spawner-driven dispatch task.

Required Methods§

Source

fn init_hardware(spawner: Self::Spawner) -> (Self::Executor, Self::Runtime)

Run from inside the proc-macro-generated #[embassy_executor::main] body. Returns the (Executor, Runtime) pair the macro then spawns dispatch / spin tasks against.

Sync on purpose — see the module-level “Sync init_hardware” note for the trade-off vs the spec’s async fn sketch.

Provided Methods§

Source

fn init_hardware_with_deploy( spawner: Self::Spawner, _deploy: &DeployOverlay, ) -> (Self::Executor, Self::Runtime)

Like init_hardware but applies a deploy-metadata overlay (Phase 244.D1 / issue #98 / RFC-0045) before opening the executor. nros::main!() calls THIS from the generated #[embassy_executor::main] body, passing the [package.metadata.nros.deploy.<board>] block.

The default ignores deploy and forwards to init_hardware, so existing Embassy boards are unchanged. Boards with a baked boot config (e.g. nros-board-embassy-stm32f4) override it so the node name is resolved from deploy.boot_config instead of from option_env!("NROS_NODE_NAME").

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§