diff --git a/examples/adc.rs b/examples/adc.rs index 2d27a1571..fb099ef05 100644 --- a/examples/adc.rs +++ b/examples/adc.rs @@ -6,11 +6,12 @@ use esp_idf_sys::{self as _}; // If using the `binstart` feature of `esp-idf-sys use std::thread; use std::time::Duration; -use esp_idf_hal::adc::config::Config; -use esp_idf_hal::adc::*; -use esp_idf_hal::peripherals::Peripherals; - +#[cfg(not(feature = "adc-oneshot-new"))] fn main() -> anyhow::Result<()> { + use esp_idf_hal::adc::config::Config; + use esp_idf_hal::adc::*; + use esp_idf_hal::peripherals::Peripherals; + let peripherals = Peripherals::take()?; #[cfg(not(esp32))] @@ -35,3 +36,12 @@ fn main() -> anyhow::Result<()> { println!("ADC value: {}", adc.read(&mut adc_pin)?); } } + +#[cfg(feature = "adc-oneshot-new")] +fn main() -> anyhow::Result<()> { + println!("This example requires feature `adc-oneshot-new` disabled"); + + loop { + thread::sleep(Duration::from_millis(1000)); + } +} diff --git a/src/adc.rs b/src/adc.rs index e7ab19a64..4106a83ed 100644 --- a/src/adc.rs +++ b/src/adc.rs @@ -461,7 +461,7 @@ impl_adc!(ADC2: adc_unit_t_ADC_UNIT_2); not(esp_idf_version_major = "4"), esp_idf_comp_esp_adc_enabled ))] -pub mod oneshot { +mod oneshot { use core::borrow::Borrow; use esp_idf_sys::*;