From efa5e46b917bf750665a12711bd0e8f18c412cab Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Wed, 3 Aug 2022 16:19:04 +0200 Subject: Update Embassy (for the executor/util crate split) --- examples/Cargo.toml | 3 ++- examples/src/bin/ble_advertise.rs | 8 ++++---- examples/src/bin/ble_bas_central.rs | 8 ++++---- examples/src/bin/ble_bas_peripheral.rs | 8 ++++---- examples/src/bin/ble_dis_bas_peripheral_builder.rs | 8 ++++---- examples/src/bin/ble_l2cap_central.rs | 8 ++++---- examples/src/bin/ble_l2cap_peripheral.rs | 8 ++++---- examples/src/bin/ble_peripheral_onoff.rs | 8 ++++---- examples/src/bin/ble_scan.rs | 8 ++++---- examples/src/bin/flash.rs | 8 ++++---- 10 files changed, 38 insertions(+), 37 deletions(-) (limited to 'examples') diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 468547f..ee34c58 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -16,7 +16,8 @@ ble-gatt-server = ["nrf-softdevice/ble-gatt-server"] ble-gatt-client = ["nrf-softdevice/ble-gatt-client"] [dependencies] -embassy = { version = "0.1.0", features = ["nightly", "defmt", "defmt-timestamp-uptime"]} +embassy-executor = { version = "0.1.0", features = ["nightly", "defmt", "defmt-timestamp-uptime"]} +embassy-util = { version = "0.1.0" } embassy-nrf = { version = "0.1.0", features = [ "nightly", "defmt", "nrf52840", "gpiote", "time-driver-rtc1" ]} cortex-m = "0.7.2" cortex-m-rt = "0.7.0" diff --git a/examples/src/bin/ble_advertise.rs b/examples/src/bin/ble_advertise.rs index b6f7bd4..31804b3 100644 --- a/examples/src/bin/ble_advertise.rs +++ b/examples/src/bin/ble_advertise.rs @@ -9,19 +9,19 @@ use core::mem; use cortex_m_rt::entry; use defmt::{info, unreachable, *}; -use embassy::executor::Executor; -use embassy::util::Forever; +use embassy_executor::executor::Executor; +use embassy_util::Forever; use nrf_softdevice::ble::peripheral; use nrf_softdevice::{raw, Softdevice}; static EXECUTOR: Forever = Forever::new(); -#[embassy::task] +#[embassy_executor::task] async fn softdevice_task(sd: &'static Softdevice) { sd.run().await; } -#[embassy::task] +#[embassy_executor::task] async fn bluetooth_task(sd: &'static Softdevice) { #[rustfmt::skip] let adv_data = &[ diff --git a/examples/src/bin/ble_bas_central.rs b/examples/src/bin/ble_bas_central.rs index f0bda6e..3594f55 100644 --- a/examples/src/bin/ble_bas_central.rs +++ b/examples/src/bin/ble_bas_central.rs @@ -9,14 +9,14 @@ use core::mem; use cortex_m_rt::entry; use defmt::{info, *}; -use embassy::executor::Executor; -use embassy::util::Forever; +use embassy_executor::executor::Executor; +use embassy_util::Forever; use nrf_softdevice::ble::{central, gatt_client, Address, AddressType}; use nrf_softdevice::{raw, Softdevice}; static EXECUTOR: Forever = Forever::new(); -#[embassy::task] +#[embassy_executor::task] async fn softdevice_task(sd: &'static Softdevice) { sd.run().await; } @@ -27,7 +27,7 @@ struct BatteryServiceClient { battery_level: u8, } -#[embassy::task] +#[embassy_executor::task] async fn ble_central_task(sd: &'static Softdevice) { let addrs = &[&Address::new( AddressType::RandomStatic, diff --git a/examples/src/bin/ble_bas_peripheral.rs b/examples/src/bin/ble_bas_peripheral.rs index d62a111..03fc603 100644 --- a/examples/src/bin/ble_bas_peripheral.rs +++ b/examples/src/bin/ble_bas_peripheral.rs @@ -9,14 +9,14 @@ use core::mem; use cortex_m_rt::entry; use defmt::{info, *}; -use embassy::executor::Executor; -use embassy::util::Forever; +use embassy_executor::executor::Executor; +use embassy_util::Forever; use nrf_softdevice::ble::{gatt_server, peripheral}; use nrf_softdevice::{raw, Softdevice}; static EXECUTOR: Forever = Forever::new(); -#[embassy::task] +#[embassy_executor::task] async fn softdevice_task(sd: &'static Softdevice) { sd.run().await; } @@ -39,7 +39,7 @@ struct Server { foo: FooService, } -#[embassy::task] +#[embassy_executor::task] async fn bluetooth_task(sd: &'static Softdevice, server: Server) { #[rustfmt::skip] let adv_data = &[ diff --git a/examples/src/bin/ble_dis_bas_peripheral_builder.rs b/examples/src/bin/ble_dis_bas_peripheral_builder.rs index 4d65e67..71ae849 100644 --- a/examples/src/bin/ble_dis_bas_peripheral_builder.rs +++ b/examples/src/bin/ble_dis_bas_peripheral_builder.rs @@ -9,8 +9,8 @@ use core::mem; use cortex_m_rt::entry; use defmt::{info, *}; -use embassy::executor::Executor; -use embassy::util::Forever; +use embassy_executor::executor::Executor; +use embassy_util::Forever; use nrf_softdevice::ble::gatt_server::builder::ServiceBuilder; use nrf_softdevice::ble::gatt_server::characteristic::{Attribute, Metadata, Properties}; use nrf_softdevice::ble::gatt_server::{CharacteristicHandles, RegisterError}; @@ -31,7 +31,7 @@ const PNP_ID: Uuid = Uuid::new_16(0x2a50); static EXECUTOR: Forever = Forever::new(); -#[embassy::task] +#[embassy_executor::task] async fn softdevice_task(sd: &'static Softdevice) { sd.run().await; } @@ -186,7 +186,7 @@ impl gatt_server::Server for Server { } } -#[embassy::task] +#[embassy_executor::task] async fn bluetooth_task(sd: &'static Softdevice, server: Server) { #[rustfmt::skip] let adv_data = &[ diff --git a/examples/src/bin/ble_l2cap_central.rs b/examples/src/bin/ble_l2cap_central.rs index f344fa8..9b2cb5a 100644 --- a/examples/src/bin/ble_l2cap_central.rs +++ b/examples/src/bin/ble_l2cap_central.rs @@ -10,8 +10,8 @@ use core::{mem, slice}; use cortex_m_rt::entry; use defmt::{info, *}; -use embassy::executor::Executor; -use embassy::util::Forever; +use embassy_executor::executor::Executor; +use embassy_util::Forever; use nrf_softdevice::ble::l2cap::Packet as _; use nrf_softdevice::ble::{central, l2cap, Address, TxPower}; use nrf_softdevice::{raw, Softdevice}; @@ -20,12 +20,12 @@ static EXECUTOR: Forever = Forever::new(); const PSM: u16 = 0x2349; -#[embassy::task] +#[embassy_executor::task] async fn softdevice_task(sd: &'static Softdevice) { sd.run().await; } -#[embassy::task] +#[embassy_executor::task] async fn ble_central_task(sd: &'static Softdevice) { info!("Scanning for peer..."); diff --git a/examples/src/bin/ble_l2cap_peripheral.rs b/examples/src/bin/ble_l2cap_peripheral.rs index d542a45..3e72725 100644 --- a/examples/src/bin/ble_l2cap_peripheral.rs +++ b/examples/src/bin/ble_l2cap_peripheral.rs @@ -10,8 +10,8 @@ use core::ptr::NonNull; use cortex_m_rt::entry; use defmt::*; -use embassy::executor::Executor; -use embassy::util::Forever; +use embassy_executor::executor::Executor; +use embassy_util::Forever; use nrf_softdevice::ble::{l2cap, peripheral}; use nrf_softdevice::{ble, raw, RawError, Softdevice}; @@ -19,12 +19,12 @@ static EXECUTOR: Forever = Forever::new(); const PSM: u16 = 0x2349; -#[embassy::task] +#[embassy_executor::task] async fn softdevice_task(sd: &'static Softdevice) { sd.run().await; } -#[embassy::task] +#[embassy_executor::task] async fn bluetooth_task(sd: &'static Softdevice) { info!("My address: {:?}", ble::get_address(sd)); diff --git a/examples/src/bin/ble_peripheral_onoff.rs b/examples/src/bin/ble_peripheral_onoff.rs index a75ec49..99dcac4 100644 --- a/examples/src/bin/ble_peripheral_onoff.rs +++ b/examples/src/bin/ble_peripheral_onoff.rs @@ -9,17 +9,17 @@ use core::mem; use cortex_m_rt::entry; use defmt::*; -use embassy::executor::Executor; -use embassy::util::Forever; +use embassy_executor::executor::Executor; use embassy_nrf::gpio::{AnyPin, Input, Pin as _, Pull}; use embassy_nrf::interrupt::Priority; +use embassy_util::Forever; use futures::pin_mut; use nrf_softdevice::ble::{gatt_server, peripheral}; use nrf_softdevice::{raw, Softdevice}; static EXECUTOR: Forever = Forever::new(); -#[embassy::task] +#[embassy_executor::task] async fn softdevice_task(sd: &'static Softdevice) { sd.run().await; } @@ -73,7 +73,7 @@ async fn run_bluetooth(sd: &'static Softdevice, server: &Server) { } } -#[embassy::task] +#[embassy_executor::task] 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"); diff --git a/examples/src/bin/ble_scan.rs b/examples/src/bin/ble_scan.rs index c8ed543..7c33c31 100644 --- a/examples/src/bin/ble_scan.rs +++ b/examples/src/bin/ble_scan.rs @@ -9,19 +9,19 @@ use core::{mem, slice}; use cortex_m_rt::entry; use defmt::*; -use embassy::executor::Executor; -use embassy::util::Forever; +use embassy_executor::executor::Executor; +use embassy_util::Forever; use nrf_softdevice::ble::central; use nrf_softdevice::{raw, Softdevice}; static EXECUTOR: Forever = Forever::new(); -#[embassy::task] +#[embassy_executor::task] async fn softdevice_task(sd: &'static Softdevice) { sd.run().await; } -#[embassy::task] +#[embassy_executor::task] async fn ble_task(sd: &'static Softdevice) { let config = central::ScanConfig::default(); let res = central::scan(sd, &config, |params| unsafe { diff --git a/examples/src/bin/flash.rs b/examples/src/bin/flash.rs index dfaa7fb..78cb42d 100644 --- a/examples/src/bin/flash.rs +++ b/examples/src/bin/flash.rs @@ -7,20 +7,20 @@ mod example_common; use cortex_m_rt::entry; use defmt::*; -use embassy::executor::Executor; -use embassy::util::Forever; +use embassy_executor::executor::Executor; +use embassy_util::Forever; use embedded_storage_async::nor_flash::*; use futures::pin_mut; use nrf_softdevice::{Flash, Softdevice}; static EXECUTOR: Forever = Forever::new(); -#[embassy::task] +#[embassy_executor::task] async fn softdevice_task(sd: &'static Softdevice) { sd.run().await; } -#[embassy::task] +#[embassy_executor::task] async fn flash_task(sd: &'static Softdevice) { let f = Flash::take(sd); pin_mut!(f); -- cgit v1.2.3