Skip to content

Commit cad110e

Browse files
David-OConnorteskje
authored andcommitted
Commit troubleshooting
1 parent 2e41e92 commit cad110e

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/gpio.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,32 @@ macro_rules! gpio {
206206
}
207207
}
208208

209+
210+
#[cfg(feature = "unproven")]
211+
impl<MODE> InputPin for PXx<Output<MODE>> {
212+
type Error = Infallible;
213+
214+
fn is_high(&self) -> Result<bool, Self::Error> {
215+
Ok(!self.is_low()?)
216+
}
217+
218+
fn is_low(&self) -> Result<bool, Self::Error> {
219+
// NOTE(unsafe) atomic read with no side effects
220+
Ok(unsafe {
221+
match &self.gpio {
222+
$(
223+
#[cfg(all(any(
224+
$(feature = $device,)+
225+
), not(any(
226+
$(feature = $device_except,)*
227+
))))]
228+
Gpio::$GPIOX => (*$GPIOX::ptr()).idr.read().bits() & (1 << self.i) == 0,
229+
)+
230+
}
231+
})
232+
}
233+
}
234+
209235
#[cfg(feature = "unproven")]
210236
impl <MODE> StatefulOutputPin for PXx<Output<MODE>> {
211237
fn is_set_high(&self) -> Result<bool, Self::Error> {

0 commit comments

Comments
 (0)