@@ -77,7 +77,7 @@ macro_rules! gpio {
77
77
] ) => {
78
78
/// GPIO
79
79
pub mod $gpiox {
80
- use void :: Void ;
80
+ use core :: convert :: Infallible ;
81
81
use core:: marker:: PhantomData ;
82
82
83
83
use crate :: hal:: digital:: v2:: { InputPin , OutputPin , StatefulOutputPin , toggleable} ;
@@ -164,7 +164,7 @@ macro_rules! gpio {
164
164
}
165
165
166
166
impl <MODE > OutputPin for Generic <Output <MODE >> {
167
- type Error = Void ;
167
+ type Error = Infallible ;
168
168
fn set_high( & mut self ) -> Result <( ) , Self :: Error > {
169
169
// NOTE(unsafe) atomic write to a stateless register
170
170
Ok ( unsafe { ( * $GPIOX:: ptr( ) ) . bsrr. write( |w| w. bits( 1 << self . i) ) } )
@@ -177,7 +177,7 @@ macro_rules! gpio {
177
177
}
178
178
179
179
impl <MODE > InputPin for Generic <Input <MODE >> {
180
- type Error = Void ;
180
+ type Error = Infallible ;
181
181
fn is_high( & self ) -> Result <bool , Self :: Error > {
182
182
self . is_low( ) . map( |b| !b)
183
183
}
@@ -202,7 +202,7 @@ macro_rules! gpio {
202
202
impl <MODE > toggleable:: Default for Generic <Output <MODE >> { }
203
203
204
204
impl InputPin for Generic <Output <OpenDrain >> {
205
- type Error = Void ;
205
+ type Error = Infallible ;
206
206
fn is_high( & self ) -> Result <bool , Self :: Error > {
207
207
self . is_low( ) . map( |b| !b)
208
208
}
@@ -470,7 +470,7 @@ macro_rules! gpio {
470
470
}
471
471
472
472
impl <MODE > OutputPin for $PXi<Output <MODE >> {
473
- type Error = Void ;
473
+ type Error = Infallible ;
474
474
fn set_high( & mut self ) -> Result <( ) , Self :: Error > {
475
475
// NOTE(unsafe) atomic write to a stateless register
476
476
Ok ( unsafe { ( * $GPIOX:: ptr( ) ) . bsrr. write( |w| w. bits( 1 << $i) ) } )
@@ -496,7 +496,7 @@ macro_rules! gpio {
496
496
impl <MODE > toggleable:: Default for $PXi<Output <MODE >> { }
497
497
498
498
impl <MODE > InputPin for $PXi<Input <MODE >> {
499
- type Error = Void ;
499
+ type Error = Infallible ;
500
500
fn is_high( & self ) -> Result <bool , Self :: Error > {
501
501
self . is_low( ) . map( |b| !b)
502
502
}
@@ -508,7 +508,7 @@ macro_rules! gpio {
508
508
}
509
509
510
510
impl InputPin for $PXi<Output <OpenDrain >> {
511
- type Error = Void ;
511
+ type Error = Infallible ;
512
512
fn is_high( & self ) -> Result <bool , Self :: Error > {
513
513
self . is_low( ) . map( |b| !b)
514
514
}
@@ -525,8 +525,8 @@ macro_rules! gpio {
525
525
526
526
macro_rules! impl_pxx {
527
527
( $( ( $port: ident :: $pin: ident) ) ,* ) => {
528
- use void:: Void ;
529
528
use embedded_hal:: digital:: v2:: { InputPin , StatefulOutputPin , OutputPin } ;
529
+ use core:: convert:: Infallible ;
530
530
531
531
pub enum Pxx <MODE > {
532
532
$(
@@ -535,14 +535,14 @@ macro_rules! impl_pxx {
535
535
}
536
536
537
537
impl <MODE > OutputPin for Pxx <Output <MODE >> {
538
- type Error = Void ;
539
- fn set_high( & mut self ) -> Result <( ) , Void > {
538
+ type Error = Infallible ;
539
+ fn set_high( & mut self ) -> Result <( ) , Infallible > {
540
540
match self {
541
541
$( Pxx :: $pin( pin) => pin. set_high( ) ) ,*
542
542
}
543
543
}
544
544
545
- fn set_low( & mut self ) -> Result <( ) , Void > {
545
+ fn set_low( & mut self ) -> Result <( ) , Infallible > {
546
546
match self {
547
547
$( Pxx :: $pin( pin) => pin. set_low( ) ) ,*
548
548
}
@@ -564,14 +564,14 @@ macro_rules! impl_pxx {
564
564
}
565
565
566
566
impl <MODE > InputPin for Pxx <Input <MODE >> {
567
- type Error = Void ;
568
- fn is_high( & self ) -> Result <bool , Void > {
567
+ type Error = Infallible ;
568
+ fn is_high( & self ) -> Result <bool , Infallible > {
569
569
match self {
570
570
$( Pxx :: $pin( pin) => pin. is_high( ) ) ,*
571
571
}
572
572
}
573
573
574
- fn is_low( & self ) -> Result <bool , Void > {
574
+ fn is_low( & self ) -> Result <bool , Infallible > {
575
575
match self {
576
576
$( Pxx :: $pin( pin) => pin. is_low( ) ) ,*
577
577
}
0 commit comments