summaryrefslogtreecommitdiff
path: root/examples/src/bin/ble_peripheral_onoff.rs
diff options
context:
space:
mode:
authoralexmoon <alex.r.moon@gmail.com>2022-07-11 18:02:35 -0400
committeralexmoon <alex.r.moon@gmail.com>2022-07-12 14:34:16 -0400
commitea7a3908df6816225641da342de2466d91ff6f2b (patch)
treeb3691429eef48000076d0c4c28ff769ab7497ea8 /examples/src/bin/ble_peripheral_onoff.rs
parent5f651f57f6d5d04e82a7733fe6b7b2b4fbbff15c (diff)
downloadnrf-softdevice-ea7a3908df6816225641da342de2466d91ff6f2b.zip
Modify macros to use the builder interface and add an builder example
Diffstat (limited to 'examples/src/bin/ble_peripheral_onoff.rs')
-rw-r--r--examples/src/bin/ble_peripheral_onoff.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/examples/src/bin/ble_peripheral_onoff.rs b/examples/src/bin/ble_peripheral_onoff.rs
index a12f46e..539b168 100644
--- a/examples/src/bin/ble_peripheral_onoff.rs
+++ b/examples/src/bin/ble_peripheral_onoff.rs
@@ -79,9 +79,7 @@ async fn run_bluetooth(sd: &'static Softdevice, server: &Server) {
}
#[embassy::task]
-async fn bluetooth_task(sd: &'static Softdevice, button1: AnyPin, button2: AnyPin) {
- let server: Server = unwrap!(gatt_server::register(sd));
-
+async fn bluetooth_task(sd: &'static Softdevice, server: Server, button1: AnyPin, button2: AnyPin) {
info!("Bluetooth is OFF");
info!("Press nrf52840-dk button 1 to enable, button 2 to disable");
@@ -171,7 +169,13 @@ fn main() -> ! {
let executor = EXECUTOR.put(Executor::new());
executor.run(move |spawner| {
+ let server = unwrap!(Server::new(sd));
unwrap!(spawner.spawn(softdevice_task(sd)));
- unwrap!(spawner.spawn(bluetooth_task(sd, p.P0_11.degrade(), p.P0_12.degrade())));
+ unwrap!(spawner.spawn(bluetooth_task(
+ sd,
+ server,
+ p.P0_11.degrade(),
+ p.P0_12.degrade()
+ )));
});
}