Skip to content

Commit d9788ba

Browse files
committed
update trouble deps
1 parent dd586cd commit d9788ba

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ embassy-nrf = { version = "0.3", default-features = false, features = [
1818
"time-driver-rtc1",
1919
] }
2020
embassy-time = { version = "0.4", default-features = false }
21-
embassy-sync = { version = "0.6" }
21+
embassy-sync = { version = "0.6.2" }
2222
cortex-m = { version = "0.7.6" }
2323
embedded-hal = "1.0"
2424
lsm303agr = "1.1.0"

examples/trouble/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ embassy-executor = { version = "0.7", default-features = false, features = [
1414
] }
1515
embassy-time = { version = "0.4", default-features = false, features = ["defmt", "defmt-timestamp-uptime"] }
1616
embassy-futures = "0.1.1"
17-
embassy-sync = { version = "0.6", features = ["defmt"] }
17+
embassy-sync = { version = "0.6.2", features = ["defmt"] }
1818
microbit-bsp = { path = "../../", features = ["trouble"]}
1919

2020
futures = { version = "0.3", default-features = false, features = ["async-await"]}
2121
trouble-host = { git = "https://github.com/embassy-rs/trouble.git", features = [
2222
"defmt",
23-
], rev = "770b1e801c0a06ba51a4eb9b9f5a393726f32f33"}
23+
], rev = "a1daee269deee25fbb6236cb599a8fb5919c02b7"}
2424

2525
defmt = "0.3.10"
2626
defmt-rtt = "0.4.0"

examples/trouble/src/main.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ const CONNECTIONS_MAX: usize = 1;
1919
/// Max number of L2CAP channels.
2020
const L2CAP_CHANNELS_MAX: usize = 2; // Signal + att
2121

22-
type Resources<C> = HostResources<C, CONNECTIONS_MAX, L2CAP_CHANNELS_MAX, L2CAP_MTU>;
23-
2422
// GATT Server definition
2523
#[gatt_server]
2624
struct Server {
@@ -64,10 +62,11 @@ where
6462
let address = Address::random([0x42, 0x6A, 0xE3, 0x1E, 0x83, 0xE7]);
6563
info!("Our address = {:?}", address);
6664

67-
let mut resources = Resources::new(PacketQos::None);
68-
let (stack, mut peripheral, _, runner) = trouble_host::new(controller, &mut resources)
69-
.set_random_address(address)
70-
.build();
65+
let mut resources: HostResources<CONNECTIONS_MAX, L2CAP_CHANNELS_MAX, L2CAP_MTU> = HostResources::new();
66+
let stack = trouble_host::new(controller, &mut resources).set_random_address(address);
67+
let Host {
68+
mut peripheral, runner, ..
69+
} = stack.build();
7170

7271
info!("Starting advertising and GATT service");
7372
let server = Server::new_with_config(GapConfig::Peripheral(PeripheralConfig {
@@ -82,7 +81,7 @@ where
8281
Ok(conn) => {
8382
// set up tasks when the connection is established to a central, so they don't run when no one is connected.
8483
let a = gatt_events_task(&server, &conn);
85-
let b = custom_task(&server, &conn, stack);
84+
let b = custom_task(&server, &conn, &stack);
8685
// run until any task ends (usually because the connection has been closed),
8786
// then return to advertising state.
8887
select(a, b).await;
@@ -180,7 +179,7 @@ async fn advertise<'a, C: Controller>(
180179
/// This task will notify the connected central of a counter value every 2 seconds.
181180
/// It will also read the RSSI value every 2 seconds.
182181
/// and will stop when the connection is closed by the central or an error occurs.
183-
async fn custom_task<C: Controller>(server: &Server<'_>, conn: &Connection<'_>, stack: Stack<'_, C>) {
182+
async fn custom_task<C: Controller>(server: &Server<'_>, conn: &Connection<'_>, stack: &Stack<'_, C>) {
184183
let mut tick: u8 = 0;
185184
let level = server.battery_service.level;
186185
loop {

0 commit comments

Comments
 (0)