Protect the legacy example; do not make the oneshot_legacy mod an API (yet)

This commit is contained in:
ivmarkov 2024-06-13 15:45:18 +00:00
parent e3e8a37807
commit 16823abd7d
2 changed files with 15 additions and 5 deletions

View File

@ -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));
}
}

View File

@ -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::*;