summaryrefslogtreecommitdiff
path: root/examples/src/bin/ble_bas_peripheral.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/src/bin/ble_bas_peripheral.rs')
-rw-r--r--examples/src/bin/ble_bas_peripheral.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/examples/src/bin/ble_bas_peripheral.rs b/examples/src/bin/ble_bas_peripheral.rs
index e3e6233..f685513 100644
--- a/examples/src/bin/ble_bas_peripheral.rs
+++ b/examples/src/bin/ble_bas_peripheral.rs
@@ -49,9 +49,7 @@ struct Server {
}
#[embassy::task]
-async fn bluetooth_task(sd: &'static Softdevice) {
- let server: Server = unwrap!(gatt_server::register(sd));
-
+async fn bluetooth_task(sd: &'static Softdevice, server: Server) {
#[rustfmt::skip]
let adv_data = &[
0x02, 0x01, raw::BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE as u8,
@@ -147,8 +145,9 @@ fn main() -> ! {
let sd = Softdevice::enable(&config);
let executor = EXECUTOR.put(Executor::new());
- executor.run(|spawner| {
+ executor.run(move |spawner| {
+ let server = unwrap!(Server::new(sd));
unwrap!(spawner.spawn(softdevice_task(sd)));
- unwrap!(spawner.spawn(bluetooth_task(sd)));
+ unwrap!(spawner.spawn(bluetooth_task(sd, server)));
});
}