diff --git a/Cargo.toml b/Cargo.toml index e71a749..af09955 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "usbd-ethernet" -version = "0.2.0" +version = "0.3.0" edition = "2021" description = "Communication Device Class Network Control Model (CDC-NCM) class for usb-device" license = "MIT" @@ -11,7 +11,7 @@ authors = ["Daniel Kenyon-Jones"] homepage = "https://github.com/dlkj/usbd-ethernet" [dependencies] -smoltcp = { version = "0.11", default-features = false, features = [ +smoltcp = { version = "0.12", default-features = false, features = [ "defmt", "proto-ipv4", "medium-ethernet", diff --git a/examples/rp2040/Cargo.toml b/examples/rp2040/Cargo.toml index 47896f7..24cb130 100644 --- a/examples/rp2040/Cargo.toml +++ b/examples/rp2040/Cargo.toml @@ -18,7 +18,7 @@ defmt = "0.3" defmt-rtt = "0.4" panic-probe = { version = "0.3", features = ["print-defmt"] } -smoltcp = { version = "0.11", default-features = false, features = [ +smoltcp = { version = "0.12", default-features = false, features = [ "defmt", "socket-tcp", "socket-dhcpv4", diff --git a/examples/rp2040/src/main.rs b/examples/rp2040/src/main.rs index abd4a89..0e28c9d 100644 --- a/examples/rp2040/src/main.rs +++ b/examples/rp2040/src/main.rs @@ -15,6 +15,7 @@ use hal::{clocks::init_clocks_and_plls, pac, watchdog::Watchdog}; use heapless::Vec; use panic_probe as _; use rp_pico as bsp; +use smoltcp::iface::PollResult; use smoltcp::socket::dhcpv4::RetryConfig; use smoltcp::time::Duration; use smoltcp::wire::DhcpOption; @@ -148,7 +149,9 @@ fn main() -> ! { let timestamp = Instant::from_micros(i64::try_from(timer.get_counter().ticks()).unwrap()); - if interface.poll(timestamp, &mut ethernet, &mut sockets) { + if let PollResult::SocketStateChanged = + interface.poll(timestamp, &mut ethernet, &mut sockets) + { dhcp_poll( &mut interface, sockets.get_mut::(dhcp_handle), diff --git a/src/ethernet.rs b/src/ethernet.rs index 217c703..c2f32e8 100644 --- a/src/ethernet.rs +++ b/src/ethernet.rs @@ -355,7 +355,7 @@ impl OutBuf<'_, B> { fn read_datagram(&mut self, f: F) -> Result where - F: FnOnce(&mut [u8]) -> R, + F: FnOnce(&[u8]) -> R, { if !self.can_read() { return Err(UsbError::WouldBlock); @@ -902,7 +902,7 @@ impl<'a, 'b, B: UsbBus> EthernetRxToken<'a, 'b, B> { impl phy::RxToken for EthernetRxToken<'_, '_, B> { fn consume(self, f: F) -> R where - F: FnOnce(&mut [u8]) -> R, + F: FnOnce(&[u8]) -> R, { self.ethernet.read_datagram(f).unwrap() }