diff --git a/Cargo.toml b/Cargo.toml index 3d86b127..813c0c49 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -59,9 +59,9 @@ embedded-hal-async = { version = "1.0.0-rc.1" } # patching esp32c6-hal for BLE - it would compile with 0.5.0 but not work [patch.crates-io] -esp32c2-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "2d2561024f5c40c91687397c7bb884a4271b4022" } -esp32c3-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "2d2561024f5c40c91687397c7bb884a4271b4022" } -esp32-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "2d2561024f5c40c91687397c7bb884a4271b4022" } -esp32s2-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "2d2561024f5c40c91687397c7bb884a4271b4022" } -esp32s3-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "2d2561024f5c40c91687397c7bb884a4271b4022" } -esp-hal-common = { git = "https://github.com/esp-rs/esp-hal.git", rev = "2d2561024f5c40c91687397c7bb884a4271b4022" } +esp32c2-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "9cb8f7e941fd62f5ec1d46ee0dd9e8b2b2675872" } +esp32c3-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "9cb8f7e941fd62f5ec1d46ee0dd9e8b2b2675872" } +esp32-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "9cb8f7e941fd62f5ec1d46ee0dd9e8b2b2675872" } +esp32s2-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "9cb8f7e941fd62f5ec1d46ee0dd9e8b2b2675872" } +esp32s3-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "9cb8f7e941fd62f5ec1d46ee0dd9e8b2b2675872" } +esp-hal-common = { git = "https://github.com/esp-rs/esp-hal.git", rev = "9cb8f7e941fd62f5ec1d46ee0dd9e8b2b2675872" } diff --git a/esp-wifi/examples/access_point.rs b/esp-wifi/examples/access_point.rs index c9dc9395..36e88a11 100644 --- a/esp-wifi/examples/access_point.rs +++ b/esp-wifi/examples/access_point.rs @@ -47,7 +47,7 @@ fn main() -> ! { ) .unwrap(); - let (wifi, ..) = peripherals.RADIO.split(); + let wifi = peripherals.WIFI; let mut socket_set_entries: [SocketStorage; 3] = Default::default(); let (iface, device, mut controller, sockets) = create_network_interface(&init, wifi, WifiMode::Ap, &mut socket_set_entries).unwrap(); diff --git a/esp-wifi/examples/async_ble.rs b/esp-wifi/examples/async_ble.rs index ebaeb62a..3cfab4db 100644 --- a/esp-wifi/examples/async_ble.rs +++ b/esp-wifi/examples/async_ble.rs @@ -26,13 +26,14 @@ use esp_wifi::{ mod examples_util; use examples_util::hal; use examples_util::BootButton; -use hal::{ - clock::ClockControl, embassy, peripherals::*, prelude::*, radio::Bluetooth, timer::TimerGroup, - Rng, IO, -}; +use hal::{clock::ClockControl, embassy, peripherals::*, prelude::*, timer::TimerGroup, Rng, IO}; #[embassy_executor::task] -async fn run(init: EspWifiInitialization, mut bluetooth: Bluetooth, pin: BootButton) { +async fn run( + init: EspWifiInitialization, + mut bluetooth: crate::hal::peripherals::BT, + pin: BootButton, +) { let connector = BleConnector::new(&init, &mut bluetooth); let mut ble = Ble::new(connector, esp_wifi::current_millis); println!("Connector created"); @@ -160,7 +161,7 @@ fn main() -> ! { ) .unwrap(); - let (_, bluetooth, ..) = peripherals.RADIO.split(); + let bluetooth = peripherals.BT; let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); embassy::init(&clocks, timer_group0.timer0); diff --git a/esp-wifi/examples/ble.rs b/esp-wifi/examples/ble.rs index 783ee674..98be8d44 100644 --- a/esp-wifi/examples/ble.rs +++ b/esp-wifi/examples/ble.rs @@ -47,7 +47,7 @@ fn main() -> ! { let mut debounce_cnt = 500; - let (_, mut bluetooth, ..) = peripherals.RADIO.split(); + let mut bluetooth = peripherals.BT; loop { let connector = BleConnector::new(&init, &mut bluetooth); diff --git a/esp-wifi/examples/dhcp.rs b/esp-wifi/examples/dhcp.rs index b304486e..5f39eb14 100644 --- a/esp-wifi/examples/dhcp.rs +++ b/esp-wifi/examples/dhcp.rs @@ -48,7 +48,7 @@ fn main() -> ! { ) .unwrap(); - let (wifi, ..) = peripherals.RADIO.split(); + let wifi = peripherals.WIFI; let mut socket_set_entries: [SocketStorage; 3] = Default::default(); let (iface, device, mut controller, sockets) = create_network_interface(&init, wifi, WifiMode::Sta, &mut socket_set_entries).unwrap(); diff --git a/esp-wifi/examples/embassy_access_point.rs b/esp-wifi/examples/embassy_access_point.rs index c5b8a5d4..941edfb3 100644 --- a/esp-wifi/examples/embassy_access_point.rs +++ b/esp-wifi/examples/embassy_access_point.rs @@ -59,7 +59,7 @@ fn main() -> ! { ) .unwrap(); - let (wifi, ..) = peripherals.RADIO.split(); + let wifi = peripherals.WIFI; let (wifi_interface, controller) = esp_wifi::wifi::new_with_mode(&init, wifi, WifiMode::Ap).unwrap(); diff --git a/esp-wifi/examples/embassy_dhcp.rs b/esp-wifi/examples/embassy_dhcp.rs index e34eadb9..95796cd8 100644 --- a/esp-wifi/examples/embassy_dhcp.rs +++ b/esp-wifi/examples/embassy_dhcp.rs @@ -57,7 +57,7 @@ fn main() -> ! { ) .unwrap(); - let (wifi, ..) = peripherals.RADIO.split(); + let wifi = peripherals.WIFI; let (wifi_interface, controller) = esp_wifi::wifi::new_with_mode(&init, wifi, WifiMode::Sta).unwrap(); diff --git a/esp-wifi/examples/embassy_esp_now.rs b/esp-wifi/examples/embassy_esp_now.rs index ff01a774..1e53e29b 100644 --- a/esp-wifi/examples/embassy_esp_now.rs +++ b/esp-wifi/examples/embassy_esp_now.rs @@ -78,7 +78,7 @@ fn main() -> ! { ) .unwrap(); - let (wifi, ..) = peripherals.RADIO.split(); + let wifi = peripherals.WIFI; let esp_now = esp_wifi::esp_now::EspNow::new(&init, wifi).unwrap(); println!("esp-now version {}", esp_now.get_version().unwrap()); diff --git a/esp-wifi/examples/embassy_esp_now_duplex.rs b/esp-wifi/examples/embassy_esp_now_duplex.rs index 2c2e8e48..7fd91ab9 100644 --- a/esp-wifi/examples/embassy_esp_now_duplex.rs +++ b/esp-wifi/examples/embassy_esp_now_duplex.rs @@ -107,7 +107,7 @@ fn main() -> ! { ) .unwrap(); - let (wifi, ..) = peripherals.RADIO.split(); + let wifi = peripherals.WIFI; let esp_now = esp_wifi::esp_now::EspNow::new(&init, wifi).unwrap(); println!("esp-now version {}", esp_now.get_version().unwrap()); diff --git a/esp-wifi/examples/esp_now.rs b/esp-wifi/examples/esp_now.rs index 9977150d..c106d7e1 100644 --- a/esp-wifi/examples/esp_now.rs +++ b/esp-wifi/examples/esp_now.rs @@ -35,7 +35,7 @@ fn main() -> ! { ) .unwrap(); - let (wifi, ..) = peripherals.RADIO.split(); + let wifi = peripherals.WIFI; let mut esp_now = esp_wifi::esp_now::EspNow::new(&init, wifi).unwrap(); println!("esp-now version {}", esp_now.get_version().unwrap()); diff --git a/esp-wifi/examples/static_ip.rs b/esp-wifi/examples/static_ip.rs index 6b12d00f..2f606ea9 100644 --- a/esp-wifi/examples/static_ip.rs +++ b/esp-wifi/examples/static_ip.rs @@ -50,7 +50,7 @@ fn main() -> ! { ) .unwrap(); - let (wifi, ..) = peripherals.RADIO.split(); + let wifi = peripherals.WIFI; let mut socket_set_entries: [SocketStorage; 3] = Default::default(); let (iface, device, mut controller, sockets) = create_network_interface(&init, wifi, WifiMode::Sta, &mut socket_set_entries).unwrap(); diff --git a/esp-wifi/src/ble/controller/mod.rs b/esp-wifi/src/ble/controller/mod.rs index 16648073..f544ba65 100644 --- a/esp-wifi/src/ble/controller/mod.rs +++ b/esp-wifi/src/ble/controller/mod.rs @@ -3,22 +3,19 @@ use embedded_io::{ Error, Io, }; -use crate::hal::{ - peripheral::{Peripheral, PeripheralRef}, - radio, -}; +use crate::hal::peripheral::{Peripheral, PeripheralRef}; use crate::EspWifiInitialization; use super::{read_hci, read_next, send_hci}; pub struct BleConnector<'d> { - _device: PeripheralRef<'d, radio::Bluetooth>, + _device: PeripheralRef<'d, crate::hal::peripherals::BT>, } impl<'d> BleConnector<'d> { pub fn new( init: &EspWifiInitialization, - device: impl Peripheral
+ 'd, + device: impl Peripheral
+ 'd, ) -> BleConnector<'d> { if !init.is_ble() { panic!("Not initialized for BLE use"); @@ -103,13 +100,13 @@ pub mod asynch { } pub struct BleConnector<'d> { - _device: PeripheralRef<'d, crate::hal::radio::Bluetooth>, + _device: PeripheralRef<'d, crate::hal::peripherals::BT>, } impl<'d> BleConnector<'d> { pub fn new( init: &EspWifiInitialization, - device: impl Peripheral
+ 'd, + device: impl Peripheral
+ 'd,
) -> BleConnector<'d> {
if !init.is_ble() {
panic!("Not initialized for BLE use");
diff --git a/esp-wifi/src/ble/os_adapter_esp32c3.rs b/esp-wifi/src/ble/os_adapter_esp32c3.rs
index b18ec865..701a494e 100644
--- a/esp-wifi/src/ble/os_adapter_esp32c3.rs
+++ b/esp-wifi/src/ble/os_adapter_esp32c3.rs
@@ -16,7 +16,7 @@ pub(super) struct osi_funcs_s {
magic: u32,
version: u32,
interrupt_set: Option + 'd,
+ device: impl Peripheral + 'd,
config: embedded_svc::wifi::Configuration,
) -> Result<(WifiDevice<'d>, WifiController<'d>), WifiError> {
if !inited.is_wifi() {
@@ -797,7 +797,7 @@ pub fn new_with_config<'d>(
pub fn new_with_mode<'d>(
inited: &EspWifiInitialization,
- device: impl Peripheral + 'd,
+ device: impl Peripheral + 'd,
mode: WifiMode,
) -> Result<(WifiDevice<'d>, WifiController<'d>), WifiError> {
new_with_config(
@@ -812,11 +812,11 @@ pub fn new_with_mode<'d>(
/// A wifi device implementing smoltcp's Device trait.
pub struct WifiDevice<'d> {
- _device: PeripheralRef<'d, crate::hal::radio::Wifi>,
+ _device: PeripheralRef<'d, crate::hal::peripherals::WIFI>,
}
impl<'d> WifiDevice<'d> {
- pub(crate) fn new(_device: PeripheralRef<'d, crate::hal::radio::Wifi>) -> WifiDevice {
+ pub(crate) fn new(_device: PeripheralRef<'d, crate::hal::peripherals::WIFI>) -> WifiDevice {
Self { _device }
}
@@ -854,13 +854,13 @@ fn convert_ap_info(record: &include::wifi_ap_record_t) -> AccessPointInfo {
/// A wifi controller implementing embedded_svc::Wifi traits
pub struct WifiController<'d> {
- _device: PeripheralRef<'d, crate::hal::radio::Wifi>,
+ _device: PeripheralRef<'d, crate::hal::peripherals::WIFI>,
config: embedded_svc::wifi::Configuration,
}
impl<'d> WifiController<'d> {
pub(crate) fn new_with_config(
- _device: PeripheralRef<'d, crate::hal::radio::Wifi>,
+ _device: PeripheralRef<'d, crate::hal::peripherals::WIFI>,
config: embedded_svc::wifi::Configuration,
) -> Result + 'd,
+ device: impl crate::hal::peripheral::Peripheral + 'd,
mode: WifiMode,
storage: &'a mut [SocketStorage<'a>],
) -> Result<(Interface, WifiDevice<'d>, WifiController<'d>, SocketSet<'a>), WifiError> {