diff options
Diffstat (limited to 'examples/stm32g4/src/bin/pll.rs')
| -rw-r--r-- | examples/stm32g4/src/bin/pll.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/examples/stm32g4/src/bin/pll.rs b/examples/stm32g4/src/bin/pll.rs new file mode 100644 index 000000000..8cee41e9b --- /dev/null +++ b/examples/stm32g4/src/bin/pll.rs | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | |||
| 5 | use defmt::*; | ||
| 6 | use embassy_executor::Spawner; | ||
| 7 | use embassy_stm32::rcc::{ClockSrc, PllM, PllN, PllR, PllSrc}; | ||
| 8 | use embassy_stm32::Config; | ||
| 9 | use embassy_time::{Duration, Timer}; | ||
| 10 | use {defmt_rtt as _, panic_probe as _}; | ||
| 11 | |||
| 12 | #[embassy_executor::main] | ||
| 13 | async fn main(_spawner: Spawner) { | ||
| 14 | let mut config = Config::default(); | ||
| 15 | |||
| 16 | // Configure PLL to max frequency of 170 MHz | ||
| 17 | config.rcc.mux = ClockSrc::PLLCLK(PllSrc::HSI16, PllM::Div4, PllN::Mul85, PllR::Div2); | ||
| 18 | |||
| 19 | let _p = embassy_stm32::init(config); | ||
| 20 | info!("Hello World!"); | ||
| 21 | |||
| 22 | loop { | ||
| 23 | Timer::after(Duration::from_millis(1000)).await; | ||
| 24 | info!("1s elapsed"); | ||
| 25 | } | ||
| 26 | } | ||
