fix build
This commit is contained in:
parent
cf83f6820c
commit
a1b27783a6
@ -5,13 +5,12 @@ edition = "2021"
|
|||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32", features = ["stm32wb55rg"] }
|
embassy-stm32 = { version = "0.1.0", path = "../embassy-stm32" }
|
||||||
embassy-sync = { version = "0.2.0", path = "../embassy-sync" }
|
embassy-sync = { version = "0.2.0", path = "../embassy-sync" }
|
||||||
embassy-time = { version = "0.1.0", path = "../embassy-time", optional = true }
|
embassy-time = { version = "0.1.0", path = "../embassy-time", optional = true }
|
||||||
embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
|
embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
|
||||||
embassy-cortex-m = { version = "0.1.0", path = "../embassy-cortex-m", features = ["prio-bits-4"]}
|
embassy-hal-common = { version = "0.1.0", path = "../embassy-hal-common" }
|
||||||
embassy-hal-common = {version = "0.1.0", path = "../embassy-hal-common" }
|
embassy-embedded-hal = { version = "0.1.0", path = "../embassy-embedded-hal" }
|
||||||
embassy-embedded-hal = {version = "0.1.0", path = "../embassy-embedded-hal" }
|
|
||||||
|
|
||||||
defmt = { version = "0.3", optional = true }
|
defmt = { version = "0.3", optional = true }
|
||||||
cortex-m = "0.7.6"
|
cortex-m = "0.7.6"
|
||||||
@ -21,3 +20,20 @@ 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"]
|
||||||
|
|
||||||
|
stm32wb10cc = [ "embassy-stm32/stm32wb10cc" ]
|
||||||
|
stm32wb15cc = [ "embassy-stm32/stm32wb15cc" ]
|
||||||
|
stm32wb30ce = [ "embassy-stm32/stm32wb30ce" ]
|
||||||
|
stm32wb35cc = [ "embassy-stm32/stm32wb35cc" ]
|
||||||
|
stm32wb35ce = [ "embassy-stm32/stm32wb35ce" ]
|
||||||
|
stm32wb50cg = [ "embassy-stm32/stm32wb50cg" ]
|
||||||
|
stm32wb55cc = [ "embassy-stm32/stm32wb55cc" ]
|
||||||
|
stm32wb55ce = [ "embassy-stm32/stm32wb55ce" ]
|
||||||
|
stm32wb55cg = [ "embassy-stm32/stm32wb55cg" ]
|
||||||
|
stm32wb55rc = [ "embassy-stm32/stm32wb55rc" ]
|
||||||
|
stm32wb55re = [ "embassy-stm32/stm32wb55re" ]
|
||||||
|
stm32wb55rg = [ "embassy-stm32/stm32wb55rg" ]
|
||||||
|
stm32wb55vc = [ "embassy-stm32/stm32wb55vc" ]
|
||||||
|
stm32wb55ve = [ "embassy-stm32/stm32wb55ve" ]
|
||||||
|
stm32wb55vg = [ "embassy-stm32/stm32wb55vg" ]
|
||||||
|
stm32wb55vy = [ "embassy-stm32/stm32wb55vy" ]
|
34
embassy-stm32-wpan/build.rs
Normal file
34
embassy-stm32-wpan/build.rs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
use std::env;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
match env::vars()
|
||||||
|
.map(|(a, _)| a)
|
||||||
|
.filter(|x| x.starts_with("CARGO_FEATURE_STM32"))
|
||||||
|
.get_one()
|
||||||
|
{
|
||||||
|
Ok(_) => {}
|
||||||
|
Err(GetOneError::None) => panic!("No stm32xx Cargo feature enabled"),
|
||||||
|
Err(GetOneError::Multiple) => panic!("Multiple stm32xx Cargo features enabled"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GetOneError {
|
||||||
|
None,
|
||||||
|
Multiple,
|
||||||
|
}
|
||||||
|
|
||||||
|
trait IteratorExt: Iterator {
|
||||||
|
fn get_one(self) -> Result<Self::Item, GetOneError>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: Iterator> IteratorExt for T {
|
||||||
|
fn get_one(mut self) -> Result<Self::Item, GetOneError> {
|
||||||
|
match self.next() {
|
||||||
|
None => Err(GetOneError::None),
|
||||||
|
Some(res) => match self.next() {
|
||||||
|
Some(_) => Err(GetOneError::Multiple),
|
||||||
|
None => Ok(res),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -6,10 +6,10 @@ pub mod fmt;
|
|||||||
use core::mem::MaybeUninit;
|
use core::mem::MaybeUninit;
|
||||||
|
|
||||||
use cmd::CmdPacket;
|
use cmd::CmdPacket;
|
||||||
use embassy_cortex_m::interrupt::Interrupt;
|
|
||||||
use embassy_futures::block_on;
|
use embassy_futures::block_on;
|
||||||
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};
|
use embassy_stm32::ipcc::{Config, Ipcc};
|
||||||
use embassy_stm32::peripherals::IPCC;
|
use embassy_stm32::peripherals::IPCC;
|
||||||
use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
|
use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
|
||||||
@ -37,7 +37,7 @@ pub mod unsafe_linked_list;
|
|||||||
/// Interrupt handler.
|
/// Interrupt handler.
|
||||||
pub struct ReceiveInterruptHandler {}
|
pub struct ReceiveInterruptHandler {}
|
||||||
|
|
||||||
impl interrupt::Handler<interrupt::IPCC_C1_RX> for ReceiveInterruptHandler {
|
impl interrupt::typelevel::Handler<interrupt::typelevel::IPCC_C1_RX> for ReceiveInterruptHandler {
|
||||||
unsafe fn on_interrupt() {
|
unsafe fn on_interrupt() {
|
||||||
if Ipcc::is_rx_pending(channels::cpu2::IPCC_SYSTEM_EVENT_CHANNEL) {
|
if Ipcc::is_rx_pending(channels::cpu2::IPCC_SYSTEM_EVENT_CHANNEL) {
|
||||||
debug!("RX SYS evt");
|
debug!("RX SYS evt");
|
||||||
@ -53,7 +53,7 @@ impl interrupt::Handler<interrupt::IPCC_C1_RX> for ReceiveInterruptHandler {
|
|||||||
|
|
||||||
pub struct TransmitInterruptHandler {}
|
pub struct TransmitInterruptHandler {}
|
||||||
|
|
||||||
impl interrupt::Handler<interrupt::IPCC_C1_TX> for TransmitInterruptHandler {
|
impl interrupt::typelevel::Handler<interrupt::typelevel::IPCC_C1_TX> for TransmitInterruptHandler {
|
||||||
unsafe fn on_interrupt() {
|
unsafe fn on_interrupt() {
|
||||||
if Ipcc::is_tx_pending(channels::cpu1::IPCC_SYSTEM_CMD_RSP_CHANNEL) {
|
if Ipcc::is_tx_pending(channels::cpu1::IPCC_SYSTEM_CMD_RSP_CHANNEL) {
|
||||||
debug!("TX SYS cmd rsp");
|
debug!("TX SYS cmd rsp");
|
||||||
@ -182,8 +182,8 @@ pub struct TlMbox<'d> {
|
|||||||
impl<'d> TlMbox<'d> {
|
impl<'d> TlMbox<'d> {
|
||||||
pub fn init(
|
pub fn init(
|
||||||
ipcc: impl Peripheral<P = IPCC> + 'd,
|
ipcc: impl Peripheral<P = IPCC> + 'd,
|
||||||
_irqs: impl interrupt::Binding<interrupt::IPCC_C1_RX, ReceiveInterruptHandler>
|
_irqs: impl interrupt::typelevel::Binding<interrupt::typelevel::IPCC_C1_RX, ReceiveInterruptHandler>
|
||||||
+ interrupt::Binding<interrupt::IPCC_C1_TX, TransmitInterruptHandler>,
|
+ interrupt::typelevel::Binding<interrupt::typelevel::IPCC_C1_TX, TransmitInterruptHandler>,
|
||||||
config: Config,
|
config: Config,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
into_ref!(ipcc);
|
into_ref!(ipcc);
|
||||||
@ -223,11 +223,11 @@ impl<'d> TlMbox<'d> {
|
|||||||
mm::MemoryManager::enable();
|
mm::MemoryManager::enable();
|
||||||
|
|
||||||
// enable interrupts
|
// enable interrupts
|
||||||
interrupt::IPCC_C1_RX::unpend();
|
interrupt::typelevel::IPCC_C1_RX::unpend();
|
||||||
interrupt::IPCC_C1_TX::unpend();
|
interrupt::typelevel::IPCC_C1_TX::unpend();
|
||||||
|
|
||||||
unsafe { interrupt::IPCC_C1_RX::enable() };
|
unsafe { interrupt::typelevel::IPCC_C1_RX::enable() };
|
||||||
unsafe { interrupt::IPCC_C1_TX::enable() };
|
unsafe { interrupt::typelevel::IPCC_C1_TX::enable() };
|
||||||
|
|
||||||
STATE.reset();
|
STATE.reset();
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ embassy-sync = { version = "0.2.0", path = "../../embassy-sync", features = ["de
|
|||||||
embassy-executor = { version = "0.2.0", path = "../../embassy-executor", features = ["nightly", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
|
embassy-executor = { version = "0.2.0", path = "../../embassy-executor", features = ["nightly", "arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
|
||||||
embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
|
embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
|
||||||
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32wb55rg", "time-driver-any", "memory-x", "exti"] }
|
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32wb55rg", "time-driver-any", "memory-x", "exti"] }
|
||||||
|
embassy-stm32-wpan = { version = "0.1.0", path = "../../embassy-stm32-wpan", features = ["defmt"] }
|
||||||
|
|
||||||
defmt = "0.3"
|
defmt = "0.3"
|
||||||
defmt-rtt = "0.4"
|
defmt-rtt = "0.4"
|
||||||
|
@ -8,13 +8,14 @@ mod common;
|
|||||||
|
|
||||||
use common::*;
|
use common::*;
|
||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_stm32::tl_mbox::{Config, TlMbox};
|
use embassy_stm32::bind_interrupts;
|
||||||
use embassy_stm32::{bind_interrupts, tl_mbox};
|
use embassy_stm32::ipcc::Config;
|
||||||
|
use embassy_stm32_wpan::TlMbox;
|
||||||
use embassy_time::{Duration, Timer};
|
use embassy_time::{Duration, Timer};
|
||||||
|
|
||||||
bind_interrupts!(struct Irqs{
|
bind_interrupts!(struct Irqs{
|
||||||
IPCC_C1_RX => tl_mbox::ReceiveInterruptHandler;
|
IPCC_C1_RX => embassy_stm32_wpan::ReceiveInterruptHandler;
|
||||||
IPCC_C1_TX => tl_mbox::TransmitInterruptHandler;
|
IPCC_C1_TX => embassy_stm32_wpan::TransmitInterruptHandler;
|
||||||
});
|
});
|
||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
@ -23,7 +24,7 @@ async fn main(_spawner: Spawner) {
|
|||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let mbox = TlMbox::new(p.IPCC, Irqs, config);
|
let mbox = TlMbox::init(p.IPCC, Irqs, config);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let wireless_fw_info = mbox.wireless_fw_info();
|
let wireless_fw_info = mbox.wireless_fw_info();
|
||||||
|
Loading…
Reference in New Issue
Block a user