aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxoviat <[email protected]>2023-07-24 18:25:15 -0500
committerxoviat <[email protected]>2023-07-24 18:25:15 -0500
commit270d1d59a0b6ab2f180376bb193c2495f14632b8 (patch)
tree7d86147dca6a7669b5cff0fb01a735d57a6117bd
parent1425dda0a76da5da44de4c2fb7d04fc5a02cfc8a (diff)
stm32/rcc: use wpan default only for wpan
-rw-r--r--embassy-stm32/src/rcc/wb.rs52
-rw-r--r--tests/stm32/src/bin/wpan_ble.rs6
-rw-r--r--tests/stm32/src/bin/wpan_mac.rs6
3 files changed, 44 insertions, 20 deletions
diff --git a/embassy-stm32/src/rcc/wb.rs b/embassy-stm32/src/rcc/wb.rs
index 91a11a95d..4322b950a 100644
--- a/embassy-stm32/src/rcc/wb.rs
+++ b/embassy-stm32/src/rcc/wb.rs
@@ -182,32 +182,48 @@ pub struct Config {
182 pub apb2_pre: APBPrescaler, 182 pub apb2_pre: APBPrescaler,
183} 183}
184 184
185pub const WPAN_DEFAULT: Config = Config {
186 hse: Some(Hse {
187 frequency: mhz(32),
188 prediv: HsePrescaler::NotDivided,
189 }),
190 lse: Some(khz(32)),
191 sys: Sysclk::Pll,
192 mux: Some(PllMux {
193 source: PllSource::Hse,
194 prediv: 2,
195 }),
196 pll48: None,
197
198 pll: Some(Pll {
199 mul: 12,
200 divp: Some(3),
201 divq: Some(4),
202 divr: Some(3),
203 }),
204 pllsai: None,
205
206 ahb1_pre: AHBPrescaler::NotDivided,
207 ahb2_pre: AHBPrescaler::Div2,
208 ahb3_pre: AHBPrescaler::NotDivided,
209 apb1_pre: APBPrescaler::NotDivided,
210 apb2_pre: APBPrescaler::NotDivided,
211};
212
185impl Default for Config { 213impl Default for Config {
186 #[inline] 214 #[inline]
187 fn default() -> Config { 215 fn default() -> Config {
188 Config { 216 Config {
189 hse: Some(Hse { 217 hse: None,
190 frequency: mhz(32), 218 lse: None,
191 prediv: HsePrescaler::NotDivided, 219 sys: Sysclk::HSI,
192 }), 220 mux: None,
193 lse: Some(khz(32)),
194 sys: Sysclk::Pll,
195 mux: Some(PllMux {
196 source: PllSource::Hse,
197 prediv: 2,
198 }),
199 pll48: None, 221 pll48: None,
200 222 pll: None,
201 pll: Some(Pll {
202 mul: 12,
203 divp: Some(3),
204 divq: Some(4),
205 divr: Some(3),
206 }),
207 pllsai: None, 223 pllsai: None,
208 224
209 ahb1_pre: AHBPrescaler::NotDivided, 225 ahb1_pre: AHBPrescaler::NotDivided,
210 ahb2_pre: AHBPrescaler::Div2, 226 ahb2_pre: AHBPrescaler::NotDivided,
211 ahb3_pre: AHBPrescaler::NotDivided, 227 ahb3_pre: AHBPrescaler::NotDivided,
212 apb1_pre: APBPrescaler::NotDivided, 228 apb1_pre: APBPrescaler::NotDivided,
213 apb2_pre: APBPrescaler::NotDivided, 229 apb2_pre: APBPrescaler::NotDivided,
diff --git a/tests/stm32/src/bin/wpan_ble.rs b/tests/stm32/src/bin/wpan_ble.rs
index 3ad8aca4e..452da77a4 100644
--- a/tests/stm32/src/bin/wpan_ble.rs
+++ b/tests/stm32/src/bin/wpan_ble.rs
@@ -12,6 +12,7 @@ use common::*;
12use embassy_executor::Spawner; 12use embassy_executor::Spawner;
13use embassy_stm32::bind_interrupts; 13use embassy_stm32::bind_interrupts;
14use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; 14use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler};
15use embassy_stm32::rcc::WPAN_DEFAULT;
15use embassy_stm32_wpan::hci::host::uart::UartHci; 16use embassy_stm32_wpan::hci::host::uart::UartHci;
16use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; 17use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType};
17use embassy_stm32_wpan::hci::types::AdvertisingType; 18use embassy_stm32_wpan::hci::types::AdvertisingType;
@@ -40,7 +41,10 @@ async fn run_mm_queue(memory_manager: mm::MemoryManager) {
40 41
41#[embassy_executor::main] 42#[embassy_executor::main]
42async fn main(spawner: Spawner) { 43async fn main(spawner: Spawner) {
43 let p = embassy_stm32::init(config()); 44 let mut config = config();
45 config.rcc = WPAN_DEFAULT;
46
47 let p = embassy_stm32::init(config);
44 info!("Hello World!"); 48 info!("Hello World!");
45 49
46 let config = Config::default(); 50 let config = Config::default();
diff --git a/tests/stm32/src/bin/wpan_mac.rs b/tests/stm32/src/bin/wpan_mac.rs
index b04a19ee9..7eab2fd38 100644
--- a/tests/stm32/src/bin/wpan_mac.rs
+++ b/tests/stm32/src/bin/wpan_mac.rs
@@ -10,6 +10,7 @@ use common::*;
10use embassy_executor::Spawner; 10use embassy_executor::Spawner;
11use embassy_stm32::bind_interrupts; 11use embassy_stm32::bind_interrupts;
12use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; 12use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler};
13use embassy_stm32::rcc::WPAN_DEFAULT;
13use embassy_stm32_wpan::mac::commands::{AssociateRequest, GetRequest, ResetRequest, SetRequest}; 14use embassy_stm32_wpan::mac::commands::{AssociateRequest, GetRequest, ResetRequest, SetRequest};
14use embassy_stm32_wpan::mac::event::MacEvent; 15use embassy_stm32_wpan::mac::event::MacEvent;
15use embassy_stm32_wpan::mac::typedefs::{ 16use embassy_stm32_wpan::mac::typedefs::{
@@ -31,7 +32,10 @@ async fn run_mm_queue(memory_manager: mm::MemoryManager) {
31 32
32#[embassy_executor::main] 33#[embassy_executor::main]
33async fn main(spawner: Spawner) { 34async fn main(spawner: Spawner) {
34 let p = embassy_stm32::init(config()); 35 let mut config = config();
36 config.rcc = WPAN_DEFAULT;
37
38 let p = embassy_stm32::init(config);
35 info!("Hello World!"); 39 info!("Hello World!");
36 40
37 let config = Config::default(); 41 let config = Config::default();