@@ -244,7 +244,7 @@ macro_rules! gpio {
244244 use core:: marker:: PhantomData ;
245245 use core:: convert:: Infallible ;
246246
247- use embedded_hal:: digital:: v2 :: { InputPin , OutputPin , StatefulOutputPin , toggleable} ;
247+ use embedded_hal:: digital:: { InputPin , OutputPin , StatefulOutputPin , toggleable} ;
248248 use crate :: stm32:: $GPIOX;
249249
250250 use crate :: stm32:: { RCC , EXTI , SYSCFG } ;
@@ -293,25 +293,25 @@ macro_rules! gpio {
293293 impl <MODE > OutputPin for $PXx<Output <MODE >> {
294294 type Error = Infallible ;
295295
296- fn set_high ( & mut self ) -> Result <( ) , Self :: Error > {
296+ fn try_set_high ( & mut self ) -> Result <( ) , Self :: Error > {
297297 // NOTE(unsafe) atomic write to a stateless register
298298 unsafe { ( * $GPIOX:: ptr( ) ) . bsrr. write( |w| w. bits( 1 << self . i) ) } ;
299299 Ok ( ( ) )
300300 }
301301
302- fn set_low ( & mut self ) -> Result <( ) , Self :: Error > {
302+ fn try_set_low ( & mut self ) -> Result <( ) , Self :: Error > {
303303 // NOTE(unsafe) atomic write to a stateless register
304304 unsafe { ( * $GPIOX:: ptr( ) ) . bsrr. write( |w| w. bits( 1 << ( self . i + 16 ) ) ) } ;
305305 Ok ( ( ) )
306306 }
307307 }
308308
309309 impl <MODE > StatefulOutputPin for $PXx<Output <MODE >> {
310- fn is_set_high ( & self ) -> Result <bool , Self :: Error > {
311- self . is_set_low ( ) . map( |v| !v)
310+ fn try_is_set_high ( & self ) -> Result <bool , Self :: Error > {
311+ self . try_is_set_low ( ) . map( |v| !v)
312312 }
313313
314- fn is_set_low ( & self ) -> Result <bool , Self :: Error > {
314+ fn try_is_set_low ( & self ) -> Result <bool , Self :: Error > {
315315 // NOTE(unsafe) atomic read with no side effects
316316 Ok ( unsafe { ( * $GPIOX:: ptr( ) ) . odr. read( ) . bits( ) & ( 1 << self . i) == 0 } )
317317 }
@@ -322,11 +322,11 @@ macro_rules! gpio {
322322 impl <MODE > InputPin for $PXx<Output <MODE >> {
323323 type Error = Infallible ;
324324
325- fn is_high ( & self ) -> Result <bool , Self :: Error > {
326- self . is_low ( ) . map( |v| !v)
325+ fn try_is_high ( & self ) -> Result <bool , Self :: Error > {
326+ self . try_is_low ( ) . map( |v| !v)
327327 }
328328
329- fn is_low ( & self ) -> Result <bool , Self :: Error > {
329+ fn try_is_low ( & self ) -> Result <bool , Self :: Error > {
330330 // NOTE(unsafe) atomic read with no side effects
331331 Ok ( unsafe { ( * $GPIOX:: ptr( ) ) . idr. read( ) . bits( ) & ( 1 << self . i) == 0 } )
332332 }
@@ -335,11 +335,11 @@ macro_rules! gpio {
335335 impl <MODE > InputPin for $PXx<Input <MODE >> {
336336 type Error = Infallible ;
337337
338- fn is_high ( & self ) -> Result <bool , Self :: Error > {
339- self . is_low ( ) . map( |v| !v)
338+ fn try_is_high ( & self ) -> Result <bool , Self :: Error > {
339+ self . try_is_low ( ) . map( |v| !v)
340340 }
341341
342- fn is_low ( & self ) -> Result <bool , Self :: Error > {
342+ fn try_is_low ( & self ) -> Result <bool , Self :: Error > {
343343 // NOTE(unsafe) atomic read with no side effects
344344 Ok ( unsafe { ( * $GPIOX:: ptr( ) ) . idr. read( ) . bits( ) & ( 1 << self . i) == 0 } )
345345 }
@@ -754,25 +754,25 @@ macro_rules! gpio {
754754 impl <MODE > OutputPin for $PXi<Output <MODE >> {
755755 type Error = Infallible ;
756756
757- fn set_high ( & mut self ) -> Result <( ) , Self :: Error > {
757+ fn try_set_high ( & mut self ) -> Result <( ) , Self :: Error > {
758758 // NOTE(unsafe) atomic write to a stateless register
759759 unsafe { ( * $GPIOX:: ptr( ) ) . bsrr. write( |w| w. bits( 1 << $i) ) } ;
760760 Ok ( ( ) )
761761 }
762762
763- fn set_low ( & mut self ) -> Result <( ) , Self :: Error > {
763+ fn try_set_low ( & mut self ) -> Result <( ) , Self :: Error > {
764764 // NOTE(unsafe) atomic write to a stateless register
765765 unsafe { ( * $GPIOX:: ptr( ) ) . bsrr. write( |w| w. bits( 1 << ( $i + 16 ) ) ) } ;
766766 Ok ( ( ) )
767767 }
768768 }
769769
770770 impl <MODE > StatefulOutputPin for $PXi<Output <MODE >> {
771- fn is_set_high ( & self ) -> Result <bool , Self :: Error > {
772- self . is_set_low ( ) . map( |v| !v)
771+ fn try_is_set_high ( & self ) -> Result <bool , Self :: Error > {
772+ self . try_is_set_low ( ) . map( |v| !v)
773773 }
774774
775- fn is_set_low ( & self ) -> Result <bool , Self :: Error > {
775+ fn try_is_set_low ( & self ) -> Result <bool , Self :: Error > {
776776 // NOTE(unsafe) atomic read with no side effects
777777 Ok ( unsafe { ( * $GPIOX:: ptr( ) ) . odr. read( ) . bits( ) & ( 1 << $i) == 0 } )
778778 }
@@ -783,11 +783,11 @@ macro_rules! gpio {
783783 impl <MODE > InputPin for $PXi<Output <MODE >> {
784784 type Error = Infallible ;
785785
786- fn is_high ( & self ) -> Result <bool , Self :: Error > {
787- self . is_low ( ) . map( |v| !v)
786+ fn try_is_high ( & self ) -> Result <bool , Self :: Error > {
787+ self . try_is_low ( ) . map( |v| !v)
788788 }
789789
790- fn is_low ( & self ) -> Result <bool , Self :: Error > {
790+ fn try_is_low ( & self ) -> Result <bool , Self :: Error > {
791791 // NOTE(unsafe) atomic read with no side effects
792792 Ok ( unsafe { ( * $GPIOX:: ptr( ) ) . idr. read( ) . bits( ) & ( 1 << $i) == 0 } )
793793 }
@@ -796,11 +796,11 @@ macro_rules! gpio {
796796 impl <MODE > InputPin for $PXi<Input <MODE >> {
797797 type Error = Infallible ;
798798
799- fn is_high ( & self ) -> Result <bool , Self :: Error > {
800- self . is_low ( ) . map( |v| !v)
799+ fn try_is_high ( & self ) -> Result <bool , Self :: Error > {
800+ self . try_is_low ( ) . map( |v| !v)
801801 }
802802
803- fn is_low ( & self ) -> Result <bool , Self :: Error > {
803+ fn try_is_low ( & self ) -> Result <bool , Self :: Error > {
804804 // NOTE(unsafe) atomic read with no side effects
805805 Ok ( unsafe { ( * $GPIOX:: ptr( ) ) . idr. read( ) . bits( ) & ( 1 << $i) == 0 } )
806806 }
0 commit comments