Merge pull request #2440 from embassy-rs/remove-git-dep

fix: use released version for stm32wb-hci
This commit is contained in:
Ulf Lilleengen 2024-01-12 08:33:35 +00:00 committed by GitHub
commit 131ef00658
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 24 deletions

View file

@ -3,6 +3,11 @@ name = "embassy-stm32-wpan"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
description = "Async STM32 WPAN stack for embedded devices in Rust."
keywords = ["embedded", "async", "stm32", "ble", "wpan"]
categories = ["embedded", "hardware-support", "no-std", "asynchronous"]
repository = "https://github.com/embassy-rs/embassy"
documentation = "https://docs.embassy.dev/embassy-stm32-wpan"
[package.metadata.embassy_docs] [package.metadata.embassy_docs]
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-stm32-wpan-v$VERSION/embassy-stm32-wpan/src/" src_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"
bit_field = "0.10.2" bit_field = "0.10.2"
stm32-device-signature = { version = "0.3.3", features = ["stm32wb5x"] } stm32-device-signature = { version = "0.3.3", features = ["stm32wb5x"] }
stm32wb-hci = { git = "https://github.com/Dirbaio/stm32wb-hci", rev = "0aff47e009c30c5fc5d520672625173d75f7505c", optional = true } stm32wb-hci = { version = "0.17.0", optional = true }
futures = { version = "0.3.17", default-features = false, features = ["async-await"] } futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
bitflags = { version = "2.3.3", optional = true } bitflags = { version = "2.3.3", optional = true }

View file

@ -0,0 +1,13 @@
# embassy-stm32-wpan
Async WPAN (short range wireless) on STM32WB families.
## Features
- Rust interface to the WPAN stack running on the STM32WB co-processor .
- Controller trait implementation for the [stm32wb-hci](https://crates.io/crates/stm32wb-hci) crate.
- Embassy-net driver implementation for 802.15.4 MAC.
## Examples
See the [stm32wb examples](https://github.com/embassy-rs/embassy/tree/main/examples/stm32wb).

View file

@ -1,5 +1,7 @@
#![no_std] #![no_std]
#![allow(async_fn_in_trait)] #![allow(async_fn_in_trait)]
#![doc = include_str!("../README.md")]
// #![warn(missing_docs)]
// This must go FIRST so that all the other modules see its macros. // This must go FIRST so that all the other modules see its macros.
mod fmt; mod fmt;

View file

@ -11,11 +11,9 @@ use embassy_stm32::rcc::WPAN_DEFAULT;
use embassy_stm32_wpan::hci::host::uart::UartHci; use embassy_stm32_wpan::hci::host::uart::UartHci;
use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType};
use embassy_stm32_wpan::hci::types::AdvertisingType; use embassy_stm32_wpan::hci::types::AdvertisingType;
use embassy_stm32_wpan::hci::vendor::stm32wb::command::gap::{ use embassy_stm32_wpan::hci::vendor::command::gap::{AdvertisingDataType, DiscoverableParameters, GapCommands, Role};
AdvertisingDataType, DiscoverableParameters, GapCommands, Role, use embassy_stm32_wpan::hci::vendor::command::gatt::GattCommands;
}; use embassy_stm32_wpan::hci::vendor::command::hal::{ConfigData, HalCommands, PowerLevel};
use embassy_stm32_wpan::hci::vendor::stm32wb::command::gatt::GattCommands;
use embassy_stm32_wpan::hci::vendor::stm32wb::command::hal::{ConfigData, HalCommands, PowerLevel};
use embassy_stm32_wpan::hci::BdAddr; use embassy_stm32_wpan::hci::BdAddr;
use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp;
use embassy_stm32_wpan::TlMbox; use embassy_stm32_wpan::TlMbox;

View file

@ -12,17 +12,18 @@ use embassy_stm32_wpan::hci::event::command::{CommandComplete, ReturnParameters}
use embassy_stm32_wpan::hci::host::uart::{Packet, UartHci}; use embassy_stm32_wpan::hci::host::uart::{Packet, UartHci};
use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType};
use embassy_stm32_wpan::hci::types::AdvertisingType; use embassy_stm32_wpan::hci::types::AdvertisingType;
use embassy_stm32_wpan::hci::vendor::stm32wb::command::gap::{ use embassy_stm32_wpan::hci::vendor::command::gap::{
AddressType, AuthenticationRequirements, DiscoverableParameters, GapCommands, IoCapability, LocalName, Pin, Role, AddressType, AuthenticationRequirements, DiscoverableParameters, GapCommands, IoCapability, LocalName, Pin, Role,
SecureConnectionSupport, SecureConnectionSupport,
}; };
use embassy_stm32_wpan::hci::vendor::stm32wb::command::gatt::{ use embassy_stm32_wpan::hci::vendor::command::gatt::{
AddCharacteristicParameters, AddServiceParameters, CharacteristicEvent, CharacteristicPermission, AddCharacteristicParameters, AddServiceParameters, CharacteristicEvent, CharacteristicPermission,
CharacteristicProperty, EncryptionKeySize, GattCommands, ServiceType, UpdateCharacteristicValueParameters, Uuid, CharacteristicProperty, EncryptionKeySize, GattCommands, ServiceType, UpdateCharacteristicValueParameters, Uuid,
WriteResponseParameters, WriteResponseParameters,
}; };
use embassy_stm32_wpan::hci::vendor::stm32wb::command::hal::{ConfigData, HalCommands, PowerLevel}; use embassy_stm32_wpan::hci::vendor::command::hal::{ConfigData, HalCommands, PowerLevel};
use embassy_stm32_wpan::hci::vendor::stm32wb::event::{self, AttributeHandle, Stm32Wb5xEvent}; use embassy_stm32_wpan::hci::vendor::event::command::VendorReturnParameters;
use embassy_stm32_wpan::hci::vendor::event::{self, AttributeHandle, VendorEvent};
use embassy_stm32_wpan::hci::{BdAddr, Event}; use embassy_stm32_wpan::hci::{BdAddr, Event};
use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp;
use embassy_stm32_wpan::sub::ble::Ble; use embassy_stm32_wpan::sub::ble::Ble;
@ -190,11 +191,11 @@ async fn main(_spawner: Spawner) {
mbox.ble_subsystem.set_discoverable(&discovery_params).await.unwrap(); mbox.ble_subsystem.set_discoverable(&discovery_params).await.unwrap();
} }
Event::Vendor(vendor_event) => match vendor_event { Event::Vendor(vendor_event) => match vendor_event {
Stm32Wb5xEvent::AttReadPermitRequest(read_req) => { VendorEvent::AttReadPermitRequest(read_req) => {
defmt::info!("read request received {}, allowing", read_req); defmt::info!("read request received {}, allowing", read_req);
mbox.ble_subsystem.allow_read(read_req.conn_handle).await mbox.ble_subsystem.allow_read(read_req.conn_handle).await
} }
Stm32Wb5xEvent::AttWritePermitRequest(write_req) => { VendorEvent::AttWritePermitRequest(write_req) => {
defmt::info!("write request received {}, allowing", write_req); defmt::info!("write request received {}, allowing", write_req);
mbox.ble_subsystem mbox.ble_subsystem
.write_response(&WriteResponseParameters { .write_response(&WriteResponseParameters {
@ -206,7 +207,7 @@ async fn main(_spawner: Spawner) {
.await .await
.unwrap() .unwrap()
} }
Stm32Wb5xEvent::GattAttributeModified(attribute) => { VendorEvent::GattAttributeModified(attribute) => {
defmt::info!("{}", ble_context); defmt::info!("{}", ble_context);
if attribute.attr_handle.0 == ble_context.chars.notify.0 + 2 { if attribute.attr_handle.0 == ble_context.chars.notify.0 + 2 {
if attribute.data()[0] == 0x01 { if attribute.data()[0] == 0x01 {
@ -333,7 +334,7 @@ async fn gatt_add_service(ble_subsystem: &mut Ble, uuid: Uuid) -> Result<Attribu
if let Ok(Packet::Event(Event::CommandComplete(CommandComplete { if let Ok(Packet::Event(Event::CommandComplete(CommandComplete {
return_params: return_params:
ReturnParameters::Vendor(event::command::ReturnParameters::GattAddService(event::command::GattService { ReturnParameters::Vendor(VendorReturnParameters::GattAddService(event::command::GattService {
service_handle, service_handle,
.. ..
})), })),
@ -370,11 +371,10 @@ async fn gatt_add_char(
if let Ok(Packet::Event(Event::CommandComplete(CommandComplete { if let Ok(Packet::Event(Event::CommandComplete(CommandComplete {
return_params: return_params:
ReturnParameters::Vendor(event::command::ReturnParameters::GattAddCharacteristic( ReturnParameters::Vendor(VendorReturnParameters::GattAddCharacteristic(event::command::GattCharacteristic {
event::command::GattCharacteristic { characteristic_handle,
characteristic_handle, .. ..
}, })),
)),
.. ..
}))) = response }))) = response
{ {

View file

@ -15,11 +15,9 @@ use embassy_stm32::rcc::WPAN_DEFAULT;
use embassy_stm32_wpan::hci::host::uart::UartHci; use embassy_stm32_wpan::hci::host::uart::UartHci;
use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType};
use embassy_stm32_wpan::hci::types::AdvertisingType; use embassy_stm32_wpan::hci::types::AdvertisingType;
use embassy_stm32_wpan::hci::vendor::stm32wb::command::gap::{ use embassy_stm32_wpan::hci::vendor::command::gap::{AdvertisingDataType, DiscoverableParameters, GapCommands, Role};
AdvertisingDataType, DiscoverableParameters, GapCommands, Role, use embassy_stm32_wpan::hci::vendor::command::gatt::GattCommands;
}; use embassy_stm32_wpan::hci::vendor::command::hal::{ConfigData, HalCommands, PowerLevel};
use embassy_stm32_wpan::hci::vendor::stm32wb::command::gatt::GattCommands;
use embassy_stm32_wpan::hci::vendor::stm32wb::command::hal::{ConfigData, HalCommands, PowerLevel};
use embassy_stm32_wpan::hci::BdAddr; use embassy_stm32_wpan::hci::BdAddr;
use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp;
use embassy_stm32_wpan::sub::mm; use embassy_stm32_wpan::sub::mm;