Skip to content

Commit

Permalink
Use embassy-net-driver only is esp-wifi, make enet a dev dep (esp-rs#402
Browse files Browse the repository at this point in the history
)

Also bump enet to 0.3
  • Loading branch information
MabezDev authored and bjoernQ committed May 23, 2024
1 parent f5b62e4 commit b4f8dea
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
6 changes: 3 additions & 3 deletions esp-wifi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,13 @@ num-traits = { workspace = true, default-features = false }
esp-wifi-sys = { version = "0.1.0", path = "../esp-wifi-sys" }
embassy-sync = { workspace = true, optional = true }
embassy-futures = { workspace = true, optional = true }
embassy-net = { workspace = true, optional = true }
embassy-net-driver = { workspace = true, optional = true }
toml-cfg.workspace = true
libm.workspace = true
cfg-if.workspace = true
portable-atomic.workspace = true
portable_atomic_enum.workspace = true

# We don't use these directly but we need to enable portable-atomic on them
futures-util.workspace = true
atomic-waker.workspace = true

Expand All @@ -64,6 +63,7 @@ esp-println = { workspace = true, features = ["log"] }
esp-backtrace.workspace = true
embassy-executor.workspace = true
embassy-time.workspace = true
embassy-net.workspace = true
bleps = { workspace = true, features = ["async"] }
embedded-hal-async.workspace = true
log.workspace = true
Expand Down Expand Up @@ -102,7 +102,7 @@ async = [
"esp32s3-hal?/async",
]

embassy-net = ["dep:embassy-net", "async"]
embassy-net = ["dep:embassy-net-driver", "async"]

# misc features
coex = []
Expand Down
1 change: 0 additions & 1 deletion esp-wifi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#![cfg_attr(target_arch = "xtensa", feature(asm_experimental_arch))]
#![feature(c_variadic)]
#![feature(linkage)]
#![cfg_attr(feature = "async", feature(async_fn_in_trait))]
#![cfg_attr(feature = "async", allow(incomplete_features))]
#![doc = include_str!("../README.md")]
#![doc(html_logo_url = "https://avatars.githubusercontent.com/u/46717278")]
Expand Down
18 changes: 9 additions & 9 deletions esp-wifi/src/wifi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ mod sealed {
fn register_link_state_waker(self, cx: &mut core::task::Context);

#[cfg(feature = "embassy-net")]
fn link_state(self) -> embassy_net::driver::LinkState;
fn link_state(self) -> embassy_net_driver::LinkState;
}

impl Sealed for WifiStaDevice {
Expand Down Expand Up @@ -1122,11 +1122,11 @@ mod sealed {
}

#[cfg(feature = "embassy-net")]
fn link_state(self) -> embassy_net::driver::LinkState {
fn link_state(self) -> embassy_net_driver::LinkState {
if matches!(get_sta_state(), WifiState::StaConnected) {
embassy_net::driver::LinkState::Up
embassy_net_driver::LinkState::Up
} else {
embassy_net::driver::LinkState::Down
embassy_net_driver::LinkState::Down
}
}
}
Expand Down Expand Up @@ -1164,11 +1164,11 @@ mod sealed {
}

#[cfg(feature = "embassy-net")]
fn link_state(self) -> embassy_net::driver::LinkState {
fn link_state(self) -> embassy_net_driver::LinkState {
if matches!(get_ap_state(), WifiState::ApStarted) {
embassy_net::driver::LinkState::Up
embassy_net_driver::LinkState::Up
} else {
embassy_net::driver::LinkState::Down
embassy_net_driver::LinkState::Down
}
}
}
Expand Down Expand Up @@ -1738,7 +1738,7 @@ macro_rules! esp_wifi_result {
#[cfg(feature = "embassy-net")]
pub(crate) mod embassy {
use super::*;
use embassy_net::driver::{Capabilities, Driver, HardwareAddress, RxToken, TxToken};
use embassy_net_driver::{Capabilities, Driver, HardwareAddress, RxToken, TxToken};
use embassy_sync::waitqueue::AtomicWaker;

// We can get away with a single tx waker because the transmit queue is shared
Expand Down Expand Up @@ -1787,7 +1787,7 @@ pub(crate) mod embassy {
self.mode.tx_token()
}

fn link_state(&mut self, cx: &mut core::task::Context) -> embassy_net::driver::LinkState {
fn link_state(&mut self, cx: &mut core::task::Context) -> embassy_net_driver::LinkState {
self.mode.register_link_state_waker(cx);
self.mode.link_state()
}
Expand Down

0 comments on commit b4f8dea

Please sign in to comment.