diff options
| author | Ruben De Smet <[email protected]> | 2023-07-28 16:19:24 +0200 |
|---|---|---|
| committer | Ruben De Smet <[email protected]> | 2023-07-28 16:40:15 +0200 |
| commit | 69c0a89aa5d52e048fdd8ddc5d47b767da07e88b (patch) | |
| tree | e8eb364418ae00d46f2b4163b6c0bd8fff6306fc /embassy-net-driver/src/lib.rs | |
| parent | c3ba08ffb6570589726db44d40ba5b724a8950d4 (diff) | |
Use HardwareAddress in Driver
Diffstat (limited to 'embassy-net-driver/src/lib.rs')
| -rw-r--r-- | embassy-net-driver/src/lib.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/embassy-net-driver/src/lib.rs b/embassy-net-driver/src/lib.rs index beb1a1c79..93a02e46c 100644 --- a/embassy-net-driver/src/lib.rs +++ b/embassy-net-driver/src/lib.rs | |||
| @@ -4,6 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | use core::task::Context; | 5 | use core::task::Context; |
| 6 | 6 | ||
| 7 | use smoltcp::wire::HardwareAddress; | ||
| 8 | |||
| 7 | /// Main `embassy-net` driver API. | 9 | /// Main `embassy-net` driver API. |
| 8 | /// | 10 | /// |
| 9 | /// This is essentially an interface for sending and receiving raw network frames. | 11 | /// This is essentially an interface for sending and receiving raw network frames. |
| @@ -51,11 +53,8 @@ pub trait Driver { | |||
| 51 | /// Get a description of device capabilities. | 53 | /// Get a description of device capabilities. |
| 52 | fn capabilities(&self) -> Capabilities; | 54 | fn capabilities(&self) -> Capabilities; |
| 53 | 55 | ||
| 54 | /// Get the device's Ethernet address. | 56 | /// Get the device's hardware address. |
| 55 | fn ethernet_address(&self) -> [u8; 6]; | 57 | fn hardware_address(&self) -> HardwareAddress; |
| 56 | |||
| 57 | /// Get the device's IEEE 802.15.4 address. | ||
| 58 | fn ieee802154_address(&self) -> [u8; 8]; | ||
| 59 | } | 58 | } |
| 60 | 59 | ||
| 61 | impl<T: ?Sized + Driver> Driver for &mut T { | 60 | impl<T: ?Sized + Driver> Driver for &mut T { |
| @@ -78,11 +77,8 @@ impl<T: ?Sized + Driver> Driver for &mut T { | |||
| 78 | fn link_state(&mut self, cx: &mut Context) -> LinkState { | 77 | fn link_state(&mut self, cx: &mut Context) -> LinkState { |
| 79 | T::link_state(self, cx) | 78 | T::link_state(self, cx) |
| 80 | } | 79 | } |
| 81 | fn ethernet_address(&self) -> [u8; 6] { | 80 | fn hardware_address(&self) -> HardwareAddress { |
| 82 | T::ethernet_address(self) | 81 | T::hardware_address(self) |
| 83 | } | ||
| 84 | fn ieee802154_address(&self) -> [u8; 8] { | ||
| 85 | T::ieee802154_address(self) | ||
| 86 | } | 82 | } |
| 87 | } | 83 | } |
| 88 | 84 | ||
