Skip to content

Commit

Permalink
Update smoltcp requirement from 0.11 to 0.12 (#14)
Browse files Browse the repository at this point in the history
* Update smoltcp requirement from 0.11 to 0.12

Updates the requirements on [smoltcp](https://github.com/smoltcp-rs/smoltcp) to permit the latest version.
- [Release notes](https://github.com/smoltcp-rs/smoltcp/releases)
- [Changelog](https://github.com/smoltcp-rs/smoltcp/blob/main/CHANGELOG.md)
- [Commits](smoltcp-rs/smoltcp@v0.11.0...v0.12.0)

---
updated-dependencies:
- dependency-name: smoltcp
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update OutBuf::read_datagram to be imutable

* Bump examples to smoltcp 0.12

* Bump version due to breaking smoltcp change

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Daniel Kenyon-Jones <[email protected]>
  • Loading branch information
dependabot[bot] and dlkj authored Jan 2, 2025
1 parent 9d1b32a commit 01d9f42
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion examples/rp2040/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 4 additions & 1 deletion examples/rp2040/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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::<dhcpv4::Socket>(dhcp_handle),
Expand Down
4 changes: 2 additions & 2 deletions src/ethernet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ impl<B: UsbBus> OutBuf<'_, B> {

fn read_datagram<R, F>(&mut self, f: F) -> Result<R>
where
F: FnOnce(&mut [u8]) -> R,
F: FnOnce(&[u8]) -> R,
{
if !self.can_read() {
return Err(UsbError::WouldBlock);
Expand Down Expand Up @@ -902,7 +902,7 @@ impl<'a, 'b, B: UsbBus> EthernetRxToken<'a, 'b, B> {
impl<B: UsbBus> phy::RxToken for EthernetRxToken<'_, '_, B> {
fn consume<R, F>(self, f: F) -> R
where
F: FnOnce(&mut [u8]) -> R,
F: FnOnce(&[u8]) -> R,
{
self.ethernet.read_datagram(f).unwrap()
}
Expand Down

0 comments on commit 01d9f42

Please sign in to comment.