aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32g0/src/bin/adc.rs
diff options
context:
space:
mode:
authorPer Rosengren <[email protected]>2025-08-25 23:05:30 +0200
committerPer Rosengren <[email protected]>2025-08-30 22:01:40 +0200
commita548d7efe3ad963b95183d92c2841fde744cc373 (patch)
treecafaa7d28996212f3e8b2a9a6e6b808e23a09038 /examples/stm32g0/src/bin/adc.rs
parentf86cf87f2f20f723e2ba2fe7d83908a2b3bac2d1 (diff)
Add Adc::new_with_clock() to configure analog clock
Required on STM32WL with default HAL initialization. The function is only available for adc_g0, but all that have clock config should add implementations.
Diffstat (limited to 'examples/stm32g0/src/bin/adc.rs')
-rw-r--r--examples/stm32g0/src/bin/adc.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/stm32g0/src/bin/adc.rs b/examples/stm32g0/src/bin/adc.rs
index 6c7f3b48a..7d8653ef2 100644
--- a/examples/stm32g0/src/bin/adc.rs
+++ b/examples/stm32g0/src/bin/adc.rs
@@ -3,7 +3,7 @@
3 3
4use defmt::*; 4use defmt::*;
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_stm32::adc::{Adc, SampleTime}; 6use embassy_stm32::adc::{Adc, Clock, Presc, SampleTime};
7use embassy_time::Timer; 7use embassy_time::Timer;
8use {defmt_rtt as _, panic_probe as _}; 8use {defmt_rtt as _, panic_probe as _};
9 9
@@ -12,7 +12,7 @@ async fn main(_spawner: Spawner) {
12 let p = embassy_stm32::init(Default::default()); 12 let p = embassy_stm32::init(Default::default());
13 info!("Hello World!"); 13 info!("Hello World!");
14 14
15 let mut adc = Adc::new(p.ADC1); 15 let mut adc = Adc::new_with_clock(p.ADC1, Clock::Async { div: Presc::DIV1 });
16 adc.set_sample_time(SampleTime::CYCLES79_5); 16 adc.set_sample_time(SampleTime::CYCLES79_5);
17 let mut pin = p.PA1; 17 let mut pin = p.PA1;
18 18