stm32/rcc: use wpan default only for wpan

This commit is contained in:
xoviat 2023-07-24 18:25:15 -05:00
parent 1425dda0a7
commit 270d1d59a0
3 changed files with 44 additions and 20 deletions

View file

@ -182,32 +182,48 @@ pub struct Config {
pub apb2_pre: APBPrescaler,
}
pub const WPAN_DEFAULT: Config = Config {
hse: Some(Hse {
frequency: mhz(32),
prediv: HsePrescaler::NotDivided,
}),
lse: Some(khz(32)),
sys: Sysclk::Pll,
mux: Some(PllMux {
source: PllSource::Hse,
prediv: 2,
}),
pll48: None,
pll: Some(Pll {
mul: 12,
divp: Some(3),
divq: Some(4),
divr: Some(3),
}),
pllsai: None,
ahb1_pre: AHBPrescaler::NotDivided,
ahb2_pre: AHBPrescaler::Div2,
ahb3_pre: AHBPrescaler::NotDivided,
apb1_pre: APBPrescaler::NotDivided,
apb2_pre: APBPrescaler::NotDivided,
};
impl Default for Config {
#[inline]
fn default() -> Config {
Config {
hse: Some(Hse {
frequency: mhz(32),
prediv: HsePrescaler::NotDivided,
}),
lse: Some(khz(32)),
sys: Sysclk::Pll,
mux: Some(PllMux {
source: PllSource::Hse,
prediv: 2,
}),
hse: None,
lse: None,
sys: Sysclk::HSI,
mux: None,
pll48: None,
pll: Some(Pll {
mul: 12,
divp: Some(3),
divq: Some(4),
divr: Some(3),
}),
pll: None,
pllsai: None,
ahb1_pre: AHBPrescaler::NotDivided,
ahb2_pre: AHBPrescaler::Div2,
ahb2_pre: AHBPrescaler::NotDivided,
ahb3_pre: AHBPrescaler::NotDivided,
apb1_pre: APBPrescaler::NotDivided,
apb2_pre: APBPrescaler::NotDivided,

View file

@ -12,6 +12,7 @@ use common::*;
use embassy_executor::Spawner;
use embassy_stm32::bind_interrupts;
use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler};
use embassy_stm32::rcc::WPAN_DEFAULT;
use embassy_stm32_wpan::hci::host::uart::UartHci;
use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType};
use embassy_stm32_wpan::hci::types::AdvertisingType;
@ -40,7 +41,10 @@ async fn run_mm_queue(memory_manager: mm::MemoryManager) {
#[embassy_executor::main]
async fn main(spawner: Spawner) {
let p = embassy_stm32::init(config());
let mut config = config();
config.rcc = WPAN_DEFAULT;
let p = embassy_stm32::init(config);
info!("Hello World!");
let config = Config::default();

View file

@ -10,6 +10,7 @@ use common::*;
use embassy_executor::Spawner;
use embassy_stm32::bind_interrupts;
use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler};
use embassy_stm32::rcc::WPAN_DEFAULT;
use embassy_stm32_wpan::mac::commands::{AssociateRequest, GetRequest, ResetRequest, SetRequest};
use embassy_stm32_wpan::mac::event::MacEvent;
use embassy_stm32_wpan::mac::typedefs::{
@ -31,7 +32,10 @@ async fn run_mm_queue(memory_manager: mm::MemoryManager) {
#[embassy_executor::main]
async fn main(spawner: Spawner) {
let p = embassy_stm32::init(config());
let mut config = config();
config.rcc = WPAN_DEFAULT;
let p = embassy_stm32::init(config);
info!("Hello World!");
let config = Config::default();