### Run WiFi Scan Example Source: https://docs.embassy.dev/cyw43 Execute the wifi_scan example to scan for available WiFi stations. Ensure probe-rs is installed. ```bash cargo run --release --bin wifi_scan ``` -------------------------------- ### Run WiFi TCP Server Example Source: https://docs.embassy.dev/cyw43 Execute the wifi_tcp_server example to connect to an existing network and create a TCP server. This example demonstrates DHCP IP acquisition and TCP echo server functionality on port 1234. ```bash cargo run --release --bin wifi_tcp_server ``` -------------------------------- ### Run WiFi AP TCP Server Example Source: https://docs.embassy.dev/cyw43 Execute the wifi_ap_tcp_server example to create a WiFi access point and run a TCP server. IP and credentials are set within the code. ```bash cargo run --release --bin wifi_ap_tcp_server ``` -------------------------------- ### Run the Executor with Initialization Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.Executor.html Starts the executor and runs tasks. The `init` closure is called with a Spawner to set up initial tasks. This function never returns and requires a `'static mut self` reference. ```rust pub fn run(&'static mut self, init: impl FnOnce(Spawner)) -> ! ``` -------------------------------- ### Start the Interrupt Executor Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.InterruptExecutor.html Initializes and starts the InterruptExecutor, enabling the associated interrupt. It returns a `SendSpawner` for spawning tasks on this executor. Ensure the interrupt priority is set before calling this method. ```rust pub fn start(&'static self, irq: impl InterruptNumber) -> SendSpawner ``` -------------------------------- ### EasyDMA RAM Write Example Source: https://docs.embassy.dev/embassy-nrf Demonstrates writing data from RAM using EasyDMA. The `_from_ram` variants of mutating functions require the data slice to reside in RAM and will return an error otherwise. This function call succeeds because `data` is a reference to a variable in memory. ```rust let data = [1, 2, 3]; let result = spim.write_from_ram(&data); assert!(result.is_ok()); ``` -------------------------------- ### Create a new InterruptExecutor Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.InterruptExecutor.html Instantiates a new InterruptExecutor that has not yet been started. Use this when setting up your executor. ```rust pub const fn new() -> Self ``` -------------------------------- ### Implement Timer Queue with embassy-time Driver Source: https://docs.embassy.dev/embassy-time-driver Adapt the `schedule_wake` method to use a timer queue managed by a mutex. Ensure single enqueuing if using multiple queues. This example shows a basic timer queue implementation. ```rust use core::cell::RefCell; use core::task::Waker; use critical_section::{CriticalSection, Mutex}; use embassy_time_queue_utils::Queue; use embassy_time_driver::Driver; struct MyDriver { queue: Mutex>, } impl MyDriver { fn set_alarm(&self, cs: &CriticalSection, at: u64) -> bool { todo!() } } impl Driver for MyDriver { fn now(&self) -> u64 { todo!() } fn schedule_wake(&self, at: u64, waker: &Waker) { critical_section::with(|cs| { let mut queue = self.queue.borrow(cs).borrow_mut(); if queue.schedule_wake(at, waker) { let mut next = queue.next_expiration(self.now()); while !self.set_alarm(&cs, next) { next = queue.next_expiration(self.now()); } } }); } } ``` -------------------------------- ### InterruptExecutor::start Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.InterruptExecutor.html Starts the InterruptExecutor, enabling the associated interrupt and returning a SendSpawner for spawning tasks. ```APIDOC ## InterruptExecutor::start ### Description Starts the executor. This initializes the executor, enables the interrupt, and returns a `SendSpawner` that can be used to spawn tasks on it. The executor continues to run in the background via the interrupt. ### Method `start(&'static self, irq: impl InterruptNumber) -> SendSpawner` ### Parameters #### Path Parameters - **irq** (impl InterruptNumber) - Required - The interrupt number to use for the executor. ### Returns A `SendSpawner` that can be used to spawn tasks on this executor. ### Interrupt Requirements - You must write the interrupt handler yourself and ensure it calls `on_interrupt()`. - This method enables (unmasks) the interrupt; do not do it yourself. - You must set the interrupt priority *before* calling this method. ``` -------------------------------- ### Implement Custom Executor Wrapper Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/index.html Wrap the `raw::Executor` into a custom `Executor` struct that defines the main loop. This is necessary when implementing your own platform, for example, on top of an RTOS. ```rust pub struct Executor { inner: raw::Executor, not_send: PhantomData<*mut ()>, } impl Executor { pub fn new() -> Self { Self { inner: raw::Executor::new(my_rtos::task_get_current() as _), not_send: PhantomData, } } pub fn run(&'static mut self, init: impl FnOnce(Spawner)) -> ! { init(self.inner.spawner()); loop { unsafe { self.inner.poll() } my_rtos::task_wait_for_notification(); } } } ``` -------------------------------- ### Implement TimerQueue Trait Source: https://docs.embassy.dev/embassy-time-queue-driver Example of implementing the `TimerQueue` trait for a custom timer queue. This involves defining a struct and implementing the `schedule_wake` method. The `timer_queue_impl!` macro is then used to register this custom queue. ```rust use core::task::Waker; use embassy_time::Instant; use embassy_time::queue::{TimerQueue}; struct MyTimerQueue{}; // not public! impl TimerQueue for MyTimerQueue { fn schedule_wake(&'static self, at: u64, waker: &Waker) { todo!() } } embassy_time_queue_driver::timer_queue_impl!(static QUEUE: MyTimerQueue = MyTimerQueue{}); ``` -------------------------------- ### InterruptExecutor::spawner Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.InterruptExecutor.html Gets a SendSpawner for the InterruptExecutor. This can only be called on a started executor. ```APIDOC ## InterruptExecutor::spawner ### Description Get a `SendSpawner` for this executor. This can be used to spawn tasks on the executor. ### Method `spawner(&'static self) -> SendSpawner` ### Panics This function will panic if called on an executor that has not yet been started. ### Returns A `SendSpawner` for the executor. ``` -------------------------------- ### Get SendSpawner for Interrupt Executor Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.InterruptExecutor.html Retrieves a `SendSpawner` for the InterruptExecutor. This method will panic if called on an executor that has not yet been started. ```rust pub fn spawner(&'static self) -> SendSpawner ``` -------------------------------- ### new Source: https://docs.embassy.dev/embassy-net-nrf91 Creates a new nRF91 embassy-net driver instance. This function initializes the driver for use with the embassy-net framework on nRF91-series devices. ```APIDOC ## new ### Description Create a new nRF91 embassy-net driver. ### Function Signature `pub fn new() -> NetDriver` ### Returns A new instance of the network driver for nRF91 devices. ``` -------------------------------- ### Get Type ID Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.Spawner.html Gets the `TypeId` of the Spawner. This is part of the `Any` trait implementation. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### main Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/all.html Attribute macro to mark the main entry point of the application. ```APIDOC ## Attribute Macro: main ### Description Marks the `main` function as the entry point for the application, enabling executor integration. ### Usage ```rust #[embassy_executor::main] async fn main() { // ... your application logic ... } ``` ``` -------------------------------- ### Create New CYW43 Driver Instance (SDIO) Source: https://docs.embassy.dev/cyw43 Instantiates a new CYW43 driver using an SDIO bus. Ensure the SDIO bus implementation adheres to the SdioBusCyw43 trait. ```rust pub async fn new_sdio(sdio: T) -> Self { Self::new_inner(sdio).await } ``` -------------------------------- ### W5500 Driver Initialization Source: https://docs.embassy.dev/embassy-net-w5500 Obtain a driver for using the W5500 with embassy-net. ```APIDOC ## Function: new ### Description Obtain a driver for using the W5500 with `embassy-net`. ### Signature ```rust pub fn new>(spi: SPI, cs: impl OutputPin) -> Runner<'_, T, SPI> ``` ### Parameters * `spi`: The SPI bus instance connected to the W5500. * `cs`: The chip select pin for the W5500. ``` -------------------------------- ### Metadata::priority Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.Metadata.html Gets the priority level of the task. ```APIDOC ## Metadata::priority() ### Description Get this task’s priority. ### Returns - `u8`: The priority of the task. ``` -------------------------------- ### Custom Boot2 Implementation Source: https://docs.embassy.dev/embassy-rp Use this when you need to provide your own bootloader. Place your custom bootloader in the ".boot2" section. ```rust #[unsafe(link_section = ".boot2")] #[used] static BOOT2: [u8; 256] = [0; 256]; // Provide your own with e.g. include_bytes! ``` -------------------------------- ### Create a new Executor Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.Executor.html Instantiates a new Executor. This is the entry point for setting up the executor. ```rust pub fn new() -> Self ``` -------------------------------- ### Metadata::deadline Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.Metadata.html Gets the deadline for the task, represented in ticks. ```APIDOC ## Metadata::deadline() ### Description Get this task’s deadline. ### Returns - `u64`: The deadline of the task in ticks. ``` -------------------------------- ### Get Task Deadline Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.Metadata.html Retrieves the deadline for a task, specified in ticks. ```rust pub fn deadline(&self) -> u64 ``` -------------------------------- ### Get Task Priority Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.Metadata.html Retrieves the priority level of a given task. ```rust pub fn priority(&self) -> u8 ``` -------------------------------- ### Declare Application Entry Point with #[main] Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/attr.main.html Use this attribute to define the main function for your Cortex-M application. It automatically sets up the executor and spawns the function as an async task. Ensure the function is async, takes a Spawner as its single argument, and does not use generics. Only one #[main] function is allowed per application. ```rust #[embassy_executor::main] async fn main(_s: embassy_executor::Spawner) { // Function body } ``` -------------------------------- ### Get Temperature Reading Source: https://docs.embassy.dev/nrf-softdevice Retrieves the current temperature reading in Celsius from the Softdevice. ```APIDOC ## Functions temperature_celsius Get temperature reading in Celsius ``` -------------------------------- ### main attribute macro Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/embassy_executor/all.html Marks the main function as the entry point for the application, enabling asynchronous task execution. ```APIDOC ## Attribute Macro: main ### Description Marks the `main` function as the entry point for the application. This macro sets up the executor and allows for asynchronous task execution. ### Usage ```rust #[embassy_executor::main] async fn main() { // Your async code here } ``` ``` -------------------------------- ### Initialize and Run USB Serial Logger Task Source: https://docs.embassy.dev/embassy-usb-logger Add this embassy task to your application to output all logging done through the `log` facade to the USB serial peripheral. The `Driver` type depends on your specific HAL. This macro initializes and runs the logger, and it never returns. ```rust #[embassy_executor::task] async fn logger_task(driver: Driver<'static, USB>) { embassy_usb_logger::run!(1024, log::LevelFilter::Info, driver); } ``` -------------------------------- ### Get Random Bytes Source: https://docs.embassy.dev/nrf-softdevice Retrieves cryptographically secure random bytes from the Softdevice. ```APIDOC ## Functions random_bytes Get cryptographically-secure random bytes. ``` -------------------------------- ### Get Executor ID Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.Spawner.html Returns the unique ID of the Executor associated with this Spawner. ```rust pub fn executor_id(&self) -> usize ``` -------------------------------- ### new_with_trace Source: https://docs.embassy.dev/embassy-net-nrf91 Creates a new nRF91 embassy-net driver instance, including a trace buffer for debugging. This is useful for monitoring driver activity and diagnosing issues. ```APIDOC ## new_with_trace ### Description Create a new nRF91 embassy-net driver with trace capabilities. ### Function Signature `pub fn new_with_trace() -> (NetDriver, TraceReader, TraceWriter)` ### Returns A tuple containing the network driver, a trace reader, and a trace writer. ``` -------------------------------- ### Create New CYW43 Driver Instance (SPI) Source: https://docs.embassy.dev/cyw43 Instantiates a new CYW43 driver using an SPI bus. Ensure the SPI bus implementation adheres to the SpiBusCyw43 trait. ```rust pub async fn new(spi: T) -> Self { Self::new_inner(spi).await } ``` -------------------------------- ### SpawnToken Methods Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.SpawnToken.html Methods available on the SpawnToken struct. ```APIDOC ## SpawnToken Token to spawn a newly-created task in an executor. When calling a task function (like `#[embassy_executor::task] async fn my_task() { ... }`), the returned value is a `SpawnToken` that represents an instance of the task, ready to spawn. You must then spawn it into an executor, typically with `Spawner::spawn()`. The generic parameter `S` determines whether the task can be spawned in executors in other threads or not. If `S: Send`, it can, which allows spawning it into a `SendSpawner`. If not, it can’t, so it can only be spawned into the current thread’s executor, with `Spawner`. ## §Panics Dropping a SpawnToken instance panics. You may not “abort” spawning a task in this way. Once you’ve invoked a task function and obtained a SpawnToken, you _must_ spawn it. ### impl SpawnToken #### pub fn id(&self) -> u32 Returns the task ID. This can be used in combination with rtos-trace to match task names with IDs #### pub fn metadata(&self) -> &Metadata Get the metadata for this task. You can use this to set metadata fields prior to spawning it. ``` -------------------------------- ### Get task metadata Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.SpawnToken.html Retrieves the metadata associated with the task. This allows modification of metadata fields before spawning. ```rust pub fn metadata(&self) -> &Metadata ``` -------------------------------- ### Run ADIN1110 tests Source: https://docs.embassy.dev/embassy-net-adin1110 Execute ADIN1110 library tests on the host using a mock SPI driver. Ensure the target architecture is set to x86_64-unknown-linux-gnu. ```bash cargo test --target x86_64-unknown-linux-gnu ``` -------------------------------- ### Get task ID Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.SpawnToken.html Returns the unique identifier for the task. This ID can be used with rtos-trace for task name matching. ```rust pub fn id(&self) -> u32 ``` -------------------------------- ### Interrupt Executor Callback Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.InterruptExecutor.html The interrupt callback function for the InterruptExecutor. This MUST be called from the interrupt handler and only after `start()` has been invoked. ```rust pub unsafe fn on_interrupt(&'static self) ``` -------------------------------- ### run Macro Source: https://docs.embassy.dev/embassy-usb-logger Initializes and runs the USB serial logger. This macro is intended to be used within an embassy task and will continuously output log messages over USB. It never returns. ```APIDOC ## run ### Description Initialize and run the USB serial logger, never returns. ### Usage ```rust #[embassy_executor::task] async fn logger_task(driver: Driver<'static, USB>) { embassy_usb_logger::run!(1024, log::LevelFilter::Info, driver); } ``` ### Parameters - `buffer_size`: The size of the internal buffer for log messages. - `level_filter`: The minimum log level to be outputted. - `driver`: The USB driver instance. ``` -------------------------------- ### Custom Image Definition Source: https://docs.embassy.dev/embassy-rp Use this when you need to manually configure the Image Definition. Place your custom definition in the ".start_block" section. ```rust use embassy_rp::block::ImageDef; #[unsafe(link_section = ".start_block")] #[used] static IMAGE_DEF: ImageDef = ImageDef::secure_exe(); // Update this with your own implementation. ``` -------------------------------- ### Get Current Task Metadata Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.Metadata.html Retrieve the metadata associated with the currently executing task. This is an async function to access the current async context but returns instantly. ```rust pub fn for_current_task() -> impl Future ``` -------------------------------- ### with_custom_style Macro Source: https://docs.embassy.dev/embassy-usb-logger Initializes the USB serial logger from a serial class, allowing for a custom style function. It returns a future that runs the logger and never returns. ```APIDOC ## with_custom_style ### Description Initialize the USB serial logger from a serial class and return the future to run it. The future never returns. This version of the macro allows for a custom style function to be passed in. The custom style function will be called for each log record and is responsible for writing the log message to the buffer. ### Usage ```rust // Example usage would go here, assuming a 'SerialClass' and 'custom_style_fn' exist // let logger_future = embassy_usb_logger::with_custom_style!(driver, custom_style_fn); // embassy_executor::spawn(logger_future); ``` ### Parameters - `driver`: The USB serial class instance. - `custom_style_fn`: A function that formats log records. ``` -------------------------------- ### EasyDMA Buffer Not in RAM Error Source: https://docs.embassy.dev/embassy-nrf This example demonstrates a common EasyDMA failure scenario where a slice intended for transmission resides in flash instead of RAM, causing the `BufferNotInRAM` error. ```rust let result = spim.write_from_ram(&[1, 2, 3]); assert_eq!(result, Err(Error::BufferNotInRAM)); ``` -------------------------------- ### with_class Macro Source: https://docs.embassy.dev/embassy-usb-logger Initializes the USB serial logger from a serial class and returns a future that runs it. This future never returns. ```APIDOC ## with_class ### Description Initialize the USB serial logger from a serial class and return the future to run it. The future never returns. ### Usage ```rust // Example usage would go here, assuming a 'SerialClass' type exists // let logger_future = embassy_usb_logger::with_class!(driver); // embassy_executor::spawn(logger_future); ``` ### Parameters - `driver`: The USB serial class instance. ``` -------------------------------- ### Get SendSpawner for current executor Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.SendSpawner.html Obtains a SendSpawner for the current executor. This function is async only to access the current async context and returns instantly. Panics if the current executor is not an Embassy executor. ```rust pub fn for_current_executor() -> impl Future ``` -------------------------------- ### Executor::run Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.Executor.html Runs the executor, executing tasks spawned by the init closure. ```APIDOC ## Executor::run ### Description Runs the executor. The `init` closure is called with a `Spawner` that spawns tasks on this executor. Use it to spawn the initial task(s). After `init` returns, the executor starts running the tasks. This function never returns. ### Method ``` pub fn run(&'static mut self, init: impl FnOnce(Spawner)) -> ! ``` ### Parameters #### Path Parameters - **self** (*&'static mut self*) - Required - The executor instance. - **init** (*impl FnOnce(Spawner)*) - Required - A closure that takes a `Spawner` and spawns initial tasks. ``` -------------------------------- ### main Attribute Macro Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/attr.main.html The `#[main]` attribute macro creates a new executor instance and declares an application entry point for Cortex-M. It spawns the annotated function body as an async task. The function must accept a `Spawner` handle, be `async`, and not use generics. Only one `main` task can be declared per application. ```APIDOC ## main Creates a new `executor` instance and declares an application entry point for Cortex-M spawning the corresponding function body as an async task. ### Restrictions: * The function must accept exactly 1 parameter, an `embassy_executor::Spawner` handle that it can use to spawn additional tasks. * The function must be declared `async`. * The function must not use generics. * Only a single `main` task may be declared. ### Example: ``` #[embassy_executor::main] async fn main(_s: embassy_executor::Spawner) { // Function body } ``` ``` -------------------------------- ### embassy_net_ppp Overview Source: https://docs.embassy.dev/embassy-net-ppp The embassy-net-ppp crate integrates PPP over Serial with the embassy-net framework. It is designed to run on any executor and supports serial ports implementing `embedded-io-async`. ```APIDOC ## Crate embassy_net_ppp `embassy-net` integration for PPP over Serial. ### Interoperability This crate can run on any executor. It supports any serial port implementing `embedded-io-async`. ### Structs * **Config**: PPP configuration. * **Ipv4Status**: Status of the IPv4 connection. * **Runner**: Background runner for the driver. * **State**: Internal state for the embassy-net integration. ### Enums * **RunError**: Error returned by `Runner::run`. ### Functions * **new**: Create a PPP embassy-net driver instance. ### Type Aliases * **Device**: Type alias for the embassy-net driver. ``` -------------------------------- ### Spawner::for_current_executor Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.Spawner.html Gets a Spawner for the current executor. This method is async to access the current async context and returns instantly. It is unsafe and discouraged, with alternatives like passing the initial Spawner as an argument or using SendSpawner. ```APIDOC ## Spawner::for_current_executor ### Description Get a Spawner for the current executor. This function is `async` just to get access to the current async context. It returns instantly, it does not block/yield. ### Method Signature `pub unsafe fn for_current_executor() -> impl Future` ### Safety You must only execute this with an async `Context` created by the Embassy executor. You must not execute it with manually-created `Context`s. ### Panics Panics if the current executor is not an Embassy executor. ``` -------------------------------- ### select Source: https://docs.embassy.dev/embassy-futures Waits for the first of several futures to complete. This is useful for scenarios where you want to react to the earliest completion of any asynchronous operation. ```APIDOC ## Modules ### select Wait for the first of several futures to complete. ``` -------------------------------- ### Spawner Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/all.html The primary interface for spawning new tasks. ```APIDOC ## Struct: Spawner ### Description The main interface for spawning new asynchronous tasks into the executor. ### Methods (No specific methods documented in the source) ``` -------------------------------- ### Get Spawner for Current Executor (unsafe) Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.Spawner.html Obtains a Spawner for the current executor. This function is async only to access the current async context and returns instantly. It is unsafe and discouraged unless required for an InterruptExecutor, as it requires an async Context created by the Embassy executor. ```rust pub unsafe fn for_current_executor() -> impl Future ``` -------------------------------- ### ADIN1110 Driver Initialization Source: https://docs.embassy.dev/embassy-net-adin1110 Obtain a driver for using the ADIN1110 with embassy-net. This function initializes the driver. ```APIDOC ## new ### Description Obtain a driver for using the ADIN1110 with `embassy-net`. ### Function Signature `new()` ### Returns A new instance of the ADIN1110 driver. ``` -------------------------------- ### Raw Executor and Task Management Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/raw/index.html This section covers the core components for raw task management: Executor, TaskPool, TaskStorage, and TaskRef, along with functions for interacting with tasks via wakers. ```APIDOC ## Module raw Embassy Executor Raw Module ### Summary Raw executor. This module exposes “raw” Executor and Task structs for more low-level control. ### WARNING: here be dragons! Using this module requires respecting subtle safety contracts. If you can, prefer using the safe executor wrappers and the `embassy_executor::task` macro, which are fully safe. ## Structs ### `AvailableTask` An uninitialized `TaskStorage`. ### `Executor` Raw executor. ### `TaskPool` Raw storage that can hold up to N tasks of the same type. ### `TaskRef` This is essentially a `&'static TaskStorage` where the type of the future has been erased. ### `TaskStorage` Raw storage in which a task can be spawned. ## Functions ### `task_from_waker` Get a task pointer from a waker. ### `wake_task` Wake a task by `TaskRef`. ### `wake_task_no_pend` Wake a task by `TaskRef` without calling pend. ``` -------------------------------- ### Implement Custom Pender Callback Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/index.html Define the `__pender` callback for a custom platform, typically used with an RTOS. The `context` argument can be used to pass a handle to the RTOS task. ```rust #[unsafe(export_name = "__pender")] fn __pender(context: *mut ()) { // `context` is the argument passed to `raw::Executor::new`. Here we're using it // to pass a handle to the RTOS task but you can use it for anything. my_rtos::notify_task(context as _); } ``` -------------------------------- ### Softdevice Configuration Source: https://docs.embassy.dev/nrf-softdevice The Config struct is used to configure the Softdevice. It holds settings related to the Softdevice's operation. ```APIDOC ## Structs Config Softdevice configuration. ``` -------------------------------- ### SpawnToken Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/all.html A token representing a spawned task. ```APIDOC ## Struct: SpawnToken ### Description Represents a token that uniquely identifies a spawned task. ### Fields (No specific fields documented in the source) ``` -------------------------------- ### impl Copy for Spawner Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.Spawner.html Indicates that Spawner can be copied. -------------------------------- ### Executor::new Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/struct.Executor.html Creates a new instance of the Executor. ```APIDOC ## Executor::new ### Description Creates a new Executor. ### Method ``` pub fn new() -> Self ``` ``` -------------------------------- ### raw::AvailableTask Source: https://docs.embassy.dev/embassy-executor/0.10.0/cortex-m/all.html Represents a task that is available to be run. ```APIDOC ## Struct: raw::AvailableTask ### Description Represents a task that is ready and available for execution by the executor. ### Fields (No specific fields documented in the source) ``` -------------------------------- ### Custom Platform: Executor Struct and Run Loop Source: https://docs.embassy.dev/embassy-executor/0.10.0/wasm/index.html Implements a custom `Executor` struct that wraps the raw executor and defines the main run loop. The `run` method initializes tasks and enters an infinite loop that polls the executor and sleeps the thread/core when idle, using platform-specific notification mechanisms. ```rust use core::marker::PhantomData; pub struct Executor { inner: raw::Executor, not_send: PhantomData<*mut ()>, } impl Executor { pub fn new() -> Self { Self { inner: raw::Executor::new(my_rtos::task_get_current() as _), not_send: PhantomData, } } pub fn run(&'static mut self, init: impl FnOnce(Spawner)) -> ! { init(self.inner.spawner()); loop { unsafe { self.inner.poll() } my_rtos::task_wait_for_notification(); } } } ``` -------------------------------- ### Softdevice Instance Source: https://docs.embassy.dev/nrf-softdevice The Softdevice struct represents the singleton instance of the enabled Softdevice, providing access to its core functionalities. ```APIDOC ## Structs Softdevice Singleton instance of the enabled softdevice. ```