Skip to content

Commit

Permalink
Merge pull request #140 from card-io-ecg/wifi
Browse files Browse the repository at this point in the history
The big esp-wifi, embedded-io update
  • Loading branch information
bugadani authored Nov 2, 2023
2 parents 9bb5b41 + 72ff94f commit cb18e8a
Show file tree
Hide file tree
Showing 30 changed files with 103 additions and 131 deletions.
59 changes: 28 additions & 31 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ embedded-graphics = "0.8.0"
embedded-hal = "1.0.0-rc.1"
embedded-hal-async = "1.0.0-rc.1"
embedded-hal-bus = { version = "0.1.0-rc.1", features = ["async"] }
embedded-nal-async = "0.4.0"
embedded-io = { version = "0.4", features = ["async"] }
embedded-nal-async = "0.6.0"
embedded-io = "0.6"
embedded-io-async = "0.6"
embedded-menu = "0.5.2"
embedded-svc = { version = "0.25", default-features = false }
embassy-net = { version = "0.1.0", features = [
embedded-svc = { version = "0.26", default-features = false }
embassy-net = { version = "0.2.1", features = [
"nightly",
"tcp",
"dhcpv4",
"dns",
"unstable-traits",
"medium-ethernet",
] }
embassy-sync = { version = "0.2.0" }
embassy-sync = { version = "0.4.0" }
embassy-executor = { version = "0.3.0", features = [
"nightly",
] }
Expand All @@ -35,15 +35,13 @@ log = { version = "0.4.18", default-features = false, features = [
] }
logger = { path = "logger" }
signal-processing = { path = "signal-processing" }
norfs = { git = "https://github.com/card-io-ecg/norfs.git", rev = "5ae12a8" }
norfs-driver = { git = "https://github.com/card-io-ecg/norfs.git", rev = "5ae12a8" }
norfs-esp32s3 = { git = "https://github.com/card-io-ecg/norfs.git", rev = "5ae12a8" }
norfs = { git = "https://github.com/card-io-ecg/norfs.git", rev = "62cd6ea" }
norfs-driver = { git = "https://github.com/card-io-ecg/norfs.git", rev = "62cd6ea" }
norfs-esp32s3 = { git = "https://github.com/card-io-ecg/norfs.git", rev = "62cd6ea" }
object-chain = "0.1.3"
bad-server = { path = "bad-server" }
defmt = { version = "=0.3.5" }
ufmt = "0.2.0"
slice-string = "0.7.0"
tinyvec = "1.6.0"

smoltcp = { version = "0.10.0", default-features = false, features = [
"dns-max-server-count-2",
Expand All @@ -52,12 +50,12 @@ smoltcp = { version = "0.10.0", default-features = false, features = [
[dependencies]
embassy-futures = { version = "0.1.0" }
embassy-executor = { workspace = true }
embassy-time = { version = "0.1.4", features = ["nightly", "unstable-traits"] }
embassy-time = { version = "0.1.5", features = ["nightly", "unstable-traits"] }

embedded-hal-old = { package = "embedded-hal", version = "0.2.7" }

# esp32s2-hal = { version = "0.10.0", optional = true, features = ["rt", "async", "embassy", "embassy-time-systick", "eh1"] }
esp32s3-hal = { version = "0.12.0", optional = true, features = [
esp32s3-hal = { version = "0.13.0", optional = true, features = [
"rt",
"async",
"embassy",
Expand All @@ -73,8 +71,8 @@ esp-backtrace = { version = "0.9.0", features = [
esp-println = { version = "0.7.0", default-features = false, features = [
"critical-section",
] }
esp-alloc = { version = "0.3.0" }
esp-wifi = { git = "https://github.com/esp-rs/esp-wifi.git", rev = "34b8181", default-features = false, features = [
esp-alloc = "0.3.0"
esp-wifi = { git = "https://github.com/esp-rs/esp-wifi.git", rev = "bd5f611", default-features = false, features = [
"phy-enable-usb",
"ps-max-modem",
"wifi",
Expand Down Expand Up @@ -110,19 +108,20 @@ replace_with = { version = "0.1", default-features = false, features = [
] }
static_cell = { version = "1.2.0", features = ["nightly"] }
bad-server = { path = "bad-server", features = ["embassy"] }
embedded-tls = { version = "0.14.2", default-features = false, features = ["async"] }
reqwless = "0.6.0"
embedded-tls = { version = "0.16.0", default-features = false, features = ["async"] }
reqwless = "0.9.0"

embedded-graphics = { workspace = true }
embedded-hal = { workspace = true }
embedded-hal-async = { workspace = true }
embedded-hal-bus = { workspace = true }
embedded-nal-async = { workspace = true }
embedded-io = { workspace = true }
embedded-menu = { workspace = true }
embedded-svc = { workspace = true }
embassy-net = { workspace = true }
embassy-sync = { workspace = true }
embedded-graphics.workspace = true
embedded-hal.workspace = true
embedded-hal-async.workspace = true
embedded-hal-bus.workspace = true
embedded-nal-async.workspace = true
embedded-io.workspace = true
embedded-io-async.workspace = true
embedded-menu.workspace = true
embedded-svc.workspace = true
embassy-net.workspace = true
embassy-sync.workspace = true

norfs = { workspace = true }
norfs-driver = { workspace = true }
Expand All @@ -132,7 +131,6 @@ norfs-esp32s3 = { workspace = true, optional = true, features = [
heapless = { workspace = true }
object-chain = { workspace = true }
ufmt = { workspace = true }
slice-string = { workspace = true, features = ["ufmt-impl"] }

logger = { workspace = true }
log = { workspace = true, optional = true }
Expand All @@ -144,7 +142,6 @@ enumset = "1.1.3"

[patch.crates-io]
# esp32s3-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "0c8dd59163472133870a62b6248f50953f02defc" }
esp32s3-hal = { git = "https://github.com/bugadani/esp-hal.git", branch = "race" }
# esp-println = { git = "https://github.com/esp-rs/esp-println.git" }
# embedded-text = { git = "https://github.com/embedded-graphics/embedded-text.git" }
# esp32-hal = { path = "../../esp-hal/esp32-hal" }
Expand All @@ -155,10 +152,10 @@ esp32s3-hal = { git = "https://github.com/bugadani/esp-hal.git", branch = "race"
# esp32c6-hal = { path = "../../esp-hal/esp32c6-hal" }
# esp-hal-common = { path = "../../esp-hal/esp-hal-common" }
# esp-hal-procmacros = { path = "../../esp-hal/esp-hal-procmacros" }
embedded-tls = { git = "https://github.com/drogue-iot/embedded-tls.git", branch = "old" }

[patch.'https://github.com/esp-rs/esp-wifi.git']
# esp-wifi = { path = "../esp-wifi/esp-wifi" }
# esp-wifi = { git = "https://github.com/bugadani/esp-wifi.git" }

[features]
default = ["esp32s3", "defmt"]
Expand Down Expand Up @@ -209,7 +206,7 @@ log = [
defmt = [
"dep:defmt",
"norfs/defmt",
"embedded-io/defmt",
"embedded-io/defmt-03",
"embedded-svc/defmt",
"embedded-graphics/defmt",
"esp-println/defmt",
Expand Down
2 changes: 1 addition & 1 deletion bad-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition = "2021"
async-io = { version = "1", optional = true }
defmt = { workspace = true, optional = true }
embassy-net = { workspace = true, optional = true }
embedded-io = { workspace = true }
embedded-io-async = { workspace = true }
embedded-svc = { workspace = true }
heapless = { workspace = true, features = ["ufmt-impl"] }
httparse = { version = "1.8", default-features = false }
Expand Down
8 changes: 5 additions & 3 deletions bad-server/src/connector.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use core::fmt::Debug;

use embedded_io::asynch::{Read, Write};
use embedded_io_async::{Read, Write};

pub trait Connection: Read + Write {
#[cfg(feature = "defmt")]
Expand All @@ -18,8 +18,10 @@ pub trait Connection: Read + Write {
pub mod embassy_net_compat {

use super::*;
use embassy_net::tcp::{AcceptError, TcpSocket};
use smoltcp::wire::IpListenEndpoint;
use embassy_net::{
tcp::{AcceptError, TcpSocket},
IpListenEndpoint,
};

impl<'a> Connection for TcpSocket<'a> {
type AcceptError = AcceptError;
Expand Down
2 changes: 1 addition & 1 deletion bad-server/src/error_handler.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use core::marker::PhantomData;

use embedded_io::asynch::Write;
use embedded_io_async::Write;
use ufmt::uwrite;

use crate::{
Expand Down
13 changes: 5 additions & 8 deletions bad-server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ extern crate logger;

use core::{fmt::Debug, marker::PhantomData};

use embedded_io::{
asynch::{Read, Write as _},
Io,
};
use embedded_io_async::{ErrorType, Read, Write as _};
use httparse::Status;
use object_chain::{Chain, ChainElement, Link};

Expand Down Expand Up @@ -124,23 +121,23 @@ where
}
}

pub enum HandleError<C: Io> {
pub enum HandleError<C: ErrorType> {
Read(ReadError<C>),
Write(C::Error),
TooManyHeaders,
InternalError,
RequestParse(httparse::Error),
}

impl<C: Io> From<ReadError<C>> for HandleError<C> {
impl<C: ErrorType> From<ReadError<C>> for HandleError<C> {
fn from(value: ReadError<C>) -> Self {
HandleError::Read(value)
}
}

impl<C> Debug for HandleError<C>
where
C: Io,
C: ErrorType,
{
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self {
Expand All @@ -156,7 +153,7 @@ where
#[cfg(feature = "defmt")]
impl<C> defmt::Format for HandleError<C>
where
C: Io,
C: ErrorType,
C::Error: defmt::Format,
{
fn format(&self, f: defmt::Formatter) {
Expand Down
8 changes: 4 additions & 4 deletions bad-server/src/request_body.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use embedded_io::{blocking::ReadExactError, Io};
use embedded_io_async::{ErrorType, ReadExactError};
use httparse::Header;

use crate::{connector::Connection, response::ResponseStatus};
Expand Down Expand Up @@ -185,7 +185,7 @@ impl<'buf, 's, C: Connection> ContentLengthReader<'buf, 's, C> {

pub enum ReadError<C>
where
C: Io,
C: ErrorType,
{
Io(C::Error),
Encoding,
Expand All @@ -194,7 +194,7 @@ where

impl<C> core::fmt::Debug for ReadError<C>
where
C: Io,
C: ErrorType,
{
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
match self {
Expand All @@ -208,7 +208,7 @@ where
#[cfg(feature = "defmt")]
impl<C> defmt::Format for ReadError<C>
where
C: Io,
C: ErrorType,
C::Error: defmt::Format,
{
fn format(&self, f: defmt::Formatter) {
Expand Down
4 changes: 2 additions & 2 deletions bad-server/src/response.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use core::marker::PhantomData;

use embedded_io::Io;
use embedded_io_async::ErrorType;
use httparse::Header;
use ufmt::uwrite;

Expand Down Expand Up @@ -131,7 +131,7 @@ impl<'s, C: Connection> Response<'s, C, Headers> {
async fn send<C: Connection>(
socket: &mut C,
header: Header<'_>,
) -> Result<(), <C as Io>::Error> {
) -> Result<(), <C as ErrorType>::Error> {
socket.write_all(header.name.as_bytes()).await?;
socket.write_all(b": ").await?;
socket.write_all(header.value).await?;
Expand Down
4 changes: 2 additions & 2 deletions config-site/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition = "2021"
bad-server = { workspace = true }
defmt = { workspace = true, optional = true }
embassy-sync = { workspace = true, optional = true }
embedded-io = { workspace = true, optional = true }
embedded-io-async = { workspace = true, optional = true }
heapless = { workspace = true }
logger = { workspace = true }
log = { workspace = true, optional = true }
Expand All @@ -30,7 +30,7 @@ smol = "1"

[features]
default = []
embedded = ["dep:norfs", "dep:embassy-sync", "dep:embedded-io", "bad-server/embassy"]
embedded = ["dep:norfs", "dep:embassy-sync", "dep:embedded-io-async", "bad-server/embassy"]
std = ["dep:smol", "bad-server/std"]
log = ["dep:log", "bad-server/log"]
defmt = ["dep:defmt", "bad-server/defmt"]
2 changes: 1 addition & 1 deletion config-site/src/data/network.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[cfg(feature = "embedded")]
use embedded_io::asynch::{Read, Write};
use embedded_io_async::{Read, Write};
#[cfg(feature = "embedded")]
use norfs::storable::{LoadError, Loadable, Storable};

Expand Down
1 change: 1 addition & 0 deletions gui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ embedded-graphics = { workspace = true }
embedded-menu = { workspace = true }
norfs = { workspace = true }
embedded-io = { workspace = true }
embedded-io-async = { workspace = true }
heapless = { workspace = true, features = ["ufmt-impl"] }
embedded-text = "0.6.6"
embedded-layout = "0.4.1"
Expand Down
2 changes: 1 addition & 1 deletion gui/src/widgets/battery_small.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use embedded_graphics::{
text::{renderer::TextRenderer, Alignment, Baseline, Text, TextStyleBuilder},
Drawable,
};
use embedded_io::asynch::{Read, Write};
use embedded_io_async::{Read, Write};
use embedded_layout::prelude::*;
use embedded_menu::items::select::SelectValue;
use norfs::storable::{LoadError, Loadable, Storable};
Expand Down
4 changes: 2 additions & 2 deletions signal-processing/src/buffer.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use core::{convert::Infallible, mem::MaybeUninit, ops::Range};

use embedded_io::{blocking::Read, Io};
use embedded_io::{ErrorType, Read};

pub struct Buffer<T: Copy, const N: usize, const POP: bool> {
write_idx: usize,
Expand Down Expand Up @@ -202,7 +202,7 @@ impl<T: Copy, const N: usize> Buffer<T, N, true> {
}
}

impl<T: Copy, const N: usize> Io for Buffer<T, N, true> {
impl<T: Copy, const N: usize> ErrorType for Buffer<T, N, true> {
type Error = Infallible;
}

Expand Down
2 changes: 1 addition & 1 deletion signal-processing/src/compressing_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use core::{fmt::Debug, slice};

use embedded_io::blocking::{Read, ReadExactError, Write};
use embedded_io::{Read, ReadExactError, Write};

use crate::buffer::Buffer;

Expand Down
2 changes: 1 addition & 1 deletion src/board/config/current.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use config_site::data::network::WifiNetwork;
use embedded_io::asynch::{Read, Write};
use embedded_io_async::{Read, Write};
use gui::widgets::battery_small::BatteryStyle;
use norfs::storable::{LoadError, Loadable, Storable};
use ssd1306::prelude::Brightness;
Expand Down
2 changes: 1 addition & 1 deletion src/board/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub mod types;

pub use current::Config;

use embedded_io::asynch::Read;
use embedded_io_async::Read;
use norfs::storable::{LoadError, Loadable};

const CURRENT_VERSION: u8 = 4;
Expand Down
2 changes: 1 addition & 1 deletion src/board/config/types.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use embedded_io::asynch::{Read, Write};
use embedded_io_async::{Read, Write};
use embedded_menu::SelectValue;
use norfs::storable::{LoadError, Loadable, Storable};

Expand Down
2 changes: 1 addition & 1 deletion src/board/config/v1.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use embedded_io::asynch::Read;
use embedded_io_async::Read;
use gui::widgets::battery_small::BatteryStyle;
use norfs::storable::{LoadError, Loadable};

Expand Down
2 changes: 1 addition & 1 deletion src/board/config/v2.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use config_site::data::network::WifiNetwork;
use embedded_io::asynch::Read;
use embedded_io_async::Read;
use gui::widgets::battery_small::BatteryStyle;
use norfs::storable::{LoadError, Loadable};

Expand Down
2 changes: 1 addition & 1 deletion src/board/config/v3.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use config_site::data::network::WifiNetwork;
use embedded_io::asynch::Read;
use embedded_io_async::Read;
use gui::widgets::battery_small::BatteryStyle;
use norfs::storable::{LoadError, Loadable};

Expand Down
2 changes: 1 addition & 1 deletion src/board/config/v4.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use config_site::data::network::WifiNetwork;
use embedded_io::asynch::Read;
use embedded_io_async::Read;
use gui::widgets::battery_small::BatteryStyle;
use norfs::storable::{LoadError, Loadable};

Expand Down
Loading

0 comments on commit cb18e8a

Please sign in to comment.