Skip to content

Commit 9341d79

Browse files
committed
examples: add some more functionality to EthernetPhy
1 parent 1684e8a commit 9341d79

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

examples/common.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,11 @@ pub enum EthernetPhy<M: Miim> {
252252

253253
impl<M: Miim> Phy<M> for EthernetPhy<M> {
254254
fn best_supported_advertisement(&self) -> ieee802_3_miim::AutoNegotiationAdvertisement {
255-
unimplemented!()
255+
match self {
256+
EthernetPhy::LAN8720A(phy) => phy.best_supported_advertisement(),
257+
EthernetPhy::LAN8742A(phy) => phy.best_supported_advertisement(),
258+
EthernetPhy::KSZ8081R(phy) => phy.best_supported_advertisement(),
259+
}
256260
}
257261

258262
fn get_miim(&mut self) -> &mut M {
@@ -309,4 +313,13 @@ impl<M: Miim> EthernetPhy<M> {
309313
}
310314
}
311315
}
316+
317+
#[allow(dead_code)]
318+
pub fn speed(&mut self) -> Option<ieee802_3_miim::phy::PhySpeed> {
319+
match self {
320+
EthernetPhy::LAN8720A(phy) => phy.link_speed(),
321+
EthernetPhy::LAN8742A(phy) => phy.link_speed(),
322+
EthernetPhy::KSZ8081R(phy) => phy.link_speed(),
323+
}
324+
}
312325
}

0 commit comments

Comments
 (0)