aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32h7/src/example_common.rs
diff options
context:
space:
mode:
authorBob McWhirter <[email protected]>2021-08-04 13:39:02 -0400
committerBob McWhirter <[email protected]>2021-08-04 13:39:02 -0400
commitf4971fbb791e6d58cddf88aa8a39d6fe16c05b4c (patch)
treea44e47df15285259d4c691135fdc543ac3105b20 /examples/stm32h7/src/example_common.rs
parent4fe9114695ee20e2a4ef62b09fe4b11a1c488655 (diff)
Further work sharing config for example and removing duplicated code.
Diffstat (limited to 'examples/stm32h7/src/example_common.rs')
-rw-r--r--examples/stm32h7/src/example_common.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/examples/stm32h7/src/example_common.rs b/examples/stm32h7/src/example_common.rs
index 54d633837..25d80f654 100644
--- a/examples/stm32h7/src/example_common.rs
+++ b/examples/stm32h7/src/example_common.rs
@@ -6,6 +6,8 @@ use panic_probe as _;
6pub use defmt::*; 6pub use defmt::*;
7 7
8use core::sync::atomic::{AtomicUsize, Ordering}; 8use core::sync::atomic::{AtomicUsize, Ordering};
9use embassy_stm32::Config;
10use embassy_stm32::time::U32Ext;
9 11
10defmt::timestamp! {"{=u64}", { 12defmt::timestamp! {"{=u64}", {
11 static COUNT: AtomicUsize = AtomicUsize::new(0); 13 static COUNT: AtomicUsize = AtomicUsize::new(0);
@@ -15,3 +17,12 @@ defmt::timestamp! {"{=u64}", {
15 n as u64 17 n as u64
16 } 18 }
17} 19}
20
21#[allow(unused)]
22pub fn config() -> Config {
23 let mut config = Config::default();
24 config.rcc.sys_ck = Some(400.mhz().into());
25 config.rcc.pll1.q_ck = Some(100.mhz().into());
26 config.rcc.enable_dma1 = true;
27 config
28}