stm32-rs / stm32-eth

Embedded Ethernet driver in Rust
Apache License 2.0
147 stars 47 forks source link

Phystatus with smoltcp #6

Closed MabezDev closed 4 years ago

MabezDev commented 5 years ago

Using this crate with an F2 board (hopefully a PR coming with permission from my employer), working very well so far. One issue problem I've yet to handling is detecting physical disconnects of the ethernet cable, I know its possible with PhyStatus but when using Smoltcp the Eth interface it absorbed.

Just wondering how you have approached this or if you have any suggestions?

MabezDev commented 5 years ago

I've had a bit of time to think about this; I think the simplest way around this problem is to add a split method (name open for discussion) to Eth that returns the Eth along with another struct, lets say EthStatus that can only do read operations (AFAIK there are no side effects from reading the phy registers.). This way we can let smoltcp take over the eth interface but still keep a method of seeing the PhyStatus.

If you are okay with this approach, I'd be happy to submit a PR.