diff options
Diffstat (limited to 'cyw43/src/runner.rs')
| -rw-r--r-- | cyw43/src/runner.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cyw43/src/runner.rs b/cyw43/src/runner.rs index 7c38be24a..7593aef57 100644 --- a/cyw43/src/runner.rs +++ b/cyw43/src/runner.rs | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | use embassy_futures::select::{Either4, select4}; | 1 | use embassy_futures::select::{Either4, select4}; |
| 2 | use embassy_net_driver_channel as ch; | 2 | use embassy_net_driver_channel as ch; |
| 3 | use embassy_net_driver_channel::driver::LinkState; | ||
| 3 | use embassy_time::{Duration, Timer, block_for}; | 4 | use embassy_time::{Duration, Timer, block_for}; |
| 4 | use embedded_hal_1::digital::OutputPin; | 5 | use embedded_hal_1::digital::OutputPin; |
| 5 | 6 | ||
| @@ -496,6 +497,21 @@ where | |||
| 496 | Bytes(evt_data) | 497 | Bytes(evt_data) |
| 497 | ); | 498 | ); |
| 498 | 499 | ||
| 500 | // Handle LINK event to update link state | ||
| 501 | if evt_type == Event::LINK { | ||
| 502 | if event_packet.msg.status == 0 { | ||
| 503 | if event_packet.msg.flags & 1 != 0 { | ||
| 504 | // Bit 0 set = Link is UP | ||
| 505 | self.ch.set_link_state(LinkState::Up); | ||
| 506 | debug!("Link state: UP"); | ||
| 507 | } else { | ||
| 508 | // Bit 0 clear = Link is DOWN | ||
| 509 | self.ch.set_link_state(LinkState::Down); | ||
| 510 | debug!("Link state: DOWN"); | ||
| 511 | } | ||
| 512 | } | ||
| 513 | } | ||
| 514 | |||
| 499 | if self.events.mask.is_enabled(evt_type) { | 515 | if self.events.mask.is_enabled(evt_type) { |
| 500 | let status = event_packet.msg.status; | 516 | let status = event_packet.msg.status; |
| 501 | let event_payload = match evt_type { | 517 | let event_payload = match evt_type { |
