pub struct AdcContDriver<'d> { /* private fields */ }
Implementations§
Source§impl<'d> AdcDriver<'d>
impl<'d> AdcDriver<'d>
Sourcepub fn new<A>(
adc: impl Peripheral<P = A> + 'd,
config: &Config,
channels: impl AdcChannels<Adc = A> + 'd,
) -> Result<AdcDriver<'d>, EspError>where
A: Adc,
pub fn new<A>(
adc: impl Peripheral<P = A> + 'd,
config: &Config,
channels: impl AdcChannels<Adc = A> + 'd,
) -> Result<AdcDriver<'d>, EspError>where
A: Adc,
Initialize ADC continuous driver with configuration and channels.
Sourcepub fn handle(&self) -> *mut adc_continuous_ctx_t
pub fn handle(&self) -> *mut adc_continuous_ctx_t
Get the ADC driver handle.
pub fn unit(&self) -> u32
Sourcepub fn start(&mut self) -> Result<(), EspError>
pub fn start(&mut self) -> Result<(), EspError>
Start the ADC under continuous mode and generate results.
Sourcepub fn read(
&mut self,
buf: &mut [AdcMeasurement],
timeout: u32,
) -> Result<usize, EspError>
pub fn read( &mut self, buf: &mut [AdcMeasurement], timeout: u32, ) -> Result<usize, EspError>
Read AdcMeasurements
in continuous mode.
Sourcepub fn read_bytes(
&mut self,
buf: &mut [u8],
timeout: u32,
) -> Result<usize, EspError>
pub fn read_bytes( &mut self, buf: &mut [u8], timeout: u32, ) -> Result<usize, EspError>
Read bytes in continuous mode.
pub async fn read_async( &mut self, buf: &mut [AdcMeasurement], ) -> Result<usize, EspError>
pub async fn read_bytes_async( &mut self, buf: &mut [u8], ) -> Result<usize, EspError>
Trait Implementations§
Source§impl ErrorType for AdcDriver<'_>
impl ErrorType for AdcDriver<'_>
Source§type Error = EspIOError
type Error = EspIOError
Error type of all the IO operations on this type.
Source§impl Read for AdcDriver<'_>
impl Read for AdcDriver<'_>
Source§fn read(
&mut self,
buf: &mut [u8],
) -> Result<usize, <AdcDriver<'_> as ErrorType>::Error>
fn read( &mut self, buf: &mut [u8], ) -> Result<usize, <AdcDriver<'_> as ErrorType>::Error>
Read some bytes from this source into the specified buffer, returning how many bytes were read. Read more
Source§fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
Read the exact number of bytes required to fill
buf
. Read moreSource§impl Read for AdcDriver<'_>
impl Read for AdcDriver<'_>
Source§async fn read(
&mut self,
buf: &mut [u8],
) -> Result<usize, <AdcDriver<'_> as ErrorType>::Error>
async fn read( &mut self, buf: &mut [u8], ) -> Result<usize, <AdcDriver<'_> as ErrorType>::Error>
Read some bytes from this source into the specified buffer, returning how many bytes were read. Read more
Source§async fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
async fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
Read the exact number of bytes required to fill
buf
. Read more