stm32/wpan: add ble, mac features and cleanup
This commit is contained in:
parent
7177e7ea1a
commit
39334f7280
@ -27,6 +27,9 @@ bit_field = "0.10.2"
|
|||||||
[features]
|
[features]
|
||||||
defmt = ["dep:defmt", "embassy-sync/defmt", "embassy-embedded-hal/defmt", "embassy-hal-common/defmt"]
|
defmt = ["dep:defmt", "embassy-sync/defmt", "embassy-embedded-hal/defmt", "embassy-hal-common/defmt"]
|
||||||
|
|
||||||
|
ble = []
|
||||||
|
mac = []
|
||||||
|
|
||||||
stm32wb10cc = [ "embassy-stm32/stm32wb10cc" ]
|
stm32wb10cc = [ "embassy-stm32/stm32wb10cc" ]
|
||||||
stm32wb15cc = [ "embassy-stm32/stm32wb15cc" ]
|
stm32wb15cc = [ "embassy-stm32/stm32wb15cc" ]
|
||||||
stm32wb30ce = [ "embassy-stm32/stm32wb30ce" ]
|
stm32wb30ce = [ "embassy-stm32/stm32wb30ce" ]
|
||||||
|
@ -10,13 +10,8 @@ use ble::Ble;
|
|||||||
use cmd::CmdPacket;
|
use cmd::CmdPacket;
|
||||||
use embassy_hal_common::{into_ref, Peripheral, PeripheralRef};
|
use embassy_hal_common::{into_ref, Peripheral, PeripheralRef};
|
||||||
use embassy_stm32::interrupt;
|
use embassy_stm32::interrupt;
|
||||||
use embassy_stm32::interrupt::typelevel::Interrupt;
|
|
||||||
use embassy_stm32::ipcc::{Config, Ipcc, ReceiveInterruptHandler, TransmitInterruptHandler};
|
use embassy_stm32::ipcc::{Config, Ipcc, ReceiveInterruptHandler, TransmitInterruptHandler};
|
||||||
use embassy_stm32::peripherals::IPCC;
|
use embassy_stm32::peripherals::IPCC;
|
||||||
use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
|
|
||||||
use embassy_sync::channel::Channel;
|
|
||||||
use embassy_sync::signal::Signal;
|
|
||||||
use evt::{CcEvt, EvtBox};
|
|
||||||
use mm::MemoryManager;
|
use mm::MemoryManager;
|
||||||
use sys::Sys;
|
use sys::Sys;
|
||||||
use tables::{
|
use tables::{
|
||||||
@ -129,19 +124,6 @@ static mut BLE_CMD_BUFFER: MaybeUninit<CmdPacket> = MaybeUninit::uninit();
|
|||||||
// fuck these "magic" numbers from ST ---v---v
|
// fuck these "magic" numbers from ST ---v---v
|
||||||
static mut HCI_ACL_DATA_BUFFER: MaybeUninit<[u8; TL_PACKET_HEADER_SIZE + 5 + 251]> = MaybeUninit::uninit();
|
static mut HCI_ACL_DATA_BUFFER: MaybeUninit<[u8; TL_PACKET_HEADER_SIZE + 5 + 251]> = MaybeUninit::uninit();
|
||||||
|
|
||||||
// TODO: remove these items
|
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
/// current event that is produced during IPCC IRQ handler execution
|
|
||||||
/// on SYS channel
|
|
||||||
static EVT_CHANNEL: Channel<CriticalSectionRawMutex, EvtBox, 32> = Channel::new();
|
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
/// last received Command Complete event
|
|
||||||
static LAST_CC_EVT: Signal<CriticalSectionRawMutex, CcEvt> = Signal::new();
|
|
||||||
|
|
||||||
static STATE: Signal<CriticalSectionRawMutex, ()> = Signal::new();
|
|
||||||
|
|
||||||
pub struct TlMbox<'d> {
|
pub struct TlMbox<'d> {
|
||||||
_ipcc: PeripheralRef<'d, IPCC>,
|
_ipcc: PeripheralRef<'d, IPCC>,
|
||||||
|
|
||||||
@ -232,24 +214,11 @@ impl<'d> TlMbox<'d> {
|
|||||||
|
|
||||||
Ipcc::enable(config);
|
Ipcc::enable(config);
|
||||||
|
|
||||||
let sys = sys::Sys::new();
|
|
||||||
let ble = ble::Ble::new();
|
|
||||||
let mm = mm::MemoryManager::new();
|
|
||||||
|
|
||||||
// enable interrupts
|
|
||||||
interrupt::typelevel::IPCC_C1_RX::unpend();
|
|
||||||
interrupt::typelevel::IPCC_C1_TX::unpend();
|
|
||||||
|
|
||||||
unsafe { interrupt::typelevel::IPCC_C1_RX::enable() };
|
|
||||||
unsafe { interrupt::typelevel::IPCC_C1_TX::enable() };
|
|
||||||
|
|
||||||
STATE.reset();
|
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
_ipcc: ipcc,
|
_ipcc: ipcc,
|
||||||
sys_subsystem: sys,
|
sys_subsystem: sys::Sys::new(),
|
||||||
ble_subsystem: ble,
|
ble_subsystem: ble::Ble::new(),
|
||||||
mm_subsystem: mm,
|
mm_subsystem: mm::MemoryManager::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ embassy-executor = { version = "0.2.0", path = "../../embassy-executor", feature
|
|||||||
embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "tick-hz-32_768", "defmt-timestamp-uptime"] }
|
embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "tick-hz-32_768", "defmt-timestamp-uptime"] }
|
||||||
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "memory-x", "time-driver-any"] }
|
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "memory-x", "time-driver-any"] }
|
||||||
embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
|
embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
|
||||||
embassy-stm32-wpan = { version = "0.1.0", path = "../../embassy-stm32-wpan", optional = true, features = ["defmt", "stm32wb55rg"] }
|
embassy-stm32-wpan = { version = "0.1.0", path = "../../embassy-stm32-wpan", optional = true, features = ["defmt", "stm32wb55rg", "ble"] }
|
||||||
|
|
||||||
defmt = "0.3.0"
|
defmt = "0.3.0"
|
||||||
defmt-rtt = "0.4"
|
defmt-rtt = "0.4"
|
||||||
|
Loading…
Reference in New Issue
Block a user