mirror of
https://github.com/esp-rs/esp-idf-hal.git
synced 2025-09-29 21:31:17 +00:00
Protect the legacy example; do not make the oneshot_legacy mod an API (yet)
This commit is contained in:
parent
e3e8a37807
commit
16823abd7d
@ -6,11 +6,12 @@ use esp_idf_sys::{self as _}; // If using the `binstart` feature of `esp-idf-sys
|
|||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use esp_idf_hal::adc::config::Config;
|
#[cfg(not(feature = "adc-oneshot-new"))]
|
||||||
use esp_idf_hal::adc::*;
|
|
||||||
use esp_idf_hal::peripherals::Peripherals;
|
|
||||||
|
|
||||||
fn main() -> anyhow::Result<()> {
|
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()?;
|
let peripherals = Peripherals::take()?;
|
||||||
|
|
||||||
#[cfg(not(esp32))]
|
#[cfg(not(esp32))]
|
||||||
@ -35,3 +36,12 @@ fn main() -> anyhow::Result<()> {
|
|||||||
println!("ADC value: {}", adc.read(&mut adc_pin)?);
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -461,7 +461,7 @@ impl_adc!(ADC2: adc_unit_t_ADC_UNIT_2);
|
|||||||
not(esp_idf_version_major = "4"),
|
not(esp_idf_version_major = "4"),
|
||||||
esp_idf_comp_esp_adc_enabled
|
esp_idf_comp_esp_adc_enabled
|
||||||
))]
|
))]
|
||||||
pub mod oneshot {
|
mod oneshot {
|
||||||
use core::borrow::Borrow;
|
use core::borrow::Borrow;
|
||||||
|
|
||||||
use esp_idf_sys::*;
|
use esp_idf_sys::*;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user