diff options
author | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2021-02-03 06:44:20 +0100 |
---|---|---|
committer | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2021-02-03 06:44:20 +0100 |
commit | 9400ecccb5271e03a46a07825b2775bc3bf7f609 (patch) | |
tree | 0ab12661720efd27ebf71ce23b9ee17e9c6a4f72 /examples/src/bin/ble_l2cap_peripheral.rs | |
parent | 96e625fc3baa4f258e9e9f761845a76751710b0d (diff) | |
download | nrf-softdevice-9400ecccb5271e03a46a07825b2775bc3bf7f609.zip |
update embassy
Diffstat (limited to 'examples/src/bin/ble_l2cap_peripheral.rs')
-rw-r--r-- | examples/src/bin/ble_l2cap_peripheral.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/examples/src/bin/ble_l2cap_peripheral.rs b/examples/src/bin/ble_l2cap_peripheral.rs index bc20437..54716af 100644 --- a/examples/src/bin/ble_l2cap_peripheral.rs +++ b/examples/src/bin/ble_l2cap_peripheral.rs @@ -12,7 +12,6 @@ use core::mem; use core::ptr::NonNull; use cortex_m_rt::entry; use defmt::{panic, *}; -use heapless::consts::*; use nrf_softdevice::ble; use nrf_softdevice::ble::{l2cap, peripheral, Connection}; @@ -30,7 +29,7 @@ async fn softdevice_task(sd: &'static Softdevice) { } #[task] -async fn bluetooth_task(sd: &'static Softdevice, config: peripheral::Config) { +async fn bluetooth_task(sd: &'static Softdevice) { info!("My address: {:?}", ble::get_address(sd)); #[rustfmt::skip] @@ -151,12 +150,9 @@ fn main() -> ! { let (sdp, p) = take_peripherals(); let sd = Softdevice::enable(sdp, &config); - let executor = EXECUTOR.put(Executor::new(cortex_m::asm::sev)); - unwrap!(executor.spawn(softdevice_task(sd))); - unwrap!(executor.spawn(bluetooth_task(sd, peripheral::Config::default()))); - - loop { - executor.run(); - cortex_m::asm::wfe(); - } + let executor = EXECUTOR.put(Executor::new()); + executor.run(|spawner| { + unwrap!(spawner.spawn(softdevice_task(sd))); + unwrap!(spawner.spawn(bluetooth_task(sd))); + }); } |