Skip to content

Commit

Permalink
Only accept pins which are for the same ADC unit
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmarkov committed Sep 13, 2023
1 parent 98314cf commit 4a75054
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/adc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ pub struct AdcChannelDriver<'d, const A: adc_atten_t, T: ADCPin> {

#[cfg(not(feature = "riscv-ulp-hal"))]
impl<'d, const A: adc_atten_t, T: ADCPin> AdcChannelDriver<'d, A, T> {
pub fn new(pin: impl Peripheral<P = T> + 'd) -> Result<AdcChannelDriver<'d, A, T>, EspError> {
pub fn new(pin: impl Peripheral<P = T> + 'd) -> Result<Self, EspError> {
crate::into_ref!(pin);

unsafe {
Expand Down Expand Up @@ -239,7 +239,7 @@ impl<'d, ADC: Adc> AdcDriver<'d, ADC> {
pin: &mut AdcChannelDriver<'_, A, T>,
) -> Result<u16, EspError>
where
T: ADCPin,
T: ADCPin<Adc = ADC>,
{
self.read_internal(ADC::unit(), pin.pin().adc_channel(), A)
}
Expand All @@ -250,7 +250,7 @@ impl<'d, ADC: Adc> AdcDriver<'d, ADC> {
pin: &mut AdcChannelDriver<'_, A, T>,
) -> Result<u16, EspError>
where
T: ADCPin,
T: ADCPin<Adc = ADC>,
{
self.read_internal_raw(ADC::unit(), pin.pin().adc_channel())
}
Expand Down

0 comments on commit 4a75054

Please sign in to comment.