Skip to content

Commit 19d555b

Browse files
authored
Merge pull request #29 from chrissuozzo/chore-update-trouble-version
chore: update deps for `trouble-host` v0.2 compatibility
2 parents 9c7d52e + 0a44d58 commit 19d555b

12 files changed

Lines changed: 180 additions & 135 deletions

File tree

Cargo.toml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ repository = "https://github.com/lulf/microbit-bsp"
1010
rust-version = "1.83"
1111

1212
[dependencies]
13-
embassy-nrf = { version = "0.3", features = [
13+
embassy-nrf = { version = "0.3.1", features = [
1414
"gpiote",
1515
"nfc-pins-as-gpio",
1616
"nrf52833",
1717
"time-driver-rtc1",
1818
"time",
1919
] }
2020
embassy-time = { version = "0.4", default-features = false }
21-
embassy-sync = { version = "0.6.2" }
21+
embassy-sync = { version = "0.7.0" }
2222
cortex-m = { version = "0.7.6" }
2323
embedded-hal = "1.0"
24-
lsm303agr = {version = "1.1.0", features = ["async"] }
24+
lsm303agr = { version = "1.1.0", features = ["async"] }
2525
futures = { version = "0.3", default-features = false }
2626

2727
defmt = { version = "^1.0.1", optional = true }
@@ -37,7 +37,7 @@ nrf-mpsl = { version = "0.1.0", default-features = false, features = [
3737
"defmt",
3838
"critical-section-impl",
3939
], optional = true }
40-
static_cell = { version = "2", optional = true }
40+
static_cell = "2"
4141

4242
[features]
4343
default = ["defmt"]
@@ -53,9 +53,13 @@ trouble = [
5353
"embassy-nrf/rt",
5454
"nrf-sdc",
5555
"nrf-mpsl",
56-
"static_cell",
5756
]
5857

5958
[patch.crates-io]
60-
nrf-sdc = { git = "https://github.com/alexmoon/nrf-sdc.git", rev="551a95436e999b4290b4a33383aa3d6747b63dd9" }
61-
nrf-mpsl = { git = "https://github.com/alexmoon/nrf-sdc.git", rev="551a95436e999b4290b4a33383aa3d6747b63dd9" }
59+
nrf-sdc = { git = "https://github.com/alexmoon/nrf-sdc.git", rev="7be9b853e15ca0404d65c623d1ec5795fd96c204" }
60+
nrf-mpsl = { git = "https://github.com/alexmoon/nrf-sdc.git", rev="7be9b853e15ca0404d65c623d1ec5795fd96c204" }
61+
62+
embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
63+
embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
64+
embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
65+
embassy-time-driver = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }

examples/accelerometer/Cargo.toml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ edition = "2021"
66
[dependencies]
77
microbit-bsp = { path = "../../" }
88

9-
embassy-futures = { version = "0.1", default-features = false }
9+
embassy-futures = { version = "0.1.1", default-features = false }
1010
embassy-executor = { version = "0.7", default-features = false, features = [
1111
"arch-cortex-m",
1212
"defmt",
1313
"executor-interrupt",
14-
"executor-thread",
15-
"task-arena-size-32768"
16-
] }
14+
"executor-thread"
15+
] }
1716
embassy-time = { version = "0.4", default-features = false, features = ["defmt-timestamp-uptime", "defmt"] }
1817

1918
cortex-m-rt = "0.7"
@@ -25,3 +24,11 @@ panic-probe = { version = "^1", features = ["print-defmt"] }
2524

2625
[profile.release]
2726
debug = 2
27+
28+
[patch.crates-io]
29+
embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
30+
embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
31+
embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
32+
embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
33+
embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
34+
embassy-time-driver = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }

examples/ble-nrf-softdevice/Cargo.toml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ edition = "2021"
66
[dependencies]
77
microbit-bsp = { path = "../../" }
88

9-
embassy-futures = { version = "0.1", default-features = false }
9+
embassy-futures = { version = "0.1.1", default-features = false }
1010
embassy-executor = { version = "0.7", default-features = false, features = [
1111
"arch-cortex-m",
1212
"defmt",
13-
"executor-thread",
14-
"task-arena-size-32768"
15-
] }
13+
"executor-thread"
14+
] }
1615
embassy-time = { version = "0.4", default-features = false, features = ["defmt-timestamp-uptime"] }
1716

1817
nrf-softdevice = { version = "0.1.0", features = ["ble-peripheral", "ble-gatt-server", "s113", "nrf52833", "critical-section-impl", "defmt"] }
@@ -30,5 +29,12 @@ panic-probe = { version = "1", features = ["print-defmt"] }
3029
debug = 2
3130

3231
[patch.crates-io]
33-
nrf-softdevice = { git = "https://github.com/embassy-rs/nrf-softdevice.git", rev = "7e017eb3dba5bac30748916012b886214291c132" }
34-
nrf-softdevice-s113 = { git = "https://github.com/embassy-rs/nrf-softdevice.git", rev = "7e017eb3dba5bac30748916012b886214291c132" }
32+
nrf-softdevice = { git = "https://github.com/embassy-rs/nrf-softdevice.git", rev = "a9206dd36f713c7b3a10468245fe1927b653ccc6" }
33+
nrf-softdevice-s113 = { git = "https://github.com/embassy-rs/nrf-softdevice.git", rev = "a9206dd36f713c7b3a10468245fe1927b653ccc6" }
34+
35+
embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
36+
embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
37+
embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
38+
embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
39+
embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
40+
embassy-time-driver = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }

examples/ble-trouble/Cargo.toml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,15 @@ embassy-executor = { version = "0.7", default-features = false, features = [
99
"arch-cortex-m",
1010
"defmt",
1111
"executor-interrupt",
12-
"executor-thread",
13-
"task-arena-size-32768"
12+
"executor-thread"
1413
] }
1514
embassy-time = { version = "0.4", default-features = false, features = ["defmt", "defmt-timestamp-uptime"] }
1615
embassy-futures = "0.1.1"
17-
embassy-sync = { version = "0.6.2", features = ["defmt"] }
16+
embassy-sync = { version = "0.7", features = ["defmt"] }
1817
microbit-bsp = { path = "../../", features = ["trouble"]}
1918

2019
futures = { version = "0.3", default-features = false, features = ["async-await"]}
21-
trouble-host = { version = "0.1.0", features = ["defmt", "gatt", "peripheral"] }
20+
trouble-host = { version = "0.2.0", features = ["defmt", "gatt", "peripheral"] }
2221

2322
defmt = "1.0.1"
2423
defmt-rtt = "1"
@@ -32,5 +31,12 @@ static_cell = "2"
3231
debug = 2
3332

3433
[patch.crates-io]
35-
nrf-sdc = { git = "https://github.com/alexmoon/nrf-sdc.git", rev="551a95436e999b4290b4a33383aa3d6747b63dd9" }
36-
nrf-mpsl = { git = "https://github.com/alexmoon/nrf-sdc.git", rev="551a95436e999b4290b4a33383aa3d6747b63dd9" }
34+
nrf-sdc = { git = "https://github.com/alexmoon/nrf-sdc.git", rev="7be9b853e15ca0404d65c623d1ec5795fd96c204" }
35+
nrf-mpsl = { git = "https://github.com/alexmoon/nrf-sdc.git", rev="7be9b853e15ca0404d65c623d1ec5795fd96c204" }
36+
37+
embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
38+
embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
39+
embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
40+
embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
41+
embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
42+
embassy-time-driver = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }

examples/ble-trouble/src/main.rs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ use embassy_futures::select::select;
99
use microbit_bsp::{ble::MultiprotocolServiceLayer, Config, Microbit};
1010
use trouble_host::prelude::*;
1111

12-
/// Size of L2CAP packets (ATT MTU is this - 4)
13-
const L2CAP_MTU: usize = 251;
14-
1512
/// Max number of connections
1613
const CONNECTIONS_MAX: usize = 1;
1714

@@ -59,7 +56,7 @@ where
5956
let address = Address::random([0x42, 0x6A, 0xE3, 0x1E, 0x83, 0xE7]);
6057
info!("Our address = {:?}", address);
6158

62-
let mut resources: HostResources<CONNECTIONS_MAX, L2CAP_CHANNELS_MAX, L2CAP_MTU> = HostResources::new();
59+
let mut resources: HostResources<DefaultPacketPool, CONNECTIONS_MAX, L2CAP_CHANNELS_MAX> = HostResources::new();
6360
let stack = trouble_host::new(controller, &mut resources).set_random_address(address);
6461
let Host {
6562
mut peripheral, runner, ..
@@ -89,7 +86,7 @@ where
8986
}
9087

9188
/// This is a background task that is required to run forever alongside any other BLE tasks.
92-
async fn ble_task<C: Controller>(mut runner: Runner<'_, C>) -> Result<(), BleHostError<C::Error>> {
89+
async fn ble_task<C: Controller, P: PacketPool>(mut runner: Runner<'_, C, P>) -> Result<(), BleHostError<C::Error>> {
9390
runner.run().await
9491
}
9592

@@ -98,9 +95,9 @@ async fn ble_task<C: Controller>(mut runner: Runner<'_, C>) -> Result<(), BleHos
9895
/// Create an advertiser to use to connect to a BLE Central, and wait for it to connect.
9996
async fn advertise<'a, 'b, C: Controller>(
10097
name: &'a str,
101-
peripheral: &mut Peripheral<'a, C>,
98+
peripheral: &mut Peripheral<'a, C, DefaultPacketPool>,
10299
server: &'b Server<'_>,
103-
) -> Result<GattConnection<'a, 'b>, BleHostError<C::Error>> {
100+
) -> Result<GattConnection<'a, 'b, DefaultPacketPool>, BleHostError<C::Error>> {
104101
let mut advertiser_data = [0; 31];
105102
AdStructure::encode_slice(
106103
&[
@@ -127,7 +124,7 @@ async fn advertise<'a, 'b, C: Controller>(
127124

128125
/// This function will handle the GATT events and process them.
129126
/// This is how we interact with read and write requests.
130-
async fn connection_task(server: &Server<'_>, conn: &GattConnection<'_, '_>) {
127+
async fn connection_task<P: PacketPool>(server: &Server<'_>, conn: &GattConnection<'_, '_, P>) {
131128
let level = server.battery_service.level;
132129
unwrap!(level.set(server, &42));
133130
loop {
@@ -136,16 +133,13 @@ async fn connection_task(server: &Server<'_>, conn: &GattConnection<'_, '_>) {
136133
info!("[gatt] disconnected: {:?}", reason);
137134
break;
138135
}
139-
GattConnectionEvent::Gatt { event } => match event {
140-
// Server processing emits
141-
Ok(event) => {
142-
if let Ok(reply) = event.accept() {
143-
reply.send().await;
144-
}
136+
GattConnectionEvent::Gatt { event } => {
137+
match event.accept() {
138+
Ok(reply) => reply.send().await,
139+
Err(e) => warn!("[gatt] error sending response: {:?}", e)
145140
}
146-
Err(e) => warn!("[gatt] error processing event: {:?}", e),
147141
}
148-
_ => (),
142+
_ => {}
149143
}
150144
}
151145
info!("[gatt] task finished");

examples/display/Cargo.toml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ edition = "2021"
66
[dependencies]
77
microbit-bsp = { path = "../../" }
88

9-
embassy-futures = { version = "0.1", default-features = false }
9+
embassy-futures = { version = "0.1.1", default-features = false }
1010
embassy-executor = { version = "0.7.0", default-features = false, features = [
1111
"arch-cortex-m",
1212
"defmt",
1313
"executor-interrupt",
14-
"executor-thread",
15-
"task-arena-size-32768"
16-
] }
14+
"executor-thread"
15+
] }
1716
embassy-time = { version = "0.4.0", default-features = false, features = ["defmt-timestamp-uptime", "defmt"] }
1817

1918
cortex-m-rt = "0.7"
@@ -25,3 +24,11 @@ panic-probe = { version = "1", features = ["print-defmt"] }
2524

2625
[profile.release]
2726
debug = 2
27+
28+
[patch.crates-io]
29+
embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
30+
embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
31+
embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
32+
embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
33+
embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
34+
embassy-time-driver = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }

examples/magnetometer/Cargo.toml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
microbit-bsp= { path = "../../" }
7+
microbit-bsp = { path = "../../" }
88

9-
embassy-futures = { version = "0.1", default-features = false }
10-
embassy-executor = { version = "0.7", default-features = false, features = ["defmt", "arch-cortex-m", "executor-thread", "executor-interrupt", "task-arena-size-32768"] }
9+
embassy-futures = { version = "0.1.1", default-features = false }
10+
embassy-executor = { version = "0.7", default-features = false, features = ["defmt", "arch-cortex-m", "executor-thread", "executor-interrupt"] }
1111
embassy-time = { version = "0.4", default-features = false, features = ["defmt-timestamp-uptime", "defmt"] }
1212

1313
cortex-m-rt = "0.7"
@@ -20,3 +20,11 @@ libm = "0.2.8"
2020

2121
[profile.release]
2222
debug = 2
23+
24+
[patch.crates-io]
25+
embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
26+
embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
27+
embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
28+
embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
29+
embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
30+
embassy-time-driver = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }

examples/speaker/Cargo.toml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ edition = "2021"
66
[dependencies]
77
microbit-bsp = { path = "../../" }
88

9-
embassy-futures = { version = "0.1", default-features = false }
9+
embassy-futures = { version = "0.1.1", default-features = false }
1010
embassy-executor = { version = "0.7", default-features = false, features = [
1111
"arch-cortex-m",
1212
"defmt",
1313
"executor-interrupt",
1414
"executor-thread",
15-
"task-arena-size-32768"
16-
] }
15+
] }
1716
embassy-time = { version = "0.4", default-features = false, features = ["defmt-timestamp-uptime", "defmt"] }
1817

1918
cortex-m-rt = "0.7"
@@ -25,3 +24,11 @@ panic-probe = { version = "1", features = ["print-defmt"] }
2524

2625
[profile.release]
2726
debug = 2
27+
28+
[patch.crates-io]
29+
embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
30+
embassy-futures = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
31+
embassy-nrf = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
32+
embassy-sync = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
33+
embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }
34+
embassy-time-driver = { git = "https://github.com/embassy-rs/embassy.git", rev = "f35aa4005a63e8d478b2b95aaa2bfb316b72dece" }

0 commit comments

Comments
 (0)