pub struct AdcDriver<'d> { /* private fields */ }
Implementations§
Source§impl<'d> AdcDriver<'d>
impl<'d> AdcDriver<'d>
Sourcepub fn new<A: Adc>(
adc: impl Peripheral<P = A> + 'd,
config: &Config,
channels: impl AdcChannels<Adc = A> + 'd,
) -> Result<Self, EspError>
pub fn new<A: Adc>( adc: impl Peripheral<P = A> + 'd, config: &Config, channels: impl AdcChannels<Adc = A> + 'd, ) -> Result<Self, EspError>
Initialize ADC continuous driver with configuration and channels.
Sourcepub fn handle(&self) -> adc_continuous_handle_t
pub fn handle(&self) -> adc_continuous_handle_t
Get the ADC driver handle.
pub fn unit(&self) -> adc_unit_t
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: TickType_t,
) -> Result<usize, EspError>
pub fn read( &mut self, buf: &mut [AdcMeasurement], timeout: TickType_t, ) -> Result<usize, EspError>
Read AdcMeasurements
in continuous mode.
Sourcepub fn read_bytes(
&mut self,
buf: &mut [u8],
timeout: TickType_t,
) -> Result<usize, EspError>
pub fn read_bytes( &mut self, buf: &mut [u8], timeout: TickType_t, ) -> 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, Self::Error>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::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, Self::Error>
async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::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