aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Lilleengen <[email protected]>2024-01-12 08:33:35 +0000
committerGitHub <[email protected]>2024-01-12 08:33:35 +0000
commit131ef00658903420fb08e4666c01d93c3b5fd943 (patch)
treeeb2f1d8fa6e5ac1ada73a97007285417195de349
parente5a51a1ad59cbac83315a9a25c4773ac84eb6819 (diff)
parent7728c95584bb049b64507c458ba47455d4633396 (diff)
Merge pull request #2440 from embassy-rs/remove-git-dep
fix: use released version for stm32wb-hci
-rw-r--r--embassy-stm32-wpan/Cargo.toml7
-rw-r--r--embassy-stm32-wpan/README.md13
-rw-r--r--embassy-stm32-wpan/src/lib.rs2
-rw-r--r--examples/stm32wb/src/bin/eddystone_beacon.rs8
-rw-r--r--examples/stm32wb/src/bin/gatt_server.rs26
-rw-r--r--tests/stm32/src/bin/wpan_ble.rs8
6 files changed, 40 insertions, 24 deletions
diff --git a/embassy-stm32-wpan/Cargo.toml b/embassy-stm32-wpan/Cargo.toml
index 143eea019..4f53a400a 100644
--- a/embassy-stm32-wpan/Cargo.toml
+++ b/embassy-stm32-wpan/Cargo.toml
@@ -3,6 +3,11 @@ name = "embassy-stm32-wpan"
3version = "0.1.0" 3version = "0.1.0"
4edition = "2021" 4edition = "2021"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6description = "Async STM32 WPAN stack for embedded devices in Rust."
7keywords = ["embedded", "async", "stm32", "ble", "wpan"]
8categories = ["embedded", "hardware-support", "no-std", "asynchronous"]
9repository = "https://github.com/embassy-rs/embassy"
10documentation = "https://docs.embassy.dev/embassy-stm32-wpan"
6 11
7[package.metadata.embassy_docs] 12[package.metadata.embassy_docs]
8src_base = "https://github.com/embassy-rs/embassy/blob/embassy-stm32-wpan-v$VERSION/embassy-stm32-wpan/src/" 13src_base = "https://github.com/embassy-rs/embassy/blob/embassy-stm32-wpan-v$VERSION/embassy-stm32-wpan/src/"
@@ -29,7 +34,7 @@ aligned = "0.4.1"
29 34
30bit_field = "0.10.2" 35bit_field = "0.10.2"
31stm32-device-signature = { version = "0.3.3", features = ["stm32wb5x"] } 36stm32-device-signature = { version = "0.3.3", features = ["stm32wb5x"] }
32stm32wb-hci = { git = "https://github.com/Dirbaio/stm32wb-hci", rev = "0aff47e009c30c5fc5d520672625173d75f7505c", optional = true } 37stm32wb-hci = { version = "0.17.0", optional = true }
33futures = { version = "0.3.17", default-features = false, features = ["async-await"] } 38futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
34bitflags = { version = "2.3.3", optional = true } 39bitflags = { version = "2.3.3", optional = true }
35 40
diff --git a/embassy-stm32-wpan/README.md b/embassy-stm32-wpan/README.md
new file mode 100644
index 000000000..b1a2cec55
--- /dev/null
+++ b/embassy-stm32-wpan/README.md
@@ -0,0 +1,13 @@
1# embassy-stm32-wpan
2
3Async WPAN (short range wireless) on STM32WB families.
4
5## Features
6
7- Rust interface to the WPAN stack running on the STM32WB co-processor .
8- Controller trait implementation for the [stm32wb-hci](https://crates.io/crates/stm32wb-hci) crate.
9- Embassy-net driver implementation for 802.15.4 MAC.
10
11## Examples
12
13See the [stm32wb examples](https://github.com/embassy-rs/embassy/tree/main/examples/stm32wb).
diff --git a/embassy-stm32-wpan/src/lib.rs b/embassy-stm32-wpan/src/lib.rs
index a5dbb7420..f9560d235 100644
--- a/embassy-stm32-wpan/src/lib.rs
+++ b/embassy-stm32-wpan/src/lib.rs
@@ -1,5 +1,7 @@
1#![no_std] 1#![no_std]
2#![allow(async_fn_in_trait)] 2#![allow(async_fn_in_trait)]
3#![doc = include_str!("../README.md")]
4// #![warn(missing_docs)]
3 5
4// This must go FIRST so that all the other modules see its macros. 6// This must go FIRST so that all the other modules see its macros.
5mod fmt; 7mod fmt;
diff --git a/examples/stm32wb/src/bin/eddystone_beacon.rs b/examples/stm32wb/src/bin/eddystone_beacon.rs
index cf9a5aa28..d3b3c15ca 100644
--- a/examples/stm32wb/src/bin/eddystone_beacon.rs
+++ b/examples/stm32wb/src/bin/eddystone_beacon.rs
@@ -11,11 +11,9 @@ use embassy_stm32::rcc::WPAN_DEFAULT;
11use embassy_stm32_wpan::hci::host::uart::UartHci; 11use embassy_stm32_wpan::hci::host::uart::UartHci;
12use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; 12use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType};
13use embassy_stm32_wpan::hci::types::AdvertisingType; 13use embassy_stm32_wpan::hci::types::AdvertisingType;
14use embassy_stm32_wpan::hci::vendor::stm32wb::command::gap::{ 14use embassy_stm32_wpan::hci::vendor::command::gap::{AdvertisingDataType, DiscoverableParameters, GapCommands, Role};
15 AdvertisingDataType, DiscoverableParameters, GapCommands, Role, 15use embassy_stm32_wpan::hci::vendor::command::gatt::GattCommands;
16}; 16use embassy_stm32_wpan::hci::vendor::command::hal::{ConfigData, HalCommands, PowerLevel};
17use embassy_stm32_wpan::hci::vendor::stm32wb::command::gatt::GattCommands;
18use embassy_stm32_wpan::hci::vendor::stm32wb::command::hal::{ConfigData, HalCommands, PowerLevel};
19use embassy_stm32_wpan::hci::BdAddr; 17use embassy_stm32_wpan::hci::BdAddr;
20use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; 18use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp;
21use embassy_stm32_wpan::TlMbox; 19use embassy_stm32_wpan::TlMbox;
diff --git a/examples/stm32wb/src/bin/gatt_server.rs b/examples/stm32wb/src/bin/gatt_server.rs
index 5ce620350..3b50d6c31 100644
--- a/examples/stm32wb/src/bin/gatt_server.rs
+++ b/examples/stm32wb/src/bin/gatt_server.rs
@@ -12,17 +12,18 @@ use embassy_stm32_wpan::hci::event::command::{CommandComplete, ReturnParameters}
12use embassy_stm32_wpan::hci::host::uart::{Packet, UartHci}; 12use embassy_stm32_wpan::hci::host::uart::{Packet, UartHci};
13use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; 13use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType};
14use embassy_stm32_wpan::hci::types::AdvertisingType; 14use embassy_stm32_wpan::hci::types::AdvertisingType;
15use embassy_stm32_wpan::hci::vendor::stm32wb::command::gap::{ 15use embassy_stm32_wpan::hci::vendor::command::gap::{
16 AddressType, AuthenticationRequirements, DiscoverableParameters, GapCommands, IoCapability, LocalName, Pin, Role, 16 AddressType, AuthenticationRequirements, DiscoverableParameters, GapCommands, IoCapability, LocalName, Pin, Role,
17 SecureConnectionSupport, 17 SecureConnectionSupport,
18}; 18};
19use embassy_stm32_wpan::hci::vendor::stm32wb::command::gatt::{ 19use embassy_stm32_wpan::hci::vendor::command::gatt::{
20 AddCharacteristicParameters, AddServiceParameters, CharacteristicEvent, CharacteristicPermission, 20 AddCharacteristicParameters, AddServiceParameters, CharacteristicEvent, CharacteristicPermission,
21 CharacteristicProperty, EncryptionKeySize, GattCommands, ServiceType, UpdateCharacteristicValueParameters, Uuid, 21 CharacteristicProperty, EncryptionKeySize, GattCommands, ServiceType, UpdateCharacteristicValueParameters, Uuid,
22 WriteResponseParameters, 22 WriteResponseParameters,
23}; 23};
24use embassy_stm32_wpan::hci::vendor::stm32wb::command::hal::{ConfigData, HalCommands, PowerLevel}; 24use embassy_stm32_wpan::hci::vendor::command::hal::{ConfigData, HalCommands, PowerLevel};
25use embassy_stm32_wpan::hci::vendor::stm32wb::event::{self, AttributeHandle, Stm32Wb5xEvent}; 25use embassy_stm32_wpan::hci::vendor::event::command::VendorReturnParameters;
26use embassy_stm32_wpan::hci::vendor::event::{self, AttributeHandle, VendorEvent};
26use embassy_stm32_wpan::hci::{BdAddr, Event}; 27use embassy_stm32_wpan::hci::{BdAddr, Event};
27use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; 28use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp;
28use embassy_stm32_wpan::sub::ble::Ble; 29use embassy_stm32_wpan::sub::ble::Ble;
@@ -190,11 +191,11 @@ async fn main(_spawner: Spawner) {
190 mbox.ble_subsystem.set_discoverable(&discovery_params).await.unwrap(); 191 mbox.ble_subsystem.set_discoverable(&discovery_params).await.unwrap();
191 } 192 }
192 Event::Vendor(vendor_event) => match vendor_event { 193 Event::Vendor(vendor_event) => match vendor_event {
193 Stm32Wb5xEvent::AttReadPermitRequest(read_req) => { 194 VendorEvent::AttReadPermitRequest(read_req) => {
194 defmt::info!("read request received {}, allowing", read_req); 195 defmt::info!("read request received {}, allowing", read_req);
195 mbox.ble_subsystem.allow_read(read_req.conn_handle).await 196 mbox.ble_subsystem.allow_read(read_req.conn_handle).await
196 } 197 }
197 Stm32Wb5xEvent::AttWritePermitRequest(write_req) => { 198 VendorEvent::AttWritePermitRequest(write_req) => {
198 defmt::info!("write request received {}, allowing", write_req); 199 defmt::info!("write request received {}, allowing", write_req);
199 mbox.ble_subsystem 200 mbox.ble_subsystem
200 .write_response(&WriteResponseParameters { 201 .write_response(&WriteResponseParameters {
@@ -206,7 +207,7 @@ async fn main(_spawner: Spawner) {
206 .await 207 .await
207 .unwrap() 208 .unwrap()
208 } 209 }
209 Stm32Wb5xEvent::GattAttributeModified(attribute) => { 210 VendorEvent::GattAttributeModified(attribute) => {
210 defmt::info!("{}", ble_context); 211 defmt::info!("{}", ble_context);
211 if attribute.attr_handle.0 == ble_context.chars.notify.0 + 2 { 212 if attribute.attr_handle.0 == ble_context.chars.notify.0 + 2 {
212 if attribute.data()[0] == 0x01 { 213 if attribute.data()[0] == 0x01 {
@@ -333,7 +334,7 @@ async fn gatt_add_service(ble_subsystem: &mut Ble, uuid: Uuid) -> Result<Attribu
333 334
334 if let Ok(Packet::Event(Event::CommandComplete(CommandComplete { 335 if let Ok(Packet::Event(Event::CommandComplete(CommandComplete {
335 return_params: 336 return_params:
336 ReturnParameters::Vendor(event::command::ReturnParameters::GattAddService(event::command::GattService { 337 ReturnParameters::Vendor(VendorReturnParameters::GattAddService(event::command::GattService {
337 service_handle, 338 service_handle,
338 .. 339 ..
339 })), 340 })),
@@ -370,11 +371,10 @@ async fn gatt_add_char(
370 371
371 if let Ok(Packet::Event(Event::CommandComplete(CommandComplete { 372 if let Ok(Packet::Event(Event::CommandComplete(CommandComplete {
372 return_params: 373 return_params:
373 ReturnParameters::Vendor(event::command::ReturnParameters::GattAddCharacteristic( 374 ReturnParameters::Vendor(VendorReturnParameters::GattAddCharacteristic(event::command::GattCharacteristic {
374 event::command::GattCharacteristic { 375 characteristic_handle,
375 characteristic_handle, .. 376 ..
376 }, 377 })),
377 )),
378 .. 378 ..
379 }))) = response 379 }))) = response
380 { 380 {
diff --git a/tests/stm32/src/bin/wpan_ble.rs b/tests/stm32/src/bin/wpan_ble.rs
index ff838471b..82a540d45 100644
--- a/tests/stm32/src/bin/wpan_ble.rs
+++ b/tests/stm32/src/bin/wpan_ble.rs
@@ -15,11 +15,9 @@ use embassy_stm32::rcc::WPAN_DEFAULT;
15use embassy_stm32_wpan::hci::host::uart::UartHci; 15use embassy_stm32_wpan::hci::host::uart::UartHci;
16use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; 16use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType};
17use embassy_stm32_wpan::hci::types::AdvertisingType; 17use embassy_stm32_wpan::hci::types::AdvertisingType;
18use embassy_stm32_wpan::hci::vendor::stm32wb::command::gap::{ 18use embassy_stm32_wpan::hci::vendor::command::gap::{AdvertisingDataType, DiscoverableParameters, GapCommands, Role};
19 AdvertisingDataType, DiscoverableParameters, GapCommands, Role, 19use embassy_stm32_wpan::hci::vendor::command::gatt::GattCommands;
20}; 20use embassy_stm32_wpan::hci::vendor::command::hal::{ConfigData, HalCommands, PowerLevel};
21use embassy_stm32_wpan::hci::vendor::stm32wb::command::gatt::GattCommands;
22use embassy_stm32_wpan::hci::vendor::stm32wb::command::hal::{ConfigData, HalCommands, PowerLevel};
23use embassy_stm32_wpan::hci::BdAddr; 21use embassy_stm32_wpan::hci::BdAddr;
24use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; 22use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp;
25use embassy_stm32_wpan::sub::mm; 23use embassy_stm32_wpan::sub::mm;