Skip to content

Commit

Permalink
Update embedded-nal-async dependency to 0.8
Browse files Browse the repository at this point in the history
Note that this requires rust v1.77 because this makes use of core::net.
  • Loading branch information
aurelj committed Oct 2, 2024
1 parent bc01808 commit 13be112
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ please refer to the `.vscode/settings.json` file's `rust-analyzer.linkedProjects

## Minimum supported Rust version (MSRV)

Embassy is guaranteed to compile on stable Rust 1.75 and up. It *might*
Embassy is guaranteed to compile on stable Rust 1.77 and up. It *might*
compile with older versions but that may change in any new patch release.

## Why the name?
Expand Down
2 changes: 2 additions & 0 deletions embassy-net/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

- update embedded-nal-async

## 0.4 - 2024-01-11

- Update to `embassy-time` v0.3.
Expand Down
2 changes: 1 addition & 1 deletion embassy-net/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@ embedded-io-async = { version = "0.6.1" }

managed = { version = "0.8.0", default-features = false, features = [ "map" ] }
heapless = { version = "0.8", default-features = false }
embedded-nal-async = { version = "0.7.1" }
embedded-nal-async = { version = "0.8.0" }
document-features = "0.2.7"
11 changes: 4 additions & 7 deletions embassy-net/src/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//! Prefer using [`Stack::dns_query`](crate::Stack::dns_query) directly if you're
//! not using `embedded-nal-async`.

use core::net::IpAddr;
use heapless::Vec;
pub use smoltcp::socket::dns::{DnsQuery, Socket};
pub(crate) use smoltcp::socket::dns::{GetQueryResultError, StartQueryError};
Expand Down Expand Up @@ -73,8 +74,8 @@ impl<'a> embedded_nal_async::Dns for DnsSocket<'a> {
&self,
host: &str,
addr_type: embedded_nal_async::AddrType,
) -> Result<embedded_nal_async::IpAddr, Self::Error> {
use embedded_nal_async::{AddrType, IpAddr};
) -> Result<IpAddr, Self::Error> {
use embedded_nal_async::AddrType;
let (qtype, secondary_qtype) = match addr_type {
AddrType::IPv4 => (DnsQueryType::A, None),
AddrType::IPv6 => (DnsQueryType::Aaaa, None),
Expand Down Expand Up @@ -107,11 +108,7 @@ impl<'a> embedded_nal_async::Dns for DnsSocket<'a> {
}
}

async fn get_host_by_address(
&self,
_addr: embedded_nal_async::IpAddr,
_result: &mut [u8],
) -> Result<usize, Self::Error> {
async fn get_host_by_address(&self, _addr: IpAddr, _result: &mut [u8]) -> Result<usize, Self::Error> {
todo!()
}
}
Expand Down
8 changes: 2 additions & 6 deletions embassy-net/src/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -675,10 +675,9 @@ mod embedded_io_impls {
pub mod client {
use core::cell::{Cell, UnsafeCell};
use core::mem::MaybeUninit;
use core::net::{IpAddr, SocketAddr};
use core::ptr::NonNull;

use embedded_nal_async::IpAddr;

use super::*;

/// TCP client connection pool compatible with `embedded-nal-async` traits.
Expand Down Expand Up @@ -715,10 +714,7 @@ pub mod client {
type Error = Error;
type Connection<'m> = TcpConnection<'m, N, TX_SZ, RX_SZ> where Self: 'm;

async fn connect<'a>(
&'a self,
remote: embedded_nal_async::SocketAddr,
) -> Result<Self::Connection<'a>, Self::Error> {
async fn connect<'a>(&'a self, remote: SocketAddr) -> Result<Self::Connection<'a>, Self::Error> {
let addr: crate::IpAddress = match remote.ip() {
#[cfg(feature = "proto-ipv4")]
IpAddr::V4(addr) => crate::IpAddress::Ipv4(crate::Ipv4Address::from_bytes(&addr.octets())),
Expand Down
2 changes: 1 addition & 1 deletion examples/stm32h5/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ embedded-hal = "0.2.6"
embedded-hal-1 = { package = "embedded-hal", version = "1.0" }
embedded-hal-async = { version = "1.0" }
embedded-io-async = { version = "0.6.1" }
embedded-nal-async = { version = "0.7.1" }
embedded-nal-async = { version = "0.8.0" }
panic-probe = { version = "0.3", features = ["print-defmt"] }
heapless = { version = "0.8", default-features = false }
rand_core = "0.6.3"
Expand Down
2 changes: 1 addition & 1 deletion examples/stm32h7/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cortex-m-rt = "0.7.0"
embedded-hal = "0.2.6"
embedded-hal-1 = { package = "embedded-hal", version = "1.0" }
embedded-hal-async = { version = "1.0" }
embedded-nal-async = { version = "0.7.1" }
embedded-nal-async = { version = "0.8.0" }
embedded-io-async = { version = "0.6.1" }
panic-probe = { version = "0.3", features = ["print-defmt"] }
heapless = { version = "0.8", default-features = false }
Expand Down
3 changes: 2 additions & 1 deletion examples/stm32h7/src/bin/eth_client.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![no_std]
#![no_main]

use core::net::{Ipv4Addr, SocketAddr, SocketAddrV4};
use defmt::*;
use embassy_executor::Spawner;
use embassy_net::tcp::client::{TcpClient, TcpClientState};
Expand All @@ -12,7 +13,7 @@ use embassy_stm32::rng::Rng;
use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config};
use embassy_time::Timer;
use embedded_io_async::Write;
use embedded_nal_async::{Ipv4Addr, SocketAddr, SocketAddrV4, TcpConnect};
use embedded_nal_async::TcpConnect;
use rand_core::RngCore;
use static_cell::StaticCell;
use {defmt_rtt as _, panic_probe as _};
Expand Down
3 changes: 2 additions & 1 deletion examples/stm32h7/src/bin/eth_client_mii.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![no_std]
#![no_main]

use core::net::{Ipv4Addr, SocketAddr, SocketAddrV4};
use defmt::*;
use embassy_executor::Spawner;
use embassy_net::tcp::client::{TcpClient, TcpClientState};
Expand All @@ -12,7 +13,7 @@ use embassy_stm32::rng::Rng;
use embassy_stm32::{bind_interrupts, eth, peripherals, rng, Config};
use embassy_time::Timer;
use embedded_io_async::Write;
use embedded_nal_async::{Ipv4Addr, SocketAddr, SocketAddrV4, TcpConnect};
use embedded_nal_async::TcpConnect;
use rand_core::RngCore;
use static_cell::StaticCell;
use {defmt_rtt as _, panic_probe as _};
Expand Down
2 changes: 1 addition & 1 deletion examples/stm32h755cm4/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cortex-m-rt = "0.7.0"
embedded-hal = "0.2.6"
embedded-hal-1 = { package = "embedded-hal", version = "1.0" }
embedded-hal-async = { version = "1.0" }
embedded-nal-async = { version = "0.7.1" }
embedded-nal-async = { version = "0.8.0" }
embedded-io-async = { version = "0.6.1" }
panic-probe = { version = "0.3", features = ["print-defmt"] }
heapless = { version = "0.8", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion examples/stm32h755cm7/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cortex-m-rt = "0.7.0"
embedded-hal = "0.2.6"
embedded-hal-1 = { package = "embedded-hal", version = "1.0" }
embedded-hal-async = { version = "1.0" }
embedded-nal-async = { version = "0.7.1" }
embedded-nal-async = { version = "0.8.0" }
embedded-io-async = { version = "0.6.1" }
panic-probe = { version = "0.3", features = ["print-defmt"] }
heapless = { version = "0.8", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion examples/stm32h7rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ cortex-m-rt = "0.7.0"
embedded-hal = "0.2.6"
embedded-hal-1 = { package = "embedded-hal", version = "1.0" }
embedded-hal-async = { version = "1.0" }
embedded-nal-async = { version = "0.7.1" }
embedded-nal-async = { version = "0.8.0" }
embedded-io-async = { version = "0.6.1" }
panic-probe = { version = "0.3", features = ["print-defmt"] }
heapless = { version = "0.8", default-features = false }
Expand Down

0 comments on commit 13be112

Please sign in to comment.