@@ -69,7 +69,7 @@ macro_rules! config_in_pins {
69
69
critical_section:: with( |_| {
70
70
$(
71
71
// TODO properly create a set_as_input function
72
- $pin . set_as_af( $pin. af_num ( ) , AfType :: input( Pull :: None ) ) ;
72
+ set_as_af! ( $pin, AfType :: input( Pull :: None ) ) ;
73
73
) *
74
74
} )
75
75
}
@@ -80,7 +80,7 @@ macro_rules! config_af_pins {
80
80
( $( $pin: ident) ,* ) => {
81
81
critical_section:: with( |_| {
82
82
$(
83
- $pin . set_as_af( $pin. af_num ( ) , AfType :: output( OutputType :: PushPull , Speed :: VeryHigh ) ) ;
83
+ set_as_af! ( $pin, AfType :: output( OutputType :: PushPull , Speed :: VeryHigh ) ) ;
84
84
) *
85
85
} )
86
86
} ;
@@ -91,27 +91,27 @@ macro_rules! config_pins {
91
91
( $( $pin: ident) ,* ) => {
92
92
critical_section:: with( |_| {
93
93
$(
94
- $pin . set_as_af( $pin. af_num ( ) , AfType :: output( OutputType :: PushPull , Speed :: VeryHigh ) ) ;
94
+ set_as_af! ( $pin, AfType :: output( OutputType :: PushPull , Speed :: VeryHigh ) ) ;
95
95
) *
96
96
} )
97
97
} ;
98
98
}
99
99
100
100
impl < ' d , T : Instance , P : Phy > Ethernet < ' d , T , P > {
101
101
/// safety: the returned instance is not leak-safe
102
- pub fn new < const TX : usize , const RX : usize > (
102
+ pub fn new < const TX : usize , const RX : usize , # [ cfg ( afio ) ] A > (
103
103
queue : & ' d mut PacketQueue < TX , RX > ,
104
104
peri : Peri < ' d , T > ,
105
105
irq : impl interrupt:: typelevel:: Binding < interrupt:: typelevel:: ETH , InterruptHandler > + ' d ,
106
- ref_clk : Peri < ' d , impl RefClkPin < T > > ,
107
- mdio : Peri < ' d , impl MDIOPin < T > > ,
108
- mdc : Peri < ' d , impl MDCPin < T > > ,
109
- crs : Peri < ' d , impl CRSPin < T > > ,
110
- rx_d0 : Peri < ' d , impl RXD0Pin < T > > ,
111
- rx_d1 : Peri < ' d , impl RXD1Pin < T > > ,
112
- tx_d0 : Peri < ' d , impl TXD0Pin < T > > ,
113
- tx_d1 : Peri < ' d , impl TXD1Pin < T > > ,
114
- tx_en : Peri < ' d , impl TXEnPin < T > > ,
106
+ ref_clk : Peri < ' d , if_afio ! ( impl RefClkPin <T , A > ) > ,
107
+ mdio : Peri < ' d , if_afio ! ( impl MDIOPin <T , A > ) > ,
108
+ mdc : Peri < ' d , if_afio ! ( impl MDCPin <T , A > ) > ,
109
+ crs : Peri < ' d , if_afio ! ( impl CRSPin <T , A > ) > ,
110
+ rx_d0 : Peri < ' d , if_afio ! ( impl RXD0Pin <T , A > ) > ,
111
+ rx_d1 : Peri < ' d , if_afio ! ( impl RXD1Pin <T , A > ) > ,
112
+ tx_d0 : Peri < ' d , if_afio ! ( impl TXD0Pin <T , A > ) > ,
113
+ tx_d1 : Peri < ' d , if_afio ! ( impl TXD1Pin <T , A > ) > ,
114
+ tx_en : Peri < ' d , if_afio ! ( impl TXEnPin <T , A > ) > ,
115
115
phy : P ,
116
116
mac_addr : [ u8 ; 6 ] ,
117
117
) -> Self {
@@ -289,24 +289,24 @@ impl<'d, T: Instance, P: Phy> Ethernet<'d, T, P> {
289
289
}
290
290
291
291
/// Create a new MII ethernet driver using 14 pins.
292
- pub fn new_mii < const TX : usize , const RX : usize > (
292
+ pub fn new_mii < const TX : usize , const RX : usize , # [ cfg ( afio ) ] A > (
293
293
queue : & ' d mut PacketQueue < TX , RX > ,
294
294
peri : Peri < ' d , T > ,
295
295
irq : impl interrupt:: typelevel:: Binding < interrupt:: typelevel:: ETH , InterruptHandler > + ' d ,
296
- rx_clk : Peri < ' d , impl RXClkPin < T > > ,
297
- tx_clk : Peri < ' d , impl TXClkPin < T > > ,
298
- mdio : Peri < ' d , impl MDIOPin < T > > ,
299
- mdc : Peri < ' d , impl MDCPin < T > > ,
300
- rxdv : Peri < ' d , impl RXDVPin < T > > ,
301
- rx_d0 : Peri < ' d , impl RXD0Pin < T > > ,
302
- rx_d1 : Peri < ' d , impl RXD1Pin < T > > ,
303
- rx_d2 : Peri < ' d , impl RXD2Pin < T > > ,
304
- rx_d3 : Peri < ' d , impl RXD3Pin < T > > ,
305
- tx_d0 : Peri < ' d , impl TXD0Pin < T > > ,
306
- tx_d1 : Peri < ' d , impl TXD1Pin < T > > ,
307
- tx_d2 : Peri < ' d , impl TXD2Pin < T > > ,
308
- tx_d3 : Peri < ' d , impl TXD3Pin < T > > ,
309
- tx_en : Peri < ' d , impl TXEnPin < T > > ,
296
+ rx_clk : Peri < ' d , if_afio ! ( impl RXClkPin <T , A > ) > ,
297
+ tx_clk : Peri < ' d , if_afio ! ( impl TXClkPin <T , A > ) > ,
298
+ mdio : Peri < ' d , if_afio ! ( impl MDIOPin <T , A > ) > ,
299
+ mdc : Peri < ' d , if_afio ! ( impl MDCPin <T , A > ) > ,
300
+ rxdv : Peri < ' d , if_afio ! ( impl RXDVPin <T , A > ) > ,
301
+ rx_d0 : Peri < ' d , if_afio ! ( impl RXD0Pin <T , A > ) > ,
302
+ rx_d1 : Peri < ' d , if_afio ! ( impl RXD1Pin <T , A > ) > ,
303
+ rx_d2 : Peri < ' d , if_afio ! ( impl RXD2Pin <T , A > ) > ,
304
+ rx_d3 : Peri < ' d , if_afio ! ( impl RXD3Pin <T , A > ) > ,
305
+ tx_d0 : Peri < ' d , if_afio ! ( impl TXD0Pin <T , A > ) > ,
306
+ tx_d1 : Peri < ' d , if_afio ! ( impl TXD1Pin <T , A > ) > ,
307
+ tx_d2 : Peri < ' d , if_afio ! ( impl TXD2Pin <T , A > ) > ,
308
+ tx_d3 : Peri < ' d , if_afio ! ( impl TXD3Pin <T , A > ) > ,
309
+ tx_en : Peri < ' d , if_afio ! ( impl TXEnPin <T , A > ) > ,
310
310
phy : P ,
311
311
mac_addr : [ u8 ; 6 ] ,
312
312
) -> Self {
0 commit comments