RKTK API Docs RKTK Home Repo

Function init_softdevice

Source
pub fn init_softdevice(ble_gap_name: &'static str) -> &'static mut Softdevice
Available on crate feature softdevice only.
Expand description

Initialize the softdevice and return the instance.

§Usage

This function enables softdevice, but doesn’t start. To start softdevice, call start_softdevice.

let sd = init_softdevice(...);  // <-- Get mutable reference to softdevice
start_server(sd).await;         // <-- Use softdevice for function which requires mutable reference to softdevice.
start_softdevice(sd).await;     // <-- Starts softdevice. This function borrows softdevice forever, so from this point, you can only use immutable reference to softdevice.
get_flash(sd).await;            // <-- get_flash does not require mutable reference to softdevice, so you can use this after starting softdevice;