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, - interrupt_clear: Option, + clear_interrupt: Option, interrupt_handler_set: Option, interrupt_disable: Option, interrupt_enable: Option, @@ -81,7 +81,7 @@ pub(super) static G_OSI_FUNCS: osi_funcs_s = osi_funcs_s { magic: 0xfadebead, version: 0x00010006, interrupt_set: Some(ble_os_adapter_chip_specific::interrupt_set), - interrupt_clear: Some(ble_os_adapter_chip_specific::interrupt_clear), + clear_interrupt: Some(ble_os_adapter_chip_specific::clear_interrupt), interrupt_handler_set: Some(ble_os_adapter_chip_specific::interrupt_handler_set), interrupt_disable: Some(interrupt_disable), interrupt_enable: Some(interrupt_enable), @@ -222,7 +222,7 @@ pub(crate) unsafe extern "C" fn interrupt_set( // NO-OP } -pub(crate) unsafe extern "C" fn interrupt_clear(_interrupt_source: i32, _interrupt_no: i32) { +pub(crate) unsafe extern "C" fn clear_interrupt(_interrupt_source: i32, _interrupt_no: i32) { todo!(); } diff --git a/esp-wifi/src/ble/os_adapter_esp32s3.rs b/esp-wifi/src/ble/os_adapter_esp32s3.rs index 4ff0a1ae..17f3aa28 100644 --- a/esp-wifi/src/ble/os_adapter_esp32s3.rs +++ b/esp-wifi/src/ble/os_adapter_esp32s3.rs @@ -16,7 +16,7 @@ pub(super) struct osi_funcs_s { magic: u32, version: u32, interrupt_set: Option, - interrupt_clear: Option, + clear_interrupt: Option, interrupt_handler_set: Option, interrupt_disable: Option, interrupt_enable: Option, @@ -81,7 +81,7 @@ pub(super) static G_OSI_FUNCS: osi_funcs_s = osi_funcs_s { magic: 0xfadebead, version: 0x00010006, interrupt_set: Some(ble_os_adapter_chip_specific::interrupt_set), - interrupt_clear: Some(ble_os_adapter_chip_specific::interrupt_clear), + clear_interrupt: Some(ble_os_adapter_chip_specific::clear_interrupt), interrupt_handler_set: Some(ble_os_adapter_chip_specific::interrupt_handler_set), interrupt_disable: Some(interrupt_disable), interrupt_enable: Some(interrupt_enable), @@ -216,7 +216,7 @@ pub(crate) unsafe extern "C" fn interrupt_set( ); } -pub(crate) unsafe extern "C" fn interrupt_clear(_interrupt_source: i32, _interrupt_no: i32) { +pub(crate) unsafe extern "C" fn clear_interrupt(_interrupt_source: i32, _interrupt_no: i32) { todo!(); } diff --git a/esp-wifi/src/esp_now/mod.rs b/esp-wifi/src/esp_now/mod.rs index 2a6b45f2..c3c9e8c0 100644 --- a/esp-wifi/src/esp_now/mod.rs +++ b/esp-wifi/src/esp_now/mod.rs @@ -263,8 +263,8 @@ pub struct EspNowWithWifiCreateToken { } pub fn enable_esp_now_with_wifi( - device: crate::hal::radio::Wifi, -) -> (crate::hal::radio::Wifi, EspNowWithWifiCreateToken) { + device: crate::hal::peripherals::WIFI, +) -> (crate::hal::peripherals::WIFI, EspNowWithWifiCreateToken) { (device, EspNowWithWifiCreateToken { _private: () }) } diff --git a/esp-wifi/src/timer/riscv.rs b/esp-wifi/src/timer/riscv.rs index 6184536a..fe712f70 100644 --- a/esp-wifi/src/timer/riscv.rs +++ b/esp-wifi/src/timer/riscv.rs @@ -30,7 +30,7 @@ static ALARM0: Mutex>>> = Mutex::new(RefCell:: pub fn setup_timer(systimer: TimeBase) { let alarm0 = systimer.into_periodic(); alarm0.set_period(TIMER_DELAY.into_duration()); - alarm0.interrupt_clear(); + alarm0.clear_interrupt(); alarm0.enable_interrupt(true); critical_section::with(|cs| ALARM0.borrow_ref_mut(cs).replace(alarm0)); @@ -58,7 +58,7 @@ pub fn setup_multitasking() { fn SYSTIMER_TARGET0(trap_frame: &mut TrapFrame) { // clear the systimer intr critical_section::with(|cs| { - unwrap!(ALARM0.borrow_ref_mut(cs).as_mut()).interrupt_clear(); + unwrap!(ALARM0.borrow_ref_mut(cs).as_mut()).clear_interrupt(); }); task_switch(trap_frame); @@ -78,7 +78,7 @@ fn FROM_CPU_INTR3(trap_frame: &mut TrapFrame) { let alarm0 = unwrap!(alarm0.as_mut()); alarm0.set_period(TIMER_DELAY.into_duration()); - alarm0.interrupt_clear(); + alarm0.clear_interrupt(); }); task_switch(trap_frame); diff --git a/esp-wifi/src/wifi/mod.rs b/esp-wifi/src/wifi/mod.rs index 1ceb52dd..8dbf5312 100644 --- a/esp-wifi/src/wifi/mod.rs +++ b/esp-wifi/src/wifi/mod.rs @@ -780,7 +780,7 @@ pub fn wifi_start_scan(block: bool) -> i32 { pub fn new_with_config<'d>( inited: &EspWifiInitialization, - device: impl Peripheral

+ '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 { // We set up the controller with the default config because we need to call diff --git a/esp-wifi/src/wifi/utils.rs b/esp-wifi/src/wifi/utils.rs index c5cb3f6a..9fde25bf 100644 --- a/esp-wifi/src/wifi/utils.rs +++ b/esp-wifi/src/wifi/utils.rs @@ -14,7 +14,7 @@ use super::{WifiController, WifiDevice, WifiError, WifiMode}; /// You can use the provided macros to create and pass a suitable backing storage. pub fn create_network_interface<'a, 'd>( inited: &EspWifiInitialization, - device: impl crate::hal::peripheral::Peripheral

+ 'd, + device: impl crate::hal::peripheral::Peripheral

+ 'd, mode: WifiMode, storage: &'a mut [SocketStorage<'a>], ) -> Result<(Interface, WifiDevice<'d>, WifiController<'d>, SocketSet<'a>), WifiError> {