diff --git a/btmesh-bearer/Cargo.toml b/btmesh-bearer/Cargo.toml index efcb241..a93a7fe 100644 --- a/btmesh-bearer/Cargo.toml +++ b/btmesh-bearer/Cargo.toml @@ -8,10 +8,8 @@ edition = "2021" [dependencies] btmesh-common = { path = "../btmesh-common" } btmesh-pdu = { path = "../btmesh-pdu" } -heapless = "0.7" -defmt = {version = "0.3.0", optional = true } +heapless = "0.8" +defmt = { version = "0.3.0", optional = true } [features] -defmt = [ - "dep:defmt", -] +defmt = ["dep:defmt"] diff --git a/btmesh-common/Cargo.toml b/btmesh-common/Cargo.toml index 195511b..d396031 100644 --- a/btmesh-common/Cargo.toml +++ b/btmesh-common/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" aes = { version = "0.7.5", default-features = false } ccm = { version = "0.4.4", default-features = false } cmac = { version = "0.6.0", default-features = false } -heapless = "0.7" +heapless = "0.8" hash32 = { version = "0.2.1", default-features = false } hash32-derive = { version = "0.1.1", default-features = false } rand_core = { version = "0.6.2", default-features = false } @@ -29,7 +29,7 @@ syn = { version = "1.0.89", default-features = false, features = [ [features] darling = ["dep:darling", "dep:syn"] -defmt = ["dep:defmt", "heapless/defmt-impl"] +defmt = ["dep:defmt", "heapless/defmt-03"] relay = [] proxy = [] friend = [] diff --git a/btmesh-device/Cargo.toml b/btmesh-device/Cargo.toml index caab859..191512f 100644 --- a/btmesh-device/Cargo.toml +++ b/btmesh-device/Cargo.toml @@ -6,11 +6,11 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -heapless = "0.7" +heapless = "0.8" btmesh-common = { path = "../btmesh-common" } btmesh-models = { path = "../btmesh-models" } -embassy-sync = { version = "0.3.0", default-features = false } -embassy-time = { version = "0.1.3", default-features = false } +embassy-sync = { version = "0.6.0", default-features = false } +embassy-time = { version = "0.3.2", default-features = false } embassy-futures = { version = "0.1.0", default-features = false } futures = { version = "0.3.21", default-features = false } @@ -19,4 +19,9 @@ log = { version = "0.4", optional = true } defmt = { version = "0.3", optional = true } [features] -defmt = ["dep:defmt", "heapless/defmt-impl"] +defmt = ["dep:defmt", "heapless/defmt-03"] + +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "1a1d5c4689a8b6c57ebb74e99fdea8df39adb037" } +embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "1a1d5c4689a8b6c57ebb74e99fdea8df39adb037" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "1a1d5c4689a8b6c57ebb74e99fdea8df39adb037" } diff --git a/btmesh-device/src/lib.rs b/btmesh-device/src/lib.rs index ab4e30c..380eeb8 100644 --- a/btmesh-device/src/lib.rs +++ b/btmesh-device/src/lib.rs @@ -1,6 +1,5 @@ #![cfg_attr(not(test), no_std)] #![feature(associated_type_defaults)] -#![feature(async_fn_in_trait)] #![allow(incomplete_features)] #![allow(dead_code)] @@ -166,19 +165,27 @@ pub trait BluetoothMeshDeviceContext { inbound: InboundChannelReceiver, ) -> Self::ElementContext; - async fn receive(&self) -> AccessCountedHandle<'static, InboundPayload>; + fn receive( + &self, + ) -> impl core::future::Future>; } pub trait BluetoothMeshDevice { fn composition(&self) -> Composition; - async fn run(&mut self, ctx: C) -> Result<(), ()>; + fn run( + &mut self, + ctx: C, + ) -> impl core::future::Future>; } pub trait BluetoothMeshElement { fn populate(&self, composition: &mut Composition); - async fn run(&mut self, ctx: C) -> Result<(), ()>; + fn run( + &mut self, + ctx: C, + ) -> impl core::future::Future>; } pub trait BluetoothMeshElementContext { @@ -192,13 +199,18 @@ pub trait BluetoothMeshElementContext { inbound: InboundModelChannelReceiver<'m, M::Message>, ) -> Self::ModelContext<'m, M>; - async fn receive(&self) -> AccessCountedHandle<'static, InboundPayload>; + fn receive( + &self, + ) -> impl core::future::Future>; } pub trait BluetoothMeshModel { type Model: Model = M; - async fn run>(&mut self, ctx: C) -> Result<(), ()>; + fn run>( + &mut self, + ctx: C, + ) -> impl core::future::Future>; fn model_identifier(&self) -> ModelIdentifier { M::IDENTIFIER @@ -213,18 +225,22 @@ pub type ParseFunction = for<'r> fn(&Opcode, &'r [u8]) -> Result::Message>, ParseError>; pub trait BluetoothMeshModelContext { - async fn receive(&self) -> InboundModelPayload; + fn receive(&self) -> impl core::future::Future>; - async fn send(&self, message: M::Message, meta: OutboundMetadata) -> Result<(), ()>; + fn send( + &self, + message: M::Message, + meta: OutboundMetadata, + ) -> impl core::future::Future>; - async fn send_with_completion( + fn send_with_completion( &self, message: M::Message, meta: OutboundMetadata, signal: &'static Signal, - ) -> CompletionStatus; + ) -> impl core::future::Future; - async fn publish(&self, message: M::Message) -> Result<(), ()>; + fn publish(&self, message: M::Message) -> impl core::future::Future>; } pub enum CompletionStatus { diff --git a/btmesh-driver/Cargo.toml b/btmesh-driver/Cargo.toml index f6991f4..0e90a3d 100644 --- a/btmesh-driver/Cargo.toml +++ b/btmesh-driver/Cargo.toml @@ -12,13 +12,11 @@ btmesh-bearer = { path = "../btmesh-bearer" } btmesh-device = { path = "../btmesh-device" } btmesh-models = { path = "../btmesh-models", features = ["serde"] } btmesh-macro = { path = "../btmesh-macro" } -embassy-time = { version = "0.1.3", default-features = false } -embassy-sync = { version = "0.3.0", default-features = false, features = [ - "nightly", -] } +embassy-time = { version = "0.3.2", default-features = false } +embassy-sync = { version = "0.6.0" } critical-section = { version = "1.1.1", default-features = false, optional = true } embassy-futures = { version = "0.1.0", default-features = false } -heapless = "0.7" +heapless = "0.8" hash32 = "0.2.1" hash32-derive = "0.1.1" uluru = "3.0.0" @@ -33,6 +31,7 @@ postcard = { version = "1.0.1", default-features = false, features = [ "heapless", ], optional = true } defmt = { version = "0.3", optional = true } +log = { version = "0.4", optional = true } [dev-dependencies] rand_core = { version = "0.6.2", default-features = false, features = [ @@ -60,8 +59,14 @@ defmt = [ "btmesh-models/defmt", "btmesh-pdu/defmt", ] +log = ["dep:log"] relay = ["btmesh-common/relay", "btmesh-models/relay"] proxy = ["btmesh-common/proxy"] friend = ["btmesh-common/friend"] low_power = ["btmesh-common/low_power"] + +[patch.crates-io] +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "1a1d5c4689a8b6c57ebb74e99fdea8df39adb037" } +embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "1a1d5c4689a8b6c57ebb74e99fdea8df39adb037" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "1a1d5c4689a8b6c57ebb74e99fdea8df39adb037" } diff --git a/btmesh-driver/src/lib.rs b/btmesh-driver/src/lib.rs index 37aeaf7..8fa1641 100644 --- a/btmesh-driver/src/lib.rs +++ b/btmesh-driver/src/lib.rs @@ -1,6 +1,5 @@ #![cfg_attr(not(test), no_std)] #![feature(type_alias_impl_trait)] -#![feature(async_fn_in_trait)] #![allow(incomplete_features)] #![feature(associated_type_defaults)] #![allow(dead_code)] @@ -73,7 +72,7 @@ pub trait BluetoothMeshDriver { Self: 'f, D: BluetoothMeshDevice + 'f; - fn run<'r, D: BluetoothMeshDevice>(&'r mut self, device: &'r mut D) -> Self::RunFuture<'_, D>; + fn run<'r, D: BluetoothMeshDevice>(&'r mut self, device: &'r mut D) -> Self::RunFuture<'r, D>; } pub struct Driver { @@ -853,7 +852,7 @@ impl BluetoothMes Self: 'f, D: BluetoothMeshDevice + 'f; - fn run<'r, D: BluetoothMeshDevice>(&'r mut self, device: &'r mut D) -> Self::RunFuture<'_, D> { + fn run<'r, D: BluetoothMeshDevice>(&'r mut self, device: &'r mut D) -> Self::RunFuture<'r, D> { async move { InnerDriver::new( unwrap!(self.network.take()), diff --git a/btmesh-macro/Cargo.toml b/btmesh-macro/Cargo.toml index e109832..01379e9 100644 --- a/btmesh-macro/Cargo.toml +++ b/btmesh-macro/Cargo.toml @@ -23,6 +23,9 @@ prettyplease = "0.1.18" [dev-dependencies] btmesh-device = { path = "../btmesh-device" } btmesh-models = { path = "../btmesh-models" } -embassy-time = { version = "0.1.3", default-features = false, features = [ +embassy-time = { version = "0.3.2", default-features = false, features = [ "std", ] } + +[patch.crates-io] +embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "1a1d5c4689a8b6c57ebb74e99fdea8df39adb037" } diff --git a/btmesh-models/Cargo.toml b/btmesh-models/Cargo.toml index 9562563..56ebdb8 100644 --- a/btmesh-models/Cargo.toml +++ b/btmesh-models/Cargo.toml @@ -12,7 +12,7 @@ serde = { version = "1.0", default-features = false, features = [ ], optional = true } defmt = { version = "0.3", optional = true } micromath = { version = "2.0" } -heapless = "0.7" +heapless = "0.8" [features] relay = [] diff --git a/btmesh-nrf-softdevice/Cargo.toml b/btmesh-nrf-softdevice/Cargo.toml index 615a848..0b3dd10 100644 --- a/btmesh-nrf-softdevice/Cargo.toml +++ b/btmesh-nrf-softdevice/Cargo.toml @@ -9,6 +9,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +embassy-sync = { version = "0.6.0" } btmesh-common = { path = "../btmesh-common", default-features = false } btmesh-pdu = { path = "../btmesh-pdu", default-features = false } btmesh-bearer = { path = "../btmesh-bearer", default-features = false } @@ -16,26 +17,22 @@ btmesh-driver = { path = "../btmesh-driver", default-features = false, features "flash", ] } btmesh-device = { path = "../btmesh-device", default-features = false } -heapless = "0.7" +heapless = "0.8" atomic-polyfill = { version = "1", default-features = false } rand_core = { version = "0.6.2", default-features = false } -embassy-sync = { version = "0.3.0", default-features = false, features = [ - "nightly", -] } embassy-futures = { version = "0.1.0", default-features = false } nrf-softdevice = { version = "0.1.0", default-features = false, features = [ - "nightly", "ble-peripheral", "ble-gatt-server", ] } nrf-softdevice-s140 = { version = "0.1.0", optional = true } nrf-softdevice-macro = { version = "0.1.0" } -defmt = { version = "0.3", optional = true } -embassy-nrf = { version = "0.1.0", default-features = false, features = [ +defmt = { version = "0.3.2", optional = true } +embassy-nrf = { version = "0.2.0", default-features = false, features = [ "time-driver-rtc1", "gpiote", ], optional = true } -embassy-time = { version = "0.1.3", default-features = false } +embassy-time = { version = "0.3", default-features = false } [features] default = ["nrf52840"] @@ -70,7 +67,10 @@ friend = ["btmesh-common/friend"] low_power = ["btmesh-common/low_power"] [patch.crates-io] -embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "65ed19aae272d6d6320554446f9187ec2ef8bf39" } -nrf-softdevice = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b08bda268d343e100932cbf0df7e007826fa3be" } -nrf-softdevice-s140 = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b08bda268d343e100932cbf0df7e007826fa3be" } -nrf-softdevice-macro = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b08bda268d343e100932cbf0df7e007826fa3be" } +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "1a1d5c4689a8b6c57ebb74e99fdea8df39adb037" } +embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "1a1d5c4689a8b6c57ebb74e99fdea8df39adb037" } +embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "1a1d5c4689a8b6c57ebb74e99fdea8df39adb037" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "1a1d5c4689a8b6c57ebb74e99fdea8df39adb037" } +nrf-softdevice = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "d554940a57646328e1a0f913fe83e59e350019a1" } +nrf-softdevice-s140 = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "d554940a57646328e1a0f913fe83e59e350019a1" } +nrf-softdevice-macro = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "d554940a57646328e1a0f913fe83e59e350019a1" } diff --git a/btmesh-nrf-softdevice/examples/microbit/basic/.cargo/config.toml b/btmesh-nrf-softdevice/examples/microbit/basic/.cargo/config.toml index bc8cd9f..b32ce55 100644 --- a/btmesh-nrf-softdevice/examples/microbit/basic/.cargo/config.toml +++ b/btmesh-nrf-softdevice/examples/microbit/basic/.cargo/config.toml @@ -1,14 +1,16 @@ [target.'cfg(all(target_arch = "arm", target_os = "none"))'] # replace nRF82840_xxAA with your chip as listed in `probe-run --list-chips` -runner = "probe-run --chip nRF52833_xxAA" +runner = "probe-rs run --chip nRF52833_xxAA" rustflags = [ # Code-size optimizations. - "-Z", "trap-unreachable=no", - "-C", "inline-threshold=5", - "-C", "no-vectorize-loops", -# "-Z", "print-type-sizes", - "-Z", "emit-stack-sizes", + "-Z", + "trap-unreachable=no", + "-C", + "no-vectorize-loops", + # "-Z", "print-type-sizes", + "-Z", + "emit-stack-sizes", ] diff --git a/btmesh-nrf-softdevice/examples/microbit/basic/Cargo.toml b/btmesh-nrf-softdevice/examples/microbit/basic/Cargo.toml index 2590df8..d23a67c 100644 --- a/btmesh-nrf-softdevice/examples/microbit/basic/Cargo.toml +++ b/btmesh-nrf-softdevice/examples/microbit/basic/Cargo.toml @@ -17,18 +17,17 @@ defmt = { version = "0.3" } defmt-rtt = { version = "0.4" } panic-probe = { version = "0.3", features = ["print-defmt"] } -embassy-executor = { version = "0.3.0", default-features = false, features = [ +embassy-executor = { version = "0.6.3", default-features = false, features = [ "arch-cortex-m", "executor-thread", "defmt", "integrated-timers", - "nightly", ] } -embassy-time = { version = "0.1.3", default-features = false, features = [ +embassy-time = { version = "0.3.2", default-features = false, features = [ "defmt", "defmt-timestamp-uptime", ] } -embassy-nrf = { version = "0.1.0", default-features = false, features = [ +embassy-nrf = { version = "0.2.0", default-features = false, features = [ "rt", "nrf52833", "gpiote", @@ -84,15 +83,11 @@ opt-level = 1 overflow-checks = false [patch.crates-io] -embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "65ed19aae272d6d6320554446f9187ec2ef8bf39" } -embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "65ed19aae272d6d6320554446f9187ec2ef8bf39" } -embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "65ed19aae272d6d6320554446f9187ec2ef8bf39" } -embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "65ed19aae272d6d6320554446f9187ec2ef8bf39" } -embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "65ed19aae272d6d6320554446f9187ec2ef8bf39" } -nrf-softdevice = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b08bda268d343e100932cbf0df7e007826fa3be" } -nrf-softdevice-s140 = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b08bda268d343e100932cbf0df7e007826fa3be" } -nrf-softdevice-macro = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b08bda268d343e100932cbf0df7e007826fa3be" } - -#nrf-softdevice = { path = "../../../../../nrf-softdevice/nrf-softdevice" } -#nrf-softdevice-s140 = { path = "../../../../../nrf-softdevice/nrf-softdevice-s140" } -#nrf-softdevice-macro = { path = "../../../../../nrf-softdevice/nrf-softdevice-macro" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "1a1d5c4689a8b6c57ebb74e99fdea8df39adb037" } +embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "1a1d5c4689a8b6c57ebb74e99fdea8df39adb037" } +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "1a1d5c4689a8b6c57ebb74e99fdea8df39adb037" } +embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "1a1d5c4689a8b6c57ebb74e99fdea8df39adb037" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "1a1d5c4689a8b6c57ebb74e99fdea8df39adb037" } +nrf-softdevice = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "d554940a57646328e1a0f913fe83e59e350019a1" } +nrf-softdevice-s140 = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "d554940a57646328e1a0f913fe83e59e350019a1" } +nrf-softdevice-macro = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "d554940a57646328e1a0f913fe83e59e350019a1" } diff --git a/btmesh-nrf-softdevice/examples/microbit/basic/src/device.rs b/btmesh-nrf-softdevice/examples/microbit/basic/src/device.rs index fc5d309..58a6ae8 100644 --- a/btmesh-nrf-softdevice/examples/microbit/basic/src/device.rs +++ b/btmesh-nrf-softdevice/examples/microbit/basic/src/device.rs @@ -35,7 +35,7 @@ impl<'d> ElementZero<'d> { } struct MyOnOffServerHandler<'d> { - led: Output<'d, AnyPin>, + led: Output<'d>, } impl<'d> MyOnOffServerHandler<'d> { @@ -92,7 +92,7 @@ impl BluetoothMeshModel for MyOnOffServerHandler<'_> { } struct MyOnOffClientHandler<'d> { - button: Input<'d, AnyPin>, + button: Input<'d>, } impl MyOnOffClientHandler<'_> { diff --git a/btmesh-nrf-softdevice/examples/microbit/basic/src/main.rs b/btmesh-nrf-softdevice/examples/microbit/basic/src/main.rs index 8d7b638..27a5198 100644 --- a/btmesh-nrf-softdevice/examples/microbit/basic/src/main.rs +++ b/btmesh-nrf-softdevice/examples/microbit/basic/src/main.rs @@ -2,7 +2,6 @@ #![no_main] #![macro_use] #![feature(type_alias_impl_trait)] -#![feature(async_fn_in_trait)] #![allow(incomplete_features)] use embassy_executor::Spawner; diff --git a/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/.cargo/config.toml b/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/.cargo/config.toml index 07b425b..d7af6ad 100644 --- a/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/.cargo/config.toml +++ b/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/.cargo/config.toml @@ -1,14 +1,16 @@ [target.'cfg(all(target_arch = "arm", target_os = "none"))'] # replace nRF82840_xxAA with your chip as listed in `probe-run --list-chips` -runner = "probe-run --chip nRF52840_xxAA" +runner = "probe-rs run --chip nRF52840_xxAA" rustflags = [ # Code-size optimizations. - "-Z", "trap-unreachable=no", - "-C", "inline-threshold=5", - "-C", "no-vectorize-loops", -# "-Z", "print-type-sizes", - "-Z", "emit-stack-sizes", + "-Z", + "trap-unreachable=no", + "-C", + "no-vectorize-loops", + # "-Z", "print-type-sizes", + "-Z", + "emit-stack-sizes", ] diff --git a/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/Cargo.toml b/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/Cargo.toml index b9679d7..08a0a93 100644 --- a/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/Cargo.toml +++ b/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/Cargo.toml @@ -17,18 +17,17 @@ defmt = { version = "0.3" } defmt-rtt = { version = "0.4" } panic-probe = { version = "0.3", features = ["print-defmt"] } -embassy-executor = { version = "0.3.0", default-features = false, features = [ +embassy-executor = { version = "0.6.0", default-features = false, features = [ "arch-cortex-m", "executor-thread", "defmt", "integrated-timers", - "nightly", ] } -embassy-time = { version = "0.1.3", default-features = false, features = [ +embassy-time = { version = "0.3.2", default-features = false, features = [ "defmt", "defmt-timestamp-uptime", ] } -embassy-nrf = { version = "0.1.0", default-features = false, features = [ +embassy-nrf = { version = "0.2.0", default-features = false, features = [ "rt", "nrf52840", "gpiote", @@ -84,11 +83,11 @@ opt-level = 1 overflow-checks = false [patch.crates-io] -embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "65ed19aae272d6d6320554446f9187ec2ef8bf39" } -embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "65ed19aae272d6d6320554446f9187ec2ef8bf39" } -embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "65ed19aae272d6d6320554446f9187ec2ef8bf39" } -embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "65ed19aae272d6d6320554446f9187ec2ef8bf39" } -embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "65ed19aae272d6d6320554446f9187ec2ef8bf39" } -nrf-softdevice = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b08bda268d343e100932cbf0df7e007826fa3be" } -nrf-softdevice-s140 = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b08bda268d343e100932cbf0df7e007826fa3be" } -nrf-softdevice-macro = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "3b08bda268d343e100932cbf0df7e007826fa3be" } +embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "1a1d5c4689a8b6c57ebb74e99fdea8df39adb037" } +embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "1a1d5c4689a8b6c57ebb74e99fdea8df39adb037" } +embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "1a1d5c4689a8b6c57ebb74e99fdea8df39adb037" } +embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "1a1d5c4689a8b6c57ebb74e99fdea8df39adb037" } +embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "1a1d5c4689a8b6c57ebb74e99fdea8df39adb037" } +nrf-softdevice = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "d554940a57646328e1a0f913fe83e59e350019a1" } +nrf-softdevice-s140 = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "d554940a57646328e1a0f913fe83e59e350019a1" } +nrf-softdevice-macro = { git = "https://github.com/embassy-rs/nrf-softdevice/", rev = "d554940a57646328e1a0f913fe83e59e350019a1" } diff --git a/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/src/device.rs b/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/src/device.rs index fc5d309..58a6ae8 100644 --- a/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/src/device.rs +++ b/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/src/device.rs @@ -35,7 +35,7 @@ impl<'d> ElementZero<'d> { } struct MyOnOffServerHandler<'d> { - led: Output<'d, AnyPin>, + led: Output<'d>, } impl<'d> MyOnOffServerHandler<'d> { @@ -92,7 +92,7 @@ impl BluetoothMeshModel for MyOnOffServerHandler<'_> { } struct MyOnOffClientHandler<'d> { - button: Input<'d, AnyPin>, + button: Input<'d>, } impl MyOnOffClientHandler<'_> { diff --git a/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/src/main.rs b/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/src/main.rs index 8d7b638..27a5198 100644 --- a/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/src/main.rs +++ b/btmesh-nrf-softdevice/examples/nrf52840-dk/basic/src/main.rs @@ -2,7 +2,6 @@ #![no_main] #![macro_use] #![feature(type_alias_impl_trait)] -#![feature(async_fn_in_trait)] #![allow(incomplete_features)] use embassy_executor::Spawner; diff --git a/btmesh-nrf-softdevice/src/driver.rs b/btmesh-nrf-softdevice/src/driver.rs index 0bb0ca8..10b7013 100644 --- a/btmesh-nrf-softdevice/src/driver.rs +++ b/btmesh-nrf-softdevice/src/driver.rs @@ -141,11 +141,13 @@ impl NrfSoftdeviceAdvertisingOnlyDriver { } impl BluetoothMeshDriver for NrfSoftdeviceAdvertisingOnlyDriver { - type RunFuture<'f, D> = impl Future> + 'f + type RunFuture<'f, D> + = impl Future> + 'f where - Self: 'f, D: BluetoothMeshDevice + 'f; + Self: 'f, + D: BluetoothMeshDevice + 'f; - fn run<'r, D: BluetoothMeshDevice>(&'r mut self, device: &'r mut D) -> Self::RunFuture<'_, D> { + fn run<'r, D: BluetoothMeshDevice>(&'r mut self, device: &'r mut D) -> Self::RunFuture<'r, D> { self.0.run(device) } } @@ -191,11 +193,13 @@ impl NrfSoftdeviceAdvertisingAndGattDriver { } impl BluetoothMeshDriver for NrfSoftdeviceAdvertisingAndGattDriver { - type RunFuture<'f, D> = impl Future> + 'f + type RunFuture<'f, D> + = impl Future> + 'f where - Self: 'f, D: BluetoothMeshDevice + 'f; + Self: 'f, + D: BluetoothMeshDevice + 'f; - fn run<'r, D: BluetoothMeshDevice>(&'r mut self, device: &'r mut D) -> Self::RunFuture<'_, D> { + fn run<'r, D: BluetoothMeshDevice>(&'r mut self, device: &'r mut D) -> Self::RunFuture<'r, D> { self.0.run(device) } } diff --git a/btmesh-nrf-softdevice/src/gatt.rs b/btmesh-nrf-softdevice/src/gatt.rs index 5088f80..ed09fb2 100644 --- a/btmesh-nrf-softdevice/src/gatt.rs +++ b/btmesh-nrf-softdevice/src/gatt.rs @@ -107,17 +107,19 @@ impl GattBearer<66> for SoftdeviceGattBearer { RESET_SIGNAL.signal(()) } - type RunFuture<'m> = impl Future> + 'm + type RunFuture<'m> + = impl Future> + 'm where - Self: 'm; + Self: 'm; fn run(&self) -> Self::RunFuture<'_> { SoftdeviceGattBearer::run(self) } - type ReceiveFuture<'m> = impl Future, BearerError>> + 'm + type ReceiveFuture<'m> + = impl Future, BearerError>> + 'm where - Self: 'm; + Self: 'm; fn receive(&self) -> Self::ReceiveFuture<'_> { async move { Ok(self.inbound.receive().await) } diff --git a/btmesh-pdu/Cargo.toml b/btmesh-pdu/Cargo.toml index 4daa186..8075b57 100644 --- a/btmesh-pdu/Cargo.toml +++ b/btmesh-pdu/Cargo.toml @@ -7,16 +7,16 @@ edition = "2021" [dependencies] -heapless = "0.7" +heapless = "0.8" defmt = { version = "0.3.1", optional = true } -btmesh-common = { path = "../btmesh-common", features = ["defmt"], default-features = false } -p256 = { version = "0.10.0", default-features = false, features = [ "arithmetic" ] } -serde = { version = "1.0", default-features = false, features = [ "derive"], optional = true} +btmesh-common = { path = "../btmesh-common", features = [ + "defmt", +], default-features = false } +p256 = { version = "0.10", default-features = false, features = ["arithmetic"] } +serde = { version = "1.0", default-features = false, features = [ + "derive", +], optional = true } [features] -defmt = [ - "dep:defmt", -] - - - +defmt = ["dep:defmt"] +serde = ["dep:serde", "heapless/serde"] diff --git a/rust-toolchain.toml b/rust-toolchain.toml index feb6a40..baa1444 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,6 +1,6 @@ # Before upgrading check that everything is available on all tier1 targets here: # https://rust-lang.github.io/rustup-components-history [toolchain] -channel = "nightly-2023-09-30" +channel = "nightly-2024-09-20" components = ["rust-src", "rustfmt"] targets = ["thumbv7em-none-eabi", "thumbv7em-none-eabihf"]