Skip to content

Commit

Permalink
Use embassy-net 0.2
Browse files Browse the repository at this point in the history
Co-Authored-By: Hailey Somerville <[email protected]>
  • Loading branch information
bugadani and haileys committed Oct 18, 2023
1 parent 4b2aa1c commit 5b5b8d1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,11 @@ num-traits = { version = "0.2", default-features = false }
esp-wifi-sys = { version = "0.1.0", path = "../esp-wifi-sys" }
embassy-sync = { version = "0.2.0" }
embassy-futures = { version = "0.1.0" }
embassy-net-driver = { version = "0.1.0" }
toml-cfg = "0.1.3"
libm = "0.2.7"
cfg-if = "1.0.0"

embassy-net = { version = "0.1.0", features = ["nightly", "tcp", "udp", "dhcpv4", "medium-ethernet"] }
embassy-net = { version = "0.2.0", features = ["nightly", "tcp", "udp", "dhcpv4", "medium-ethernet"] }
bleps = { git = "https://github.com/bjoernQ/bleps", package = "bleps", rev = "b82f1e7009bef7e32f0918be5b186188aa5e7109", features = ["macros"] }
embassy-executor = { version = "0.3.0", package = "embassy-executor", features = ["nightly", "executor-thread", "integrated-timers"] }
embassy-time = { version = "0.1.3", features = ["nightly"] }
Expand Down
4 changes: 2 additions & 2 deletions esp-wifi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ 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-driver = { workspace = true, optional = true }
embassy-net = { workspace = true, optional = true }
toml-cfg.workspace = true
libm.workspace = true
cfg-if.workspace = true
Expand Down Expand Up @@ -56,7 +56,7 @@ async = [
"esp32s3-hal?/embassy",
]

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

# misc features
coex = []
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 @@ -1294,7 +1294,7 @@ macro_rules! esp_wifi_result {
#[cfg(feature = "embassy-net")]
pub(crate) mod embassy {
use super::*;
use embassy_net_driver::{Capabilities, Driver, RxToken, TxToken};
use embassy_net::driver::{Capabilities, Driver, HardwareAddress, RxToken, TxToken};
use embassy_sync::waitqueue::AtomicWaker;

pub(crate) static TRANSMIT_WAKER: AtomicWaker = AtomicWaker::new();
Expand Down Expand Up @@ -1352,27 +1352,27 @@ pub(crate) mod embassy {
}
}

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 {
LINK_STATE.register(cx.waker());

match self.get_wifi_mode() {
Ok(WifiMode::Sta) => {
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
}
}
Ok(WifiMode::Ap) => {
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
}
}
_ => {
warn!("Unknown wifi mode in link_state");
embassy_net_driver::LinkState::Down
embassy_net::driver::LinkState::Down
}
}
}
Expand All @@ -1384,14 +1384,14 @@ pub(crate) mod embassy {
caps
}

fn ethernet_address(&self) -> [u8; 6] {
fn hardware_address(&self) -> HardwareAddress {
let mut mac = [0; 6];
match self.get_wifi_mode() {
Ok(WifiMode::Ap) => get_ap_mac(&mut mac),
Ok(WifiMode::Sta) => get_sta_mac(&mut mac),
_ => get_sta_mac(&mut mac),
}
mac
HardwareAddress::Ethernet(mac)
}
}
}
Expand Down

0 comments on commit 5b5b8d1

Please sign in to comment.