aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32g4/src/bin/adc.rs
diff options
context:
space:
mode:
authorBarnaby Walters <[email protected]>2024-02-15 23:56:26 +0100
committerBarnaby Walters <[email protected]>2024-02-15 23:56:26 +0100
commit5b7eff65417e491fa7908dfd8b62013efb55d30b (patch)
treedb30781f8c7fc217578ed288c0594c1f23ff6354 /examples/stm32g4/src/bin/adc.rs
parente8c998aad882d766988ac2c0cb0c357c600b28c1 (diff)
[embassy-stm32]: started stm32g4 RCC refactor
* Copied API from f.rs where applicable * HSE and HSI independantly configurable * Boost mode set by user rather * Added HSE, pll1_q and pll1_p frequencies to set_clocks call * Stubbed max module based on f.rs, needs cleanup
Diffstat (limited to 'examples/stm32g4/src/bin/adc.rs')
-rw-r--r--examples/stm32g4/src/bin/adc.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/examples/stm32g4/src/bin/adc.rs b/examples/stm32g4/src/bin/adc.rs
index 35324d931..99e3ef63b 100644
--- a/examples/stm32g4/src/bin/adc.rs
+++ b/examples/stm32g4/src/bin/adc.rs
@@ -4,7 +4,7 @@
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::adc::{Adc, SampleTime}; 6use embassy_stm32::adc::{Adc, SampleTime};
7use embassy_stm32::rcc::{AdcClockSource, ClockSrc, Pll, PllM, PllN, PllR, PllSource}; 7use embassy_stm32::rcc::{AdcClockSource, Pll, PllMul, PllPreDiv, PllRDiv, Pllsrc, Sysclk};
8use embassy_stm32::Config; 8use embassy_stm32::Config;
9use embassy_time::{Delay, Timer}; 9use embassy_time::{Delay, Timer};
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
@@ -14,17 +14,17 @@ async fn main(_spawner: Spawner) {
14 let mut config = Config::default(); 14 let mut config = Config::default();
15 15
16 config.rcc.pll = Some(Pll { 16 config.rcc.pll = Some(Pll {
17 source: PllSource::HSI, 17 source: Pllsrc::HSI,
18 prediv_m: PllM::DIV4, 18 prediv: PllPreDiv::DIV4,
19 mul_n: PllN::MUL85, 19 mul: PllMul::MUL85,
20 div_p: None, 20 divp: None,
21 div_q: None, 21 divq: None,
22 // Main system clock at 170 MHz 22 // Main system clock at 170 MHz
23 div_r: Some(PllR::DIV2), 23 divr: Some(PllRDiv::DIV2),
24 }); 24 });
25 25
26 config.rcc.adc12_clock_source = AdcClockSource::SYS; 26 config.rcc.adc12_clock_source = AdcClockSource::SYS;
27 config.rcc.mux = ClockSrc::PLL; 27 config.rcc.sys = Sysclk::PLL1_R;
28 28
29 let mut p = embassy_stm32::init(config); 29 let mut p = embassy_stm32::init(config);
30 info!("Hello World!"); 30 info!("Hello World!");