diff --git a/esp-hal/Cargo.toml b/esp-hal/Cargo.toml index fe7cde90dac..48a6803bb68 100644 --- a/esp-hal/Cargo.toml +++ b/esp-hal/Cargo.toml @@ -54,13 +54,13 @@ xtensa-lx = { version = "0.9.0", optional = true } # IMPORTANT: # Each supported device MUST have its PAC included below along with a # corresponding feature. -esp32 = { git = "https://github.com/esp-rs/esp-pacs", rev = "bf5890e", features = ["critical-section", "rt"], optional = true } -esp32c2 = { git = "https://github.com/esp-rs/esp-pacs", rev = "bf5890e", features = ["critical-section", "rt"], optional = true } -esp32c3 = { git = "https://github.com/esp-rs/esp-pacs", rev = "bf5890e", features = ["critical-section", "rt"], optional = true } -esp32c6 = { git = "https://github.com/esp-rs/esp-pacs", rev = "bf5890e", features = ["critical-section", "rt"], optional = true } -esp32h2 = { git = "https://github.com/esp-rs/esp-pacs", rev = "bf5890e", features = ["critical-section", "rt"], optional = true } -esp32s2 = { git = "https://github.com/esp-rs/esp-pacs", rev = "bf5890e", features = ["critical-section", "rt"], optional = true } -esp32s3 = { git = "https://github.com/esp-rs/esp-pacs", rev = "bf5890e", features = ["critical-section", "rt"], optional = true } +esp32 = { version = "0.33.0", features = ["critical-section", "rt"], optional = true } +esp32c2 = { version = "0.22.0", features = ["critical-section", "rt"], optional = true } +esp32c3 = { version = "0.25.0", features = ["critical-section", "rt"], optional = true } +esp32c6 = { version = "0.16.0", features = ["critical-section", "rt"], optional = true } +esp32h2 = { version = "0.12.0", features = ["critical-section", "rt"], optional = true } +esp32s2 = { version = "0.24.0", features = ["critical-section", "rt"], optional = true } +esp32s3 = { version = "0.28.0", features = ["critical-section", "rt"], optional = true } [target.'cfg(target_arch = "riscv32")'.dependencies] esp-riscv-rt = { version = "0.9.0", path = "../esp-riscv-rt" } diff --git a/esp-hal/src/gpio/lp_io.rs b/esp-hal/src/gpio/lp_io.rs index 327d6963111..8909c756c4d 100644 --- a/esp-hal/src/gpio/lp_io.rs +++ b/esp-hal/src/gpio/lp_io.rs @@ -181,7 +181,7 @@ fn get_pin_reg(pin: u8) -> &'static crate::peripherals::lp_io::GPIO0 { let lp_io = &*crate::peripherals::LP_IO::PTR; let pin_ptr = (lp_io.gpio0().as_ptr()).add(pin as usize); - &*(pin_ptr as *const esp32c6::generic::Reg) + &*(pin_ptr as *const crate::peripherals::lp_io::GPIO0) } } diff --git a/esp-hal/src/gpio/rtc_io.rs b/esp-hal/src/gpio/rtc_io.rs index 83c97dbbe46..423e2b9cee6 100644 --- a/esp-hal/src/gpio/rtc_io.rs +++ b/esp-hal/src/gpio/rtc_io.rs @@ -169,24 +169,13 @@ impl<'d, const PIN: u8> LowPowerOutputOpenDrain<'d, PIN> { } } -#[cfg(esp32s3)] -#[inline(always)] -fn get_pin_reg(pin: u8) -> &'static crate::peripherals::rtc_io::TOUCH_PAD0 { - unsafe { - let rtc_io = &*crate::peripherals::RTC_IO::PTR; - let pin_ptr = (rtc_io.touch_pad0().as_ptr()).add(pin as usize); - - &*(pin_ptr as *const esp32s3::generic::Reg) - } -} - -#[cfg(esp32s2)] +#[cfg(any(esp32s2, esp32s3))] #[inline(always)] fn get_pin_reg(pin: u8) -> &'static crate::peripherals::rtc_io::TOUCH_PAD { unsafe { let rtc_io = &*crate::peripherals::RTC_IO::PTR; let pin_ptr = (rtc_io.touch_pad(0).as_ptr()).add(pin as usize); - &*(pin_ptr as *const esp32s2::generic::Reg) + &*(pin_ptr as *const crate::peripherals::rtc_io::TOUCH_PAD) } } diff --git a/esp-hal/src/soc/esp32s3/gpio.rs b/esp-hal/src/soc/esp32s3/gpio.rs index 5ee417e4e57..0810f29c71d 100644 --- a/esp-hal/src/soc/esp32s3/gpio.rs +++ b/esp-hal/src/soc/esp32s3/gpio.rs @@ -405,21 +405,21 @@ crate::gpio::gpio! { } crate::gpio::analog! { - ( 0, 0, touch_pad0(), mux_sel, fun_sel, fun_ie, rue, rde) - ( 1, 1, touch_pad1(), mux_sel, fun_sel, fun_ie, rue, rde) - ( 2, 2, touch_pad2(), mux_sel, fun_sel, fun_ie, rue, rde) - ( 3, 3, touch_pad3(), mux_sel, fun_sel, fun_ie, rue, rde) - ( 4, 4, touch_pad4(), mux_sel, fun_sel, fun_ie, rue, rde) - ( 5, 5, touch_pad5(), mux_sel, fun_sel, fun_ie, rue, rde) - ( 6, 6, touch_pad6(), mux_sel, fun_sel, fun_ie, rue, rde) - ( 7, 7, touch_pad7(), mux_sel, fun_sel, fun_ie, rue, rde) - ( 8, 8, touch_pad8(), mux_sel, fun_sel, fun_ie, rue, rde) - ( 9, 9, touch_pad9(), mux_sel, fun_sel, fun_ie, rue, rde) - (10, 10, touch_pad10(), mux_sel, fun_sel, fun_ie, rue, rde) - (11, 11, touch_pad11(), mux_sel, fun_sel, fun_ie, rue, rde) - (12, 12, touch_pad12(), mux_sel, fun_sel, fun_ie, rue, rde) - (13, 13, touch_pad13(), mux_sel, fun_sel, fun_ie, rue, rde) - (14, 14, touch_pad14(), mux_sel, fun_sel, fun_ie, rue, rde) + ( 0, 0, touch_pad(0), mux_sel, fun_sel, fun_ie, rue, rde) + ( 1, 1, touch_pad(1), mux_sel, fun_sel, fun_ie, rue, rde) + ( 2, 2, touch_pad(2), mux_sel, fun_sel, fun_ie, rue, rde) + ( 3, 3, touch_pad(3), mux_sel, fun_sel, fun_ie, rue, rde) + ( 4, 4, touch_pad(4), mux_sel, fun_sel, fun_ie, rue, rde) + ( 5, 5, touch_pad(5), mux_sel, fun_sel, fun_ie, rue, rde) + ( 6, 6, touch_pad(6), mux_sel, fun_sel, fun_ie, rue, rde) + ( 7, 7, touch_pad(7), mux_sel, fun_sel, fun_ie, rue, rde) + ( 8, 8, touch_pad(8), mux_sel, fun_sel, fun_ie, rue, rde) + ( 9, 9, touch_pad(9), mux_sel, fun_sel, fun_ie, rue, rde) + (10, 10, touch_pad(10), mux_sel, fun_sel, fun_ie, rue, rde) + (11, 11, touch_pad(11), mux_sel, fun_sel, fun_ie, rue, rde) + (12, 12, touch_pad(12), mux_sel, fun_sel, fun_ie, rue, rde) + (13, 13, touch_pad(13), mux_sel, fun_sel, fun_ie, rue, rde) + (14, 14, touch_pad(14), mux_sel, fun_sel, fun_ie, rue, rde) (15, 15, xtal_32p_pad(), x32p_mux_sel, x32p_fun_sel, x32p_fun_ie, x32p_rue, x32p_rde) (16, 16, xtal_32n_pad(), x32n_mux_sel, x32n_fun_sel, x32n_fun_ie, x32n_rue, x32n_rde) (17, 17, pad_dac1(), pdac1_mux_sel,pdac1_fun_sel,pdac1_fun_ie, pdac1_rue, pdac1_rde) @@ -430,21 +430,21 @@ crate::gpio::analog! { } crate::gpio::rtc_pins! { - ( 0, 0, touch_pad0(), "", touch_pad0_hold, rue, rde) - ( 1, 1, touch_pad1(), "", touch_pad1_hold, rue, rde) - ( 2, 2, touch_pad2(), "", touch_pad2_hold, rue, rde) - ( 3, 3, touch_pad3(), "", touch_pad3_hold, rue, rde) - ( 4, 4, touch_pad4(), "", touch_pad4_hold, rue, rde) - ( 5, 5, touch_pad5(), "", touch_pad5_hold, rue, rde) - ( 6, 6, touch_pad6(), "", touch_pad6_hold, rue, rde) - ( 7, 7, touch_pad7(), "", touch_pad7_hold, rue, rde) - ( 8, 8, touch_pad8(), "", touch_pad8_hold, rue, rde) - ( 9, 9, touch_pad9(), "", touch_pad9_hold, rue, rde) - (10, 10, touch_pad10(), "", touch_pad10_hold, rue, rde) - (11, 11, touch_pad11(), "", touch_pad11_hold, rue, rde) - (12, 12, touch_pad12(), "", touch_pad12_hold, rue, rde) - (13, 13, touch_pad13(), "", touch_pad13_hold, rue, rde) - (14, 14, touch_pad14(), "", touch_pad14_hold, rue, rde) + ( 0, 0, touch_pad(0), "", touch_pad0_hold, rue, rde) + ( 1, 1, touch_pad(1), "", touch_pad1_hold, rue, rde) + ( 2, 2, touch_pad(2), "", touch_pad2_hold, rue, rde) + ( 3, 3, touch_pad(3), "", touch_pad3_hold, rue, rde) + ( 4, 4, touch_pad(4), "", touch_pad4_hold, rue, rde) + ( 5, 5, touch_pad(5), "", touch_pad5_hold, rue, rde) + ( 6, 6, touch_pad(6), "", touch_pad6_hold, rue, rde) + ( 7, 7, touch_pad(7), "", touch_pad7_hold, rue, rde) + ( 8, 8, touch_pad(8), "", touch_pad8_hold, rue, rde) + ( 9, 9, touch_pad(9), "", touch_pad9_hold, rue, rde) + (10, 10, touch_pad(10), "", touch_pad10_hold, rue, rde) + (11, 11, touch_pad(11), "", touch_pad11_hold, rue, rde) + (12, 12, touch_pad(12), "", touch_pad12_hold, rue, rde) + (13, 13, touch_pad(13), "", touch_pad13_hold, rue, rde) + (14, 14, touch_pad(14), "", touch_pad14_hold, rue, rde) (15, 15, xtal_32p_pad(), x32p_, x32p_hold, x32p_rue, x32p_rde) (16, 16, xtal_32n_pad(), x32n_, x32n_hold, x32n_rue, x32n_rde) (17, 17, pad_dac1(), pdac1_, pdac1_hold, pdac1_rue, pdac1_rde) diff --git a/esp-hal/src/timer/timg.rs b/esp-hal/src/timer/timg.rs index 4afc5a953dd..6b73e1e247d 100644 --- a/esp-hal/src/timer/timg.rs +++ b/esp-hal/src/timer/timg.rs @@ -482,13 +482,13 @@ where .modify(|_, w| w.level_int_en().set_bit()); self.register_block() - .int_ena_timers() + .int_ena() .modify(|_, w| w.t(self.timer_number()).bit(state)); } fn clear_interrupt(&self) { self.register_block() - .int_clr_timers() + .int_clr() .write(|w| w.t(self.timer_number()).clear_bit_by_one()); } @@ -512,7 +512,7 @@ where fn is_interrupt_set(&self) -> bool { self.register_block() - .int_raw_timers() + .int_raw() .read() .t(self.timer_number()) .bit_is_set() @@ -707,19 +707,19 @@ where .modify(|_, w| w.level_int_en().set_bit()); self.register_block() - .int_ena_timers() + .int_ena() .modify(|_, w| w.t(T).set_bit()); } fn unlisten(&self) { self.register_block() - .int_ena_timers() + .int_ena() .modify(|_, w| w.t(T).clear_bit()); } fn clear_interrupt(&self) { self.register_block() - .int_clr_timers() + .int_clr() .write(|w| w.t(T).clear_bit_by_one()); } @@ -752,11 +752,7 @@ where } fn is_interrupt_set(&self) -> bool { - self.register_block() - .int_raw_timers() - .read() - .t(T) - .bit_is_set() + self.register_block().int_raw().read().t(T).bit_is_set() } fn set_divider(&self, divider: u16) { diff --git a/esp-hal/src/uart.rs b/esp-hal/src/uart.rs index 7e61755db1c..c06aa380e15 100644 --- a/esp-hal/src/uart.rs +++ b/esp-hal/src/uart.rs @@ -125,10 +125,7 @@ use crate::{ gpio::{InputPin, InputSignal, OutputPin, OutputSignal}, interrupt::InterruptHandler, peripheral::Peripheral, - peripherals::{ - uart0::{fifo::FIFO_SPEC, RegisterBlock}, - Interrupt, - }, + peripherals::{uart0::RegisterBlock, Interrupt}, private::Internal, system::PeripheralClockControl, Blocking, @@ -654,7 +651,7 @@ where if T::get_rx_fifo_count() > 0 { let value = unsafe { let fifo = (T::register_block().fifo().as_ptr() as *mut u8).offset(offset) - as *mut crate::peripherals::generic::Reg; + as *mut crate::peripherals::uart0::FIFO; (*fifo).read().rxfifo_rd_byte().bits() }; @@ -674,7 +671,7 @@ where while T::get_rx_fifo_count() > 0 && count < buf.len() { let value = unsafe { let fifo = (T::register_block().fifo().as_ptr() as *mut u8).offset(offset) - as *mut crate::peripherals::generic::Reg; + as *mut crate::peripherals::uart0::FIFO; (*fifo).read().rxfifo_rd_byte().bits() }; buf[count] = value;