diff options
| author | Raul Alimbekov <[email protected]> | 2025-12-16 09:05:22 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-12-16 09:05:22 +0300 |
| commit | c9a04b4b732b7a3b696eb8223664c1a7942b1875 (patch) | |
| tree | 6dbe5c02e66eed8d8762f13f95afd24f8db2b38c /examples/stm32f0/src/bin/adc-watchdog.rs | |
| parent | cde24a3ef1117653ba5ed4184102b33f745782fb (diff) | |
| parent | 5ae6e060ec1c90561719aabdc29d5b6e7b8b0a82 (diff) | |
Merge branch 'main' into main
Diffstat (limited to 'examples/stm32f0/src/bin/adc-watchdog.rs')
| -rw-r--r-- | examples/stm32f0/src/bin/adc-watchdog.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/stm32f0/src/bin/adc-watchdog.rs b/examples/stm32f0/src/bin/adc-watchdog.rs index ff98aac8e..6879dd10a 100644 --- a/examples/stm32f0/src/bin/adc-watchdog.rs +++ b/examples/stm32f0/src/bin/adc-watchdog.rs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | use defmt::*; | 4 | use defmt::*; |
| 5 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
| 6 | use embassy_stm32::adc::{self, Adc, WatchdogChannels}; | 6 | use embassy_stm32::adc::{self, Adc, SampleTime, WatchdogChannels}; |
| 7 | use embassy_stm32::bind_interrupts; | 7 | use embassy_stm32::bind_interrupts; |
| 8 | use embassy_stm32::peripherals::ADC1; | 8 | use embassy_stm32::peripherals::ADC1; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 9 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -23,12 +23,12 @@ async fn main(_spawner: Spawner) { | |||
| 23 | loop { | 23 | loop { |
| 24 | // Wait for pin to go high | 24 | // Wait for pin to go high |
| 25 | adc.init_watchdog(WatchdogChannels::from_channel(&pin), 0, 0x07F); | 25 | adc.init_watchdog(WatchdogChannels::from_channel(&pin), 0, 0x07F); |
| 26 | let v_high = adc.monitor_watchdog().await; | 26 | let v_high = adc.monitor_watchdog(SampleTime::CYCLES13_5).await; |
| 27 | info!("ADC sample is high {}", v_high); | 27 | info!("ADC sample is high {}", v_high); |
| 28 | 28 | ||
| 29 | // Wait for pin to go low | 29 | // Wait for pin to go low |
| 30 | adc.init_watchdog(WatchdogChannels::from_channel(&pin), 0x01f, 0xFFF); | 30 | adc.init_watchdog(WatchdogChannels::from_channel(&pin), 0x01f, 0xFFF); |
| 31 | let v_low = adc.monitor_watchdog().await; | 31 | let v_low = adc.monitor_watchdog(SampleTime::CYCLES13_5).await; |
| 32 | info!("ADC sample is low {}", v_low); | 32 | info!("ADC sample is low {}", v_low); |
| 33 | } | 33 | } |
| 34 | } | 34 | } |
