aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32l4
diff options
context:
space:
mode:
authormaor malka <[email protected]>2025-08-24 21:42:30 -0400
committermaor malka <[email protected]>2025-08-24 21:42:30 -0400
commit0b8da5ab8f6469bdf2adf7462e7ebedee93dde3f (patch)
tree11f252b5d8d5dca6da3649f210bb986ddae60563 /examples/stm32l4
parent14a047a9ad75709e0bde8b0fa71f3b4bddedc576 (diff)
stm32l4/example/adc_dma: missing clock configuration
Diffstat (limited to 'examples/stm32l4')
-rw-r--r--examples/stm32l4/src/bin/adc_dma.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/examples/stm32l4/src/bin/adc_dma.rs b/examples/stm32l4/src/bin/adc_dma.rs
index 1769c735a..a5b7b0c5e 100644
--- a/examples/stm32l4/src/bin/adc_dma.rs
+++ b/examples/stm32l4/src/bin/adc_dma.rs
@@ -13,8 +13,11 @@ const DMA_BUF_LEN: usize = 512;
13async fn main(_spawner: Spawner) { 13async fn main(_spawner: Spawner) {
14 info!("Hello World!"); 14 info!("Hello World!");
15 15
16 let config = Config::default(); 16 let mut config = Config::default();
17 17 {
18 use embassy_stm32::rcc::*;
19 config.rcc.mux.adcsel = mux::Adcsel::SYS;
20 }
18 let p = embassy_stm32::init(config); 21 let p = embassy_stm32::init(config);
19 22
20 let mut adc = Adc::new(p.ADC1); 23 let mut adc = Adc::new(p.ADC1);
@@ -36,14 +39,13 @@ async fn main(_spawner: Spawner) {
36 loop { 39 loop {
37 match ring_buffered_adc.read(&mut measurements).await { 40 match ring_buffered_adc.read(&mut measurements).await {
38 Ok(_) => { 41 Ok(_) => {
39 //note: originally there was a print here showing all the samples, 42 //note: originally there was a print here showing all the samples,
40 //but even that takes too much time and would cause adc overruns 43 //but even that takes too much time and would cause adc overruns
41 info!("adc1 first 10 samples: {}",measurements[0..10]); 44 info!("adc1 first 10 samples: {}", measurements[0..10]);
42 } 45 }
43 Err(e) => { 46 Err(e) => {
44 warn!("Error: {:?}", e); 47 warn!("Error: {:?}", e);
45 } 48 }
46 } 49 }
47 } 50 }
48
49} 51}