diff options
| author | xoviat <[email protected]> | 2025-11-11 11:14:21 -0600 |
|---|---|---|
| committer | xoviat <[email protected]> | 2025-11-11 11:14:21 -0600 |
| commit | 769941980442ada1524ee4f60f1d003735caff4b (patch) | |
| tree | c4895854fc681b43fba37057729ad5698732acda /examples | |
| parent | aecff11b662c8232e7c848962c6c9ccda0cd9bf3 (diff) | |
adc: seal special channels
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/stm32g4/src/bin/adc.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/examples/stm32g4/src/bin/adc.rs b/examples/stm32g4/src/bin/adc.rs index 695f37115..94315141c 100644 --- a/examples/stm32g4/src/bin/adc.rs +++ b/examples/stm32g4/src/bin/adc.rs | |||
| @@ -30,9 +30,14 @@ async fn main(_spawner: Spawner) { | |||
| 30 | 30 | ||
| 31 | let mut adc = Adc::new(p.ADC2); | 31 | let mut adc = Adc::new(p.ADC2); |
| 32 | 32 | ||
| 33 | let mut adc_temp = Adc::new(p.ADC1); | ||
| 34 | let mut temperature = adc_temp.enable_temperature(); | ||
| 35 | |||
| 33 | loop { | 36 | loop { |
| 34 | let measured = adc.blocking_read(&mut p.PA7, SampleTime::CYCLES24_5); | 37 | let measured = adc.blocking_read(&mut p.PA7, SampleTime::CYCLES24_5); |
| 38 | let temperature = adc_temp.blocking_read(&mut temperature, SampleTime::CYCLES24_5); | ||
| 35 | info!("measured: {}", measured); | 39 | info!("measured: {}", measured); |
| 40 | info!("temperature: {}", temperature); | ||
| 36 | Timer::after_millis(500).await; | 41 | Timer::after_millis(500).await; |
| 37 | } | 42 | } |
| 38 | } | 43 | } |
