Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dependencies and Rust Version #24

Merged
merged 7 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions btmesh-bearer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
4 changes: 2 additions & 2 deletions btmesh-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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 = []
Expand Down
13 changes: 9 additions & 4 deletions btmesh-device/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand All @@ -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" }
38 changes: 27 additions & 11 deletions btmesh-device/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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)]

Expand Down Expand Up @@ -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<Output = AccessCountedHandle<'static, InboundPayload>>;
}

pub trait BluetoothMeshDevice {
fn composition(&self) -> Composition<CompositionExtra>;

async fn run<C: BluetoothMeshDeviceContext>(&mut self, ctx: C) -> Result<(), ()>;
fn run<C: BluetoothMeshDeviceContext>(
&mut self,
ctx: C,
) -> impl core::future::Future<Output = Result<(), ()>>;
}

pub trait BluetoothMeshElement {
fn populate(&self, composition: &mut Composition<CompositionExtra>);

async fn run<C: BluetoothMeshElementContext>(&mut self, ctx: C) -> Result<(), ()>;
fn run<C: BluetoothMeshElementContext>(
&mut self,
ctx: C,
) -> impl core::future::Future<Output = Result<(), ()>>;
}

pub trait BluetoothMeshElementContext {
Expand All @@ -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<Output = AccessCountedHandle<'static, InboundPayload>>;
}

pub trait BluetoothMeshModel<M: Model> {
type Model: Model = M;

async fn run<C: BluetoothMeshModelContext<M>>(&mut self, ctx: C) -> Result<(), ()>;
fn run<C: BluetoothMeshModelContext<M>>(
&mut self,
ctx: C,
) -> impl core::future::Future<Output = Result<(), ()>>;

fn model_identifier(&self) -> ModelIdentifier {
M::IDENTIFIER
Expand All @@ -213,18 +225,22 @@ pub type ParseFunction<M> =
for<'r> fn(&Opcode, &'r [u8]) -> Result<Option<<M as Model>::Message>, ParseError>;

pub trait BluetoothMeshModelContext<M: Model> {
async fn receive(&self) -> InboundModelPayload<M::Message>;
fn receive(&self) -> impl core::future::Future<Output = InboundModelPayload<M::Message>>;

async fn send(&self, message: M::Message, meta: OutboundMetadata) -> Result<(), ()>;
fn send(
&self,
message: M::Message,
meta: OutboundMetadata,
) -> impl core::future::Future<Output = Result<(), ()>>;

async fn send_with_completion(
fn send_with_completion(
&self,
message: M::Message,
meta: OutboundMetadata,
signal: &'static Signal<CompletionStatus>,
) -> CompletionStatus;
) -> impl core::future::Future<Output = CompletionStatus>;

async fn publish(&self, message: M::Message) -> Result<(), ()>;
fn publish(&self, message: M::Message) -> impl core::future::Future<Output = Result<(), ()>>;
}

pub enum CompletionStatus {
Expand Down
15 changes: 10 additions & 5 deletions btmesh-driver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 = [
Expand Down Expand Up @@ -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" }
5 changes: 2 additions & 3 deletions btmesh-driver/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down Expand Up @@ -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<N: NetworkInterfaces, R: RngCore + CryptoRng, B: BackingStore> {
Expand Down Expand Up @@ -853,7 +852,7 @@ impl<N: NetworkInterfaces, R: RngCore + CryptoRng, B: BackingStore> 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()),
Expand Down
5 changes: 4 additions & 1 deletion btmesh-macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
2 changes: 1 addition & 1 deletion btmesh-models/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
24 changes: 12 additions & 12 deletions btmesh-nrf-softdevice/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,30 @@ 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 }
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"]
Expand Down Expand Up @@ -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" }
14 changes: 8 additions & 6 deletions btmesh-nrf-softdevice/examples/microbit/basic/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -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",
]


Expand Down
27 changes: 11 additions & 16 deletions btmesh-nrf-softdevice/examples/microbit/basic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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" }
4 changes: 2 additions & 2 deletions btmesh-nrf-softdevice/examples/microbit/basic/src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl<'d> ElementZero<'d> {
}

struct MyOnOffServerHandler<'d> {
led: Output<'d, AnyPin>,
led: Output<'d>,
}

impl<'d> MyOnOffServerHandler<'d> {
Expand Down Expand Up @@ -92,7 +92,7 @@ impl BluetoothMeshModel<GenericOnOffServer> for MyOnOffServerHandler<'_> {
}

struct MyOnOffClientHandler<'d> {
button: Input<'d, AnyPin>,
button: Input<'d>,
}

impl MyOnOffClientHandler<'_> {
Expand Down
1 change: 0 additions & 1 deletion btmesh-nrf-softdevice/examples/microbit/basic/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading