Skip to content

Commit f9811ec

Browse files
Merge pull request #99 from tlevora/smoltcp-0.12.0-upgrade
Upgrade smoltcp to 0.12.0 & release v0.8.0
2 parents af986ea + 4b1cb72 commit f9811ec

File tree

5 files changed

+21
-10
lines changed

5 files changed

+21
-10
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
## Unreleased
22

3+
## [0.8.0](https://github.com/stm32-rs/stm32-eth/tree/v0.8.0)
4+
* Update version of `smoltcp` to `v0.12.0` ([#99])
5+
6+
[#99]: https://github.com/stm32-rs/stm32-eth/pull/99
7+
38
## [0.7.0](https://github.com/stm32-rs/stm32-eth/tree/v0.7.0)
49
* Update hals ([#97])
510
* `stm32f4xx-hal` from `0.20` to `0.21`

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name = "stm32-eth"
44
description = "Embedded Rust Ethernet driver for the STM32 MCU series"
55
license = "Apache-2.0"
66
authors = ["Astro <astro@spaceboyz.net>", "Johannes Draaijer <jcdra1@gmail.com>"]
7-
version = "0.7.0"
7+
version = "0.8.0"
88
keywords = ["ethernet", "eth", "stm32", "stm32f4", "stm32f7"]
99
repository = "https://github.com/stm32-rs/stm32-eth"
1010
documentation = "https://docs.rs/stm32-eth/"
@@ -32,7 +32,7 @@ defmt = { version = "0.3", optional = true }
3232
futures = { version = "0.3", default-features = false, features = ["async-await"], optional = true }
3333

3434
[dependencies.smoltcp]
35-
version = "0.11"
35+
version = "0.12"
3636
default-features = false
3737
optional = true
3838

@@ -73,7 +73,7 @@ fugit = "0.3"
7373
defmt-rtt = "0.4"
7474
panic-probe = { version = "0.3", features = [ "print-defmt" ] }
7575
systick-monotonic = "1.0"
76-
smoltcp = { version = "0.11", features = [ "medium-ethernet", "proto-ipv4", "socket-udp", "socket-tcp", "defmt" ], default-features = false }
76+
smoltcp = { version = "0.12", features = [ "medium-ethernet", "proto-ipv4", "socket-udp", "socket-tcp", "defmt" ], default-features = false }
7777

7878
[dev-dependencies.rtic]
7979
package = "cortex-m-rtic"

examples/smoltcp-timesync/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ mod app {
269269
let packet_id = dma.lock(|dma| dma.next_packet_id()).into();
270270

271271
let mut meta: udp::UdpMetadata = IpEndpoint {
272-
addr: IpAddress::Ipv4(Ipv4Address([10, 0, 0, 1])),
272+
addr: IpAddress::Ipv4(Ipv4Address::new(10, 0, 0, 1)),
273273
port: 1337,
274274
}
275275
.into();

examples/smoltcp-timesync/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ mod app {
231231
let packet_id = dma.lock(|dma| dma.next_packet_id()).into();
232232

233233
let mut meta: udp::UdpMetadata = IpEndpoint {
234-
addr: IpAddress::Ipv4(Ipv4Address([10, 0, 0, 2])),
234+
addr: IpAddress::Ipv4(Ipv4Address::new(10, 0, 0, 2)),
235235
port: 1337,
236236
}
237237
.into();

src/dma/smoltcp_phy.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,14 @@ use smoltcp::time::Instant;
1010

1111
/// Use this Ethernet driver with [smoltcp](https://github.com/smoltcp-rs/smoltcp)
1212
impl<'a, 'rx, 'tx> Device for &'a mut EthernetDMA<'rx, 'tx> {
13-
type RxToken<'token> = EthRxToken<'token, 'rx> where Self: 'token;
14-
type TxToken<'token> = EthTxToken<'token, 'tx> where Self: 'token;
13+
type RxToken<'token>
14+
= EthRxToken<'token, 'rx>
15+
where
16+
Self: 'token;
17+
type TxToken<'token>
18+
= EthTxToken<'token, 'tx>
19+
where
20+
Self: 'token;
1521

1622
fn capabilities(&self) -> DeviceCapabilities {
1723
let mut caps = DeviceCapabilities::default();
@@ -72,7 +78,7 @@ pub struct EthRxToken<'a, 'rx> {
7278
impl<'dma, 'rx> RxToken for EthRxToken<'dma, 'rx> {
7379
fn consume<R, F>(self, f: F) -> R
7480
where
75-
F: FnOnce(&mut [u8]) -> R,
81+
F: FnOnce(&[u8]) -> R,
7682
{
7783
#[cfg(feature = "ptp")]
7884
let meta = Some(self.meta.into());
@@ -81,8 +87,8 @@ impl<'dma, 'rx> RxToken for EthRxToken<'dma, 'rx> {
8187
let meta = None;
8288

8389
// NOTE(unwrap): an `EthRxToken` is only created when `eth.rx_available()`
84-
let mut packet = self.rx_ring.recv_next(meta).ok().unwrap();
85-
let result = f(&mut packet);
90+
let packet = self.rx_ring.recv_next(meta).ok().unwrap();
91+
let result = f(&packet);
8692
packet.free();
8793
result
8894
}

0 commit comments

Comments
 (0)