@@ -184,7 +184,7 @@ pub trait AlternateVeryHighSpeed {
184
184
fn into_af11_very_high_speed ( self ) ;
185
185
}
186
186
187
- /// A struct that contains all parts required to configure
187
+ /// A struct that contains all peripheral parts required to configure
188
188
/// the ethernet peripheral.
189
189
#[ allow( missing_docs) ]
190
190
pub struct PartsIn {
@@ -195,6 +195,29 @@ pub struct PartsIn {
195
195
pub ptp : ETHERNET_PTP ,
196
196
}
197
197
198
+ #[ cfg( feature = "ptp" ) ]
199
+ impl From < ( ETHERNET_MAC , ETHERNET_MMC , ETHERNET_DMA , ETHERNET_PTP ) > for PartsIn {
200
+ fn from ( value : ( ETHERNET_MAC , ETHERNET_MMC , ETHERNET_DMA , ETHERNET_PTP ) ) -> Self {
201
+ Self {
202
+ mac : value. 0 ,
203
+ mmc : value. 1 ,
204
+ dma : value. 2 ,
205
+ ptp : value. 3 ,
206
+ }
207
+ }
208
+ }
209
+
210
+ #[ cfg( not( feature = "ptp" ) ) ]
211
+ impl From < ( ETHERNET_MAC , ETHERNET_MMC , ETHERNET_DMA ) > for PartsIn {
212
+ fn from ( value : ( ETHERNET_MAC , ETHERNET_MMC , ETHERNET_DMA ) ) -> Self {
213
+ Self {
214
+ mac : value. 0 ,
215
+ mmc : value. 1 ,
216
+ dma : value. 2 ,
217
+ }
218
+ }
219
+ }
220
+
198
221
/// Access to all configured parts of the ethernet peripheral.
199
222
pub struct Parts < ' rx , ' tx , T > {
200
223
/// Access to and control over the ethernet MAC.
@@ -206,6 +229,22 @@ pub struct Parts<'rx, 'tx, T> {
206
229
pub ptp : EthernetPTP ,
207
230
}
208
231
232
+ #[ cfg( feature = "ptp" ) ]
233
+ impl < ' rx , ' tx , T > Parts < ' rx , ' tx , T > {
234
+ /// Split this [`Parts`] into its components.
235
+ pub fn split ( self ) -> ( T , EthernetDMA < ' rx , ' tx > , EthernetPTP ) {
236
+ ( self . mac , self . dma , self . ptp )
237
+ }
238
+ }
239
+
240
+ #[ cfg( not( feature = "ptp" ) ) ]
241
+ impl < ' rx , ' tx , T > Parts < ' rx , ' tx , T > {
242
+ /// Split this [`Parts`] into its components.
243
+ pub fn split ( self ) -> ( T , EthernetDMA < ' rx , ' tx > ) {
244
+ ( self . mac , self . dma )
245
+ }
246
+ }
247
+
209
248
/// A struct that represents a combination of pins to be used
210
249
/// as RMII pins for the ethernet peripheral(s)
211
250
// NOTE(missing_docs): all fields of this struct are self-explanatory
0 commit comments