File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -206,6 +206,32 @@ macro_rules! gpio {
206
206
}
207
207
}
208
208
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
+
209
235
#[ cfg( feature = "unproven" ) ]
210
236
impl <MODE > StatefulOutputPin for PXx <Output <MODE >> {
211
237
fn is_set_high( & self ) -> Result <bool , Self :: Error > {
You can’t perform that action at this time.
0 commit comments