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,10 +182,7 @@ pub struct Config {
pub apb2_pre: APBPrescaler, pub apb2_pre: APBPrescaler,
} }
impl Default for Config { pub const WPAN_DEFAULT: Config = Config {
#[inline]
fn default() -> Config {
Config {
hse: Some(Hse { hse: Some(Hse {
frequency: mhz(32), frequency: mhz(32),
prediv: HsePrescaler::NotDivided, prediv: HsePrescaler::NotDivided,
@ -211,6 +208,25 @@ impl Default for Config {
ahb3_pre: AHBPrescaler::NotDivided, ahb3_pre: AHBPrescaler::NotDivided,
apb1_pre: APBPrescaler::NotDivided, apb1_pre: APBPrescaler::NotDivided,
apb2_pre: APBPrescaler::NotDivided, apb2_pre: APBPrescaler::NotDivided,
};
impl Default for Config {
#[inline]
fn default() -> Config {
Config {
hse: None,
lse: None,
sys: Sysclk::HSI,
mux: None,
pll48: None,
pll: None,
pllsai: None,
ahb1_pre: AHBPrescaler::NotDivided,
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_executor::Spawner;
use embassy_stm32::bind_interrupts; use embassy_stm32::bind_interrupts;
use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; 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::uart::UartHci;
use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType};
use embassy_stm32_wpan::hci::types::AdvertisingType; use embassy_stm32_wpan::hci::types::AdvertisingType;
@ -40,7 +41,10 @@ async fn run_mm_queue(memory_manager: mm::MemoryManager) {
#[embassy_executor::main] #[embassy_executor::main]
async fn main(spawner: Spawner) { 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!"); info!("Hello World!");
let config = Config::default(); let config = Config::default();

View file

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