@@ -72,7 +72,7 @@ pub enum State {
72
72
}
73
73
74
74
macro_rules! gpio {
75
- ( $GPIOX: ident, $gpiox: ident, $gpioy: ident, $iopxenr : ident , $iopxrst : ident , $ PXx: ident, [
75
+ ( $GPIOX: ident, $gpiox: ident, $gpioy: ident, $PXx: ident, [
76
76
$( $PXi: ident: ( $pxi: ident, $i: expr, $MODE: ty, $CR: ident) , ) +
77
77
] ) => {
78
78
/// GPIO
@@ -83,7 +83,7 @@ macro_rules! gpio {
83
83
use crate :: hal:: digital:: v2:: { InputPin , OutputPin , StatefulOutputPin , toggleable} ;
84
84
use crate :: pac:: { $gpioy, $GPIOX} ;
85
85
86
- use crate :: rcc:: APB2 ;
86
+ use crate :: rcc:: { APB2 , Enable , Reset } ;
87
87
use super :: {
88
88
Alternate , Floating , GpioExt , Input ,
89
89
OpenDrain ,
@@ -112,10 +112,9 @@ macro_rules! gpio {
112
112
impl GpioExt for $GPIOX {
113
113
type Parts = Parts ;
114
114
115
- fn split( self , apb2: & mut APB2 ) -> Parts {
116
- apb2. enr( ) . modify( |_, w| w. $iopxenr( ) . set_bit( ) ) ;
117
- apb2. rstr( ) . modify( |_, w| w. $iopxrst( ) . set_bit( ) ) ;
118
- apb2. rstr( ) . modify( |_, w| w. $iopxrst( ) . clear_bit( ) ) ;
115
+ fn split( self , apb: & mut APB2 ) -> Parts {
116
+ $GPIOX:: enable( apb) ;
117
+ $GPIOX:: reset( apb) ;
119
118
120
119
Parts {
121
120
crl: CRL { _0: ( ) } ,
@@ -532,7 +531,7 @@ macro_rules! gpio {
532
531
}
533
532
}
534
533
535
- gpio ! ( GPIOA , gpioa, gpioa, iopaen , ioparst , PAx , [
534
+ gpio ! ( GPIOA , gpioa, gpioa, PAx , [
536
535
PA0 : ( pa0, 0 , Input <Floating >, CRL ) ,
537
536
PA1 : ( pa1, 1 , Input <Floating >, CRL ) ,
538
537
PA2 : ( pa2, 2 , Input <Floating >, CRL ) ,
@@ -551,7 +550,7 @@ gpio!(GPIOA, gpioa, gpioa, iopaen, ioparst, PAx, [
551
550
PA15 : ( pa15, 15 , Debugger , CRH ) ,
552
551
] ) ;
553
552
554
- gpio ! ( GPIOB , gpiob, gpioa, iopben , iopbrst , PBx , [
553
+ gpio ! ( GPIOB , gpiob, gpioa, PBx , [
555
554
PB0 : ( pb0, 0 , Input <Floating >, CRL ) ,
556
555
PB1 : ( pb1, 1 , Input <Floating >, CRL ) ,
557
556
PB2 : ( pb2, 2 , Input <Floating >, CRL ) ,
@@ -570,7 +569,7 @@ gpio!(GPIOB, gpiob, gpioa, iopben, iopbrst, PBx, [
570
569
PB15 : ( pb15, 15 , Input <Floating >, CRH ) ,
571
570
] ) ;
572
571
573
- gpio ! ( GPIOC , gpioc, gpioa, iopcen , iopcrst , PCx , [
572
+ gpio ! ( GPIOC , gpioc, gpioa, PCx , [
574
573
PC0 : ( pc0, 0 , Input <Floating >, CRL ) ,
575
574
PC1 : ( pc1, 1 , Input <Floating >, CRL ) ,
576
575
PC2 : ( pc2, 2 , Input <Floating >, CRL ) ,
@@ -589,7 +588,7 @@ gpio!(GPIOC, gpioc, gpioa, iopcen, iopcrst, PCx, [
589
588
PC15 : ( pc15, 15 , Input <Floating >, CRH ) ,
590
589
] ) ;
591
590
592
- gpio ! ( GPIOD , gpiod, gpioa, iopden , iopdrst , PDx , [
591
+ gpio ! ( GPIOD , gpiod, gpioa, PDx , [
593
592
PD0 : ( pd0, 0 , Input <Floating >, CRL ) ,
594
593
PD1 : ( pd1, 1 , Input <Floating >, CRL ) ,
595
594
PD2 : ( pd2, 2 , Input <Floating >, CRL ) ,
@@ -608,7 +607,7 @@ gpio!(GPIOD, gpiod, gpioa, iopden, iopdrst, PDx, [
608
607
PD15 : ( pd15, 15 , Input <Floating >, CRH ) ,
609
608
] ) ;
610
609
611
- gpio ! ( GPIOE , gpioe, gpioa, iopeen , ioperst , PEx , [
610
+ gpio ! ( GPIOE , gpioe, gpioa, PEx , [
612
611
PE0 : ( pe0, 0 , Input <Floating >, CRL ) ,
613
612
PE1 : ( pe1, 1 , Input <Floating >, CRL ) ,
614
613
PE2 : ( pe2, 2 , Input <Floating >, CRL ) ,
0 commit comments