I think there is a missing ! in gpio.rs in the gpio macro implementing is_high. see attached code for first occurence with missing ! and second occurence with ! present.
...
impl<MODE> StatefulOutputPin for $PXx<Output<MODE>> {
fn is_set_high(&self) -> Result<bool, Self::Error> {
let is_high = self.is_set_low()?; // Missing "!"
Ok(is_high)
}
fn is_set_low(&self) -> Result<bool, Self::Error> {
// NOTE(unsafe) atomic read with no side effects
let is_low = unsafe { (*$GPIOX::ptr()).odr.read().bits() & (1 << self.i) == 0 };
Ok(is_low)
}
}
impl<MODE> toggleable::Default for $PXx<Output<MODE>> {}
impl<MODE> InputPin for $PXx<Output<MODE>> {
type Error = void::Void;
fn is_high(&self) -> Result<bool, Self::Error> {
let is_high = !self.is_low()?; // Not missing
Ok(is_high)
}
fn is_low(&self) -> Result<bool, Self::Error> {
// NOTE(unsafe) atomic read with no side effects
let is_low = unsafe { (*$GPIOX::ptr()).idr.read().bits() & (1 << self.i) == 0 };
Ok(is_low)
}
}
...
I think there is a missing
!
in gpio.rs in the gpio macro implementingis_high
. see attached code for first occurence with missing!
and second occurence with!
present.