Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
remove AdcChannelDriver::channel
  • Loading branch information
liebman committed Sep 15, 2023
1 parent 5208e18 commit fcacc58
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions src/adc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ pub mod oneshot {
M: Borrow<AdcDriver<'d, T::Adc>>,
{
adc: M,
pin: PeripheralRef<'d, T>,
_pin: PeripheralRef<'d, T>,
calibration: Option<adc_cali_handle_t>,
}

Expand Down Expand Up @@ -530,7 +530,7 @@ pub mod oneshot {
}
Ok(Self {
adc,
pin,
_pin: pin,
calibration,
})
}
Expand Down Expand Up @@ -623,10 +623,6 @@ pub mod oneshot {
None
}

pub fn channel(&self) -> adc_channel_t {
self.pin.adc_channel()
}

#[inline(always)]
pub fn read(&mut self) -> Result<u16, EspError> {
let raw = self.read_raw()?;
Expand All @@ -635,7 +631,7 @@ pub mod oneshot {

#[inline(always)]
pub fn read_raw(&mut self) -> Result<u16, EspError> {
let channel = self.channel();
let channel = T::CHANNEL;
self.adc.borrow().read_raw_internal(channel)
}

Expand Down Expand Up @@ -674,10 +670,7 @@ pub mod oneshot {
}

#[inline(always)]
pub fn read<T, M>(
&self,
channel: &mut AdcChannelDriver<'d, T, M>,
) -> Result<u16, EspError>
pub fn read<T, M>(&self, channel: &mut AdcChannelDriver<'d, T, M>) -> Result<u16, EspError>
where
T: ADCPin,
M: Borrow<AdcDriver<'d, T::Adc>>,
Expand All @@ -689,13 +682,13 @@ pub mod oneshot {
#[inline(always)]
pub fn read_raw<T, M>(
&self,
channel: &mut AdcChannelDriver<'d, T, M>,
_channel: &mut AdcChannelDriver<'d, T, M>,
) -> Result<u16, EspError>
where
T: ADCPin,
M: Borrow<AdcDriver<'d, T::Adc>>,
{
self.read_raw_internal(channel.channel())
self.read_raw_internal(T::CHANNEL)
}

#[inline(always)]
Expand Down

0 comments on commit fcacc58

Please sign in to comment.