aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxoviat <[email protected]>2023-06-18 09:43:07 -0500
committerxoviat <[email protected]>2023-06-18 09:43:07 -0500
commit39334f72804ad83c90cde53d328be779af9f1b92 (patch)
treeb9e5491788cfc34f99e92162f6589be7fc910b08
parent7177e7ea1aae2eb6973816a158e714b4fcd5b9a6 (diff)
stm32/wpan: add ble, mac features and cleanup
-rw-r--r--embassy-stm32-wpan/Cargo.toml3
-rw-r--r--embassy-stm32-wpan/src/lib.rs37
-rw-r--r--tests/stm32/Cargo.toml2
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]
28defmt = ["dep:defmt", "embassy-sync/defmt", "embassy-embedded-hal/defmt", "embassy-hal-common/defmt"] 28defmt = ["dep:defmt", "embassy-sync/defmt", "embassy-embedded-hal/defmt", "embassy-hal-common/defmt"]
29 29
30ble = []
31mac = []
32
30stm32wb10cc = [ "embassy-stm32/stm32wb10cc" ] 33stm32wb10cc = [ "embassy-stm32/stm32wb10cc" ]
31stm32wb15cc = [ "embassy-stm32/stm32wb15cc" ] 34stm32wb15cc = [ "embassy-stm32/stm32wb15cc" ]
32stm32wb30ce = [ "embassy-stm32/stm32wb30ce" ] 35stm32wb30ce = [ "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;
10use cmd::CmdPacket; 10use cmd::CmdPacket;
11use embassy_hal_common::{into_ref, Peripheral, PeripheralRef}; 11use embassy_hal_common::{into_ref, Peripheral, PeripheralRef};
12use embassy_stm32::interrupt; 12use embassy_stm32::interrupt;
13use embassy_stm32::interrupt::typelevel::Interrupt;
14use embassy_stm32::ipcc::{Config, Ipcc, ReceiveInterruptHandler, TransmitInterruptHandler}; 13use embassy_stm32::ipcc::{Config, Ipcc, ReceiveInterruptHandler, TransmitInterruptHandler};
15use embassy_stm32::peripherals::IPCC; 14use embassy_stm32::peripherals::IPCC;
16use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
17use embassy_sync::channel::Channel;
18use embassy_sync::signal::Signal;
19use evt::{CcEvt, EvtBox};
20use mm::MemoryManager; 15use mm::MemoryManager;
21use sys::Sys; 16use sys::Sys;
22use tables::{ 17use 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
130static mut HCI_ACL_DATA_BUFFER: MaybeUninit<[u8; TL_PACKET_HEADER_SIZE + 5 + 251]> = MaybeUninit::uninit(); 125static 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
137static EVT_CHANNEL: Channel<CriticalSectionRawMutex, EvtBox, 32> = Channel::new();
138
139#[allow(dead_code)]
140/// last received Command Complete event
141static LAST_CC_EVT: Signal<CriticalSectionRawMutex, CcEvt> = Signal::new();
142
143static STATE: Signal<CriticalSectionRawMutex, ()> = Signal::new();
144
145pub struct TlMbox<'d> { 127pub 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
29embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "tick-hz-32_768", "defmt-timestamp-uptime"] } 29embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "tick-hz-32_768", "defmt-timestamp-uptime"] }
30embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "memory-x", "time-driver-any"] } 30embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "memory-x", "time-driver-any"] }
31embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 31embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
32embassy-stm32-wpan = { version = "0.1.0", path = "../../embassy-stm32-wpan", optional = true, features = ["defmt", "stm32wb55rg"] } 32embassy-stm32-wpan = { version = "0.1.0", path = "../../embassy-stm32-wpan", optional = true, features = ["defmt", "stm32wb55rg", "ble"] }
33 33
34defmt = "0.3.0" 34defmt = "0.3.0"
35defmt-rtt = "0.4" 35defmt-rtt = "0.4"