diff options
| author | Bob McWhirter <[email protected]> | 2021-08-04 13:39:02 -0400 |
|---|---|---|
| committer | Bob McWhirter <[email protected]> | 2021-08-04 13:39:02 -0400 |
| commit | f4971fbb791e6d58cddf88aa8a39d6fe16c05b4c (patch) | |
| tree | a44e47df15285259d4c691135fdc543ac3105b20 /examples/stm32h7/src/example_common.rs | |
| parent | 4fe9114695ee20e2a4ef62b09fe4b11a1c488655 (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.rs | 11 |
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 _; | |||
| 6 | pub use defmt::*; | 6 | pub use defmt::*; |
| 7 | 7 | ||
| 8 | use core::sync::atomic::{AtomicUsize, Ordering}; | 8 | use core::sync::atomic::{AtomicUsize, Ordering}; |
| 9 | use embassy_stm32::Config; | ||
| 10 | use embassy_stm32::time::U32Ext; | ||
| 9 | 11 | ||
| 10 | defmt::timestamp! {"{=u64}", { | 12 | defmt::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)] | ||
| 22 | pub 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 | } | ||
