diff options
| author | xoviat <[email protected]> | 2023-06-18 09:43:07 -0500 |
|---|---|---|
| committer | xoviat <[email protected]> | 2023-06-18 09:43:07 -0500 |
| commit | 39334f72804ad83c90cde53d328be779af9f1b92 (patch) | |
| tree | b9e5491788cfc34f99e92162f6589be7fc910b08 | |
| parent | 7177e7ea1aae2eb6973816a158e714b4fcd5b9a6 (diff) | |
stm32/wpan: add ble, mac features and cleanup
| -rw-r--r-- | embassy-stm32-wpan/Cargo.toml | 3 | ||||
| -rw-r--r-- | embassy-stm32-wpan/src/lib.rs | 37 | ||||
| -rw-r--r-- | tests/stm32/Cargo.toml | 2 |
3 files changed, 7 insertions, 35 deletions
diff --git a/embassy-stm32-wpan/Cargo.toml b/embassy-stm32-wpan/Cargo.toml index 1c1b57b36..f9023ed79 100644 --- a/embassy-stm32-wpan/Cargo.toml +++ b/embassy-stm32-wpan/Cargo.toml | |||
| @@ -27,6 +27,9 @@ bit_field = "0.10.2" | |||
| 27 | [features] | 27 | [features] |
| 28 | defmt = ["dep:defmt", "embassy-sync/defmt", "embassy-embedded-hal/defmt", "embassy-hal-common/defmt"] | 28 | defmt = ["dep:defmt", "embassy-sync/defmt", "embassy-embedded-hal/defmt", "embassy-hal-common/defmt"] |
| 29 | 29 | ||
| 30 | ble = [] | ||
| 31 | mac = [] | ||
| 32 | |||
| 30 | stm32wb10cc = [ "embassy-stm32/stm32wb10cc" ] | 33 | stm32wb10cc = [ "embassy-stm32/stm32wb10cc" ] |
| 31 | stm32wb15cc = [ "embassy-stm32/stm32wb15cc" ] | 34 | stm32wb15cc = [ "embassy-stm32/stm32wb15cc" ] |
| 32 | stm32wb30ce = [ "embassy-stm32/stm32wb30ce" ] | 35 | stm32wb30ce = [ "embassy-stm32/stm32wb30ce" ] |
diff --git a/embassy-stm32-wpan/src/lib.rs b/embassy-stm32-wpan/src/lib.rs index 833db0df3..035b130c8 100644 --- a/embassy-stm32-wpan/src/lib.rs +++ b/embassy-stm32-wpan/src/lib.rs | |||
| @@ -10,13 +10,8 @@ use ble::Ble; | |||
| 10 | use cmd::CmdPacket; | 10 | use cmd::CmdPacket; |
| 11 | use embassy_hal_common::{into_ref, Peripheral, PeripheralRef}; | 11 | use embassy_hal_common::{into_ref, Peripheral, PeripheralRef}; |
| 12 | use embassy_stm32::interrupt; | 12 | use embassy_stm32::interrupt; |
| 13 | use embassy_stm32::interrupt::typelevel::Interrupt; | ||
| 14 | use embassy_stm32::ipcc::{Config, Ipcc, ReceiveInterruptHandler, TransmitInterruptHandler}; | 13 | use embassy_stm32::ipcc::{Config, Ipcc, ReceiveInterruptHandler, TransmitInterruptHandler}; |
| 15 | use embassy_stm32::peripherals::IPCC; | 14 | use embassy_stm32::peripherals::IPCC; |
| 16 | use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; | ||
| 17 | use embassy_sync::channel::Channel; | ||
| 18 | use embassy_sync::signal::Signal; | ||
| 19 | use evt::{CcEvt, EvtBox}; | ||
| 20 | use mm::MemoryManager; | 15 | use mm::MemoryManager; |
| 21 | use sys::Sys; | 16 | use sys::Sys; |
| 22 | use tables::{ | 17 | use tables::{ |
| @@ -129,19 +124,6 @@ static mut BLE_CMD_BUFFER: MaybeUninit<CmdPacket> = MaybeUninit::uninit(); | |||
| 129 | // fuck these "magic" numbers from ST ---v---v | 124 | // fuck these "magic" numbers from ST ---v---v |
| 130 | static mut HCI_ACL_DATA_BUFFER: MaybeUninit<[u8; TL_PACKET_HEADER_SIZE + 5 + 251]> = MaybeUninit::uninit(); | 125 | static mut HCI_ACL_DATA_BUFFER: MaybeUninit<[u8; TL_PACKET_HEADER_SIZE + 5 + 251]> = MaybeUninit::uninit(); |
| 131 | 126 | ||
| 132 | // TODO: remove these items | ||
| 133 | |||
| 134 | #[allow(dead_code)] | ||
| 135 | /// current event that is produced during IPCC IRQ handler execution | ||
| 136 | /// on SYS channel | ||
| 137 | static EVT_CHANNEL: Channel<CriticalSectionRawMutex, EvtBox, 32> = Channel::new(); | ||
| 138 | |||
| 139 | #[allow(dead_code)] | ||
| 140 | /// last received Command Complete event | ||
| 141 | static LAST_CC_EVT: Signal<CriticalSectionRawMutex, CcEvt> = Signal::new(); | ||
| 142 | |||
| 143 | static STATE: Signal<CriticalSectionRawMutex, ()> = Signal::new(); | ||
| 144 | |||
| 145 | pub struct TlMbox<'d> { | 127 | pub struct TlMbox<'d> { |
| 146 | _ipcc: PeripheralRef<'d, IPCC>, | 128 | _ipcc: PeripheralRef<'d, IPCC>, |
| 147 | 129 | ||
| @@ -232,24 +214,11 @@ impl<'d> TlMbox<'d> { | |||
| 232 | 214 | ||
| 233 | Ipcc::enable(config); | 215 | Ipcc::enable(config); |
| 234 | 216 | ||
| 235 | let sys = sys::Sys::new(); | ||
| 236 | let ble = ble::Ble::new(); | ||
| 237 | let mm = mm::MemoryManager::new(); | ||
| 238 | |||
| 239 | // enable interrupts | ||
| 240 | interrupt::typelevel::IPCC_C1_RX::unpend(); | ||
| 241 | interrupt::typelevel::IPCC_C1_TX::unpend(); | ||
| 242 | |||
| 243 | unsafe { interrupt::typelevel::IPCC_C1_RX::enable() }; | ||
| 244 | unsafe { interrupt::typelevel::IPCC_C1_TX::enable() }; | ||
| 245 | |||
| 246 | STATE.reset(); | ||
| 247 | |||
| 248 | Self { | 217 | Self { |
| 249 | _ipcc: ipcc, | 218 | _ipcc: ipcc, |
| 250 | sys_subsystem: sys, | 219 | sys_subsystem: sys::Sys::new(), |
| 251 | ble_subsystem: ble, | 220 | ble_subsystem: ble::Ble::new(), |
| 252 | mm_subsystem: mm, | 221 | mm_subsystem: mm::MemoryManager::new(), |
| 253 | } | 222 | } |
| 254 | } | 223 | } |
| 255 | } | 224 | } |
diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml index 487ef4626..539ee265f 100644 --- a/tests/stm32/Cargo.toml +++ b/tests/stm32/Cargo.toml | |||
| @@ -29,7 +29,7 @@ embassy-executor = { version = "0.2.0", path = "../../embassy-executor", feature | |||
| 29 | embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "tick-hz-32_768", "defmt-timestamp-uptime"] } | 29 | embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "tick-hz-32_768", "defmt-timestamp-uptime"] } |
| 30 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "memory-x", "time-driver-any"] } | 30 | embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "memory-x", "time-driver-any"] } |
| 31 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } | 31 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } |
| 32 | embassy-stm32-wpan = { version = "0.1.0", path = "../../embassy-stm32-wpan", optional = true, features = ["defmt", "stm32wb55rg"] } | 32 | embassy-stm32-wpan = { version = "0.1.0", path = "../../embassy-stm32-wpan", optional = true, features = ["defmt", "stm32wb55rg", "ble"] } |
| 33 | 33 | ||
| 34 | defmt = "0.3.0" | 34 | defmt = "0.3.0" |
| 35 | defmt-rtt = "0.4" | 35 | defmt-rtt = "0.4" |
