diff --git a/esp-hal-embassy/src/executor/thread.rs b/esp-hal-embassy/src/executor/thread.rs index 47d826c6f90..e9f829fdc20 100644 --- a/esp-hal-embassy/src/executor/thread.rs +++ b/esp-hal-embassy/src/executor/thread.rs @@ -5,7 +5,7 @@ use core::marker::PhantomData; use embassy_executor::{raw, Spawner}; use esp_hal::Cpu; #[cfg(multi_core)] -use esp_hal::{interrupt::software::SoftwareInterrupt, macros::handler}; +use esp_hal::{handler, interrupt::software::SoftwareInterrupt}; #[cfg(low_power_wait)] use portable_atomic::{AtomicBool, Ordering}; diff --git a/esp-hal/src/analog/adc/xtensa.rs b/esp-hal/src/analog/adc/xtensa.rs index f92b7406f09..069bc502d11 100644 --- a/esp-hal/src/analog/adc/xtensa.rs +++ b/esp-hal/src/analog/adc/xtensa.rs @@ -234,8 +234,8 @@ impl RegisterAccess for crate::peripherals::ADC1 { fn set_init_code(data: u16) { let [msb, lsb] = data.to_be_bytes(); - crate::regi2c_write_mask!(I2C_SAR_ADC, ADC_SAR1_INITIAL_CODE_HIGH_ADDR, msb as u32); - crate::regi2c_write_mask!(I2C_SAR_ADC, ADC_SAR1_INITIAL_CODE_LOW_ADDR, lsb as u32); + crate::rom::regi2c_write_mask!(I2C_SAR_ADC, ADC_SAR1_INITIAL_CODE_HIGH_ADDR, msb as u32); + crate::rom::regi2c_write_mask!(I2C_SAR_ADC, ADC_SAR1_INITIAL_CODE_LOW_ADDR, lsb as u32); } fn reset() { @@ -257,16 +257,16 @@ impl super::CalibrationAccess for crate::peripherals::ADC1 { const ADC_VAL_MASK: u16 = ADC_VAL_MASK; fn enable_vdef(enable: bool) { - crate::regi2c_write_mask!(I2C_SAR_ADC, ADC_SAR1_DREF_ADDR, enable as u8); + crate::rom::regi2c_write_mask!(I2C_SAR_ADC, ADC_SAR1_DREF_ADDR, enable as u8); } fn connect_cal(source: AdcCalSource, enable: bool) { match source { AdcCalSource::Gnd => { - crate::regi2c_write_mask!(I2C_SAR_ADC, ADC_SAR1_ENCAL_GND_ADDR, enable as u8); + crate::rom::regi2c_write_mask!(I2C_SAR_ADC, ADC_SAR1_ENCAL_GND_ADDR, enable as u8); } AdcCalSource::Ref => { - crate::regi2c_write_mask!(I2C_SAR_ADC, ADC_SARADC1_ENCAL_REF_ADDR, enable as u8); + crate::rom::regi2c_write_mask!(I2C_SAR_ADC, ADC_SARADC1_ENCAL_REF_ADDR, enable as u8); } } } @@ -348,8 +348,8 @@ impl RegisterAccess for crate::peripherals::ADC2 { fn set_init_code(data: u16) { let [msb, lsb] = data.to_be_bytes(); - crate::regi2c_write_mask!(I2C_SAR_ADC, ADC_SAR2_INITIAL_CODE_HIGH_ADDR, msb as u32); - crate::regi2c_write_mask!(I2C_SAR_ADC, ADC_SAR2_INITIAL_CODE_LOW_ADDR, lsb as u32); + crate::rom::regi2c_write_mask!(I2C_SAR_ADC, ADC_SAR2_INITIAL_CODE_HIGH_ADDR, msb as u32); + crate::rom::regi2c_write_mask!(I2C_SAR_ADC, ADC_SAR2_INITIAL_CODE_LOW_ADDR, lsb as u32); } fn reset() { @@ -371,16 +371,16 @@ impl super::CalibrationAccess for crate::peripherals::ADC2 { const ADC_VAL_MASK: u16 = ADC_VAL_MASK; fn enable_vdef(enable: bool) { - crate::regi2c_write_mask!(I2C_SAR_ADC, ADC_SAR2_DREF_ADDR, enable as u8); + crate::rom::regi2c_write_mask!(I2C_SAR_ADC, ADC_SAR2_DREF_ADDR, enable as u8); } fn connect_cal(source: AdcCalSource, enable: bool) { match source { AdcCalSource::Gnd => { - crate::regi2c_write_mask!(I2C_SAR_ADC, ADC_SAR2_ENCAL_GND_ADDR, enable as u8); + crate::rom::regi2c_write_mask!(I2C_SAR_ADC, ADC_SAR2_ENCAL_GND_ADDR, enable as u8); } AdcCalSource::Ref => { - crate::regi2c_write_mask!(I2C_SAR_ADC, ADC_SARADC2_ENCAL_REF_ADDR, enable as u8); + crate::rom::regi2c_write_mask!(I2C_SAR_ADC, ADC_SARADC2_ENCAL_REF_ADDR, enable as u8); } } } diff --git a/esp-hal/src/clock/clocks_ll/esp32.rs b/esp-hal/src/clock/clocks_ll/esp32.rs index 64fe67b2118..5547df5d590 100644 --- a/esp-hal/src/clock/clocks_ll/esp32.rs +++ b/esp-hal/src/clock/clocks_ll/esp32.rs @@ -1,6 +1,6 @@ use crate::{ clock::{Clock, PllClock, XtalClock}, - regi2c_write, + rom::regi2c_write, }; const REF_CLK_FREQ: u32 = 1000000; diff --git a/esp-hal/src/clock/clocks_ll/esp32c2.rs b/esp-hal/src/clock/clocks_ll/esp32c2.rs index 6be34d8920a..1ddd459578f 100644 --- a/esp-hal/src/clock/clocks_ll/esp32c2.rs +++ b/esp-hal/src/clock/clocks_ll/esp32c2.rs @@ -1,7 +1,6 @@ use crate::{ clock::{ApbClock, Clock, CpuClock, PllClock, XtalClock}, - regi2c_write, - regi2c_write_mask, + rom::{regi2c_write, regi2c_write_mask}, }; const I2C_BBPLL: u32 = 0x66; diff --git a/esp-hal/src/clock/clocks_ll/esp32c3.rs b/esp-hal/src/clock/clocks_ll/esp32c3.rs index 264b2568675..6b1186f677e 100644 --- a/esp-hal/src/clock/clocks_ll/esp32c3.rs +++ b/esp-hal/src/clock/clocks_ll/esp32c3.rs @@ -1,7 +1,6 @@ use crate::{ clock::{ApbClock, Clock, CpuClock, PllClock, XtalClock}, - regi2c_write, - regi2c_write_mask, + rom::{regi2c_write, regi2c_write_mask}, }; const I2C_BBPLL: u32 = 0x66; diff --git a/esp-hal/src/dma/gdma.rs b/esp-hal/src/dma/gdma.rs index fb5f0447256..bfafc153cca 100644 --- a/esp-hal/src/dma/gdma.rs +++ b/esp-hal/src/dma/gdma.rs @@ -19,7 +19,7 @@ use critical_section::CriticalSection; use crate::{ dma::*, interrupt::Priority, - macros::handler, + handler, peripheral::{Peripheral, PeripheralRef}, peripherals::Interrupt, }; diff --git a/esp-hal/src/dma/pdma/mod.rs b/esp-hal/src/dma/pdma/mod.rs index 712607fe264..957f2bd61e6 100644 --- a/esp-hal/src/dma/pdma/mod.rs +++ b/esp-hal/src/dma/pdma/mod.rs @@ -18,7 +18,7 @@ use crate::{ asynch::AtomicWaker, dma::*, interrupt::Priority, - macros::handler, + handler, peripheral::{Peripheral, PeripheralRef}, peripherals::Interrupt, }; diff --git a/esp-hal/src/i2c/master/mod.rs b/esp-hal/src/i2c/master/mod.rs index d317c9384c6..44ecd316162 100644 --- a/esp-hal/src/i2c/master/mod.rs +++ b/esp-hal/src/i2c/master/mod.rs @@ -2288,7 +2288,7 @@ macro_rules! instance { ($inst:ident, $peri:ident, $scl:ident, $sda:ident, $interrupt:ident) => { impl Instance for crate::peripherals::$inst { fn parts(&self) -> (&Info, &State) { - #[crate::macros::handler] + #[crate::handler] pub(super) fn irq_handler() { async_handler(&PERIPHERAL, &STATE); } diff --git a/esp-hal/src/lcd_cam/mod.rs b/esp-hal/src/lcd_cam/mod.rs index 52e412471b6..0252f6114f5 100644 --- a/esp-hal/src/lcd_cam/mod.rs +++ b/esp-hal/src/lcd_cam/mod.rs @@ -14,7 +14,7 @@ use crate::{ asynch::AtomicWaker, interrupt::{InterruptConfigurable, InterruptHandler}, lcd_cam::{cam::Cam, lcd::Lcd}, - macros::handler, + handler, peripheral::Peripheral, peripherals::{Interrupt, LCD_CAM}, system::GenericPeripheralGuard, diff --git a/esp-hal/src/lib.rs b/esp-hal/src/lib.rs index 53beb9cac49..ec458674bf0 100644 --- a/esp-hal/src/lib.rs +++ b/esp-hal/src/lib.rs @@ -167,17 +167,10 @@ pub use self::soc::ulp_core; #[cfg(any(dport, hp_sys, pcr, system))] pub mod clock; - -pub mod config; - -#[cfg(any(xtensa, all(riscv, systimer)))] -pub mod delay; #[cfg(gpio)] pub mod gpio; #[cfg(any(i2c0, i2c1))] pub mod i2c; -#[cfg(any(dport, interrupt_core0, interrupt_core1))] -pub mod interrupt; pub mod peripheral; #[cfg(any(hmac, sha))] mod reg_access; @@ -186,13 +179,13 @@ pub mod spi; #[cfg(any(uart0, uart1, uart2))] pub mod uart; -pub mod macros; -pub mod rom; +mod macros; -pub mod debugger; -#[doc(hidden)] -pub mod sync; -pub mod time; +#[cfg(any(lp_core, ulp_riscv_core))] +#[cfg(feature = "unstable")] +#[cfg_attr(docsrs, doc(cfg(feature = "unstable")))] +pub use procmacros::load_lp_code; +pub use procmacros::{handler, ram}; // can't use instability on inline module definitions, see https://github.com/rust-lang/rust/issues/54727 #[doc(hidden)] @@ -225,6 +218,10 @@ unstable_module! { pub mod analog; #[cfg(assist_debug)] pub mod assist_debug; + pub mod config; + pub mod debugger; + #[cfg(any(xtensa, all(riscv, systimer)))] + pub mod delay; #[cfg(any(gdma, pdma))] pub mod dma; #[cfg(ecc)] @@ -235,6 +232,8 @@ unstable_module! { pub mod hmac; #[cfg(any(i2s0, i2s1))] pub mod i2s; + #[cfg(any(dport, interrupt_core0, interrupt_core1))] + pub mod interrupt; #[cfg(lcd_cam)] pub mod lcd_cam; #[cfg(ledc)] @@ -253,14 +252,18 @@ unstable_module! { pub mod rmt; #[cfg(rng)] pub mod rng; + pub mod rom; #[cfg(rsa)] pub mod rsa; #[cfg(any(lp_clkrst, rtc_cntl))] pub mod rtc_cntl; #[cfg(sha)] pub mod sha; + #[doc(hidden)] + pub mod sync; #[cfg(any(dport, hp_sys, pcr, system))] pub mod system; + pub mod time; #[cfg(any(systimer, timg0, timg1))] pub mod timer; #[cfg(touch)] @@ -491,9 +494,10 @@ unsafe extern "C" fn stack_chk_fail() { panic!("Stack corruption detected"); } +#[cfg(feature = "unstable")] +use crate::config::{WatchdogConfig, WatchdogStatus}; use crate::{ clock::{Clocks, CpuClock}, - config::{WatchdogConfig, WatchdogStatus}, peripherals::Peripherals, }; @@ -512,9 +516,13 @@ pub struct Config { pub cpu_clock: CpuClock, /// Enable watchdog timer(s). + #[cfg(any(doc, feature = "unstable"))] + #[cfg_attr(docsrs, doc(cfg(feature = "unstable")))] pub watchdog: WatchdogConfig, /// PSRAM configuration. + #[cfg(any(doc, feature = "unstable"))] + #[cfg_attr(docsrs, doc(cfg(feature = "unstable")))] #[cfg(any(feature = "quad-psram", feature = "octal-psram"))] pub psram: psram::PsramConfig, } @@ -531,43 +539,61 @@ pub fn init(config: Config) -> Peripherals { // RTC domain must be enabled before we try to disable let mut rtc = crate::rtc_cntl::Rtc::new(&mut peripherals.LPWR); - #[cfg(not(any(esp32, esp32s2)))] - if config.watchdog.swd { - rtc.swd.enable(); - } else { - rtc.swd.disable(); - } + // Handle watchdog configuration with defaults + cfg_if::cfg_if! { + if #[cfg(any(doc, feature = "unstable"))] + { + #[cfg(not(any(esp32, esp32s2)))] + if config.watchdog.swd { + rtc.swd.enable(); + } else { + rtc.swd.disable(); + } - match config.watchdog.rwdt { - WatchdogStatus::Enabled(duration) => { - rtc.rwdt.enable(); - rtc.rwdt - .set_timeout(crate::rtc_cntl::RwdtStage::Stage0, duration); + match config.watchdog.rwdt { + WatchdogStatus::Enabled(duration) => { + rtc.rwdt.enable(); + rtc.rwdt + .set_timeout(crate::rtc_cntl::RwdtStage::Stage0, duration); + } + WatchdogStatus::Disabled => { + rtc.rwdt.disable(); + } + } + + match config.watchdog.timg0 { + WatchdogStatus::Enabled(duration) => { + let mut timg0_wd = crate::timer::timg::Wdt::::new(); + timg0_wd.enable(); + timg0_wd.set_timeout(crate::timer::timg::MwdtStage::Stage0, duration); + } + WatchdogStatus::Disabled => { + crate::timer::timg::Wdt::::new().disable(); + } + } + + #[cfg(timg1)] + match config.watchdog.timg1 { + WatchdogStatus::Enabled(duration) => { + let mut timg1_wd = crate::timer::timg::Wdt::::new(); + timg1_wd.enable(); + timg1_wd.set_timeout(crate::timer::timg::MwdtStage::Stage0, duration); + } + WatchdogStatus::Disabled => { + crate::timer::timg::Wdt::::new().disable(); + } + } } - WatchdogStatus::Disabled => { + else + { + #[cfg(not(any(esp32, esp32s2)))] + rtc.swd.disable(); + rtc.rwdt.disable(); - } - } - match config.watchdog.timg0 { - WatchdogStatus::Enabled(duration) => { - let mut timg0_wd = crate::timer::timg::Wdt::::new(); - timg0_wd.enable(); - timg0_wd.set_timeout(crate::timer::timg::MwdtStage::Stage0, duration); - } - WatchdogStatus::Disabled => { crate::timer::timg::Wdt::::new().disable(); - } - } - #[cfg(timg1)] - match config.watchdog.timg1 { - WatchdogStatus::Enabled(duration) => { - let mut timg1_wd = crate::timer::timg::Wdt::::new(); - timg1_wd.enable(); - timg1_wd.set_timeout(crate::timer::timg::MwdtStage::Stage0, duration); - } - WatchdogStatus::Disabled => { + #[cfg(timg1)] crate::timer::timg::Wdt::::new().disable(); } } diff --git a/esp-hal/src/macros.rs b/esp-hal/src/macros.rs index 0d3c3636c35..648a3959eef 100644 --- a/esp-hal/src/macros.rs +++ b/esp-hal/src/macros.rs @@ -3,9 +3,6 @@ //! Most of the macros in this module are hidden and intended for internal use //! only. For the list of public macros, see the [procmacros](https://docs.rs/esp-hal-procmacros/latest/esp_hal_procmacros/) //! documentation. - -pub use procmacros::*; - #[doc(hidden)] /// Helper macro for checking doctest code snippets #[macro_export] diff --git a/esp-hal/src/rmt.rs b/esp-hal/src/rmt.rs index 4e756a8d85a..d2cc16ddd69 100644 --- a/esp-hal/src/rmt.rs +++ b/esp-hal/src/rmt.rs @@ -227,7 +227,7 @@ use crate::{ asynch::AtomicWaker, gpio::interconnect::{PeripheralInput, PeripheralOutput}, interrupt::InterruptConfigurable, - macros::handler, + handler, peripheral::Peripheral, peripherals::Interrupt, soc::constants, diff --git a/esp-hal/src/rom/mod.rs b/esp-hal/src/rom/mod.rs index 0dae4108380..bf7eef5cd9c 100644 --- a/esp-hal/src/rom/mod.rs +++ b/esp-hal/src/rom/mod.rs @@ -62,6 +62,8 @@ macro_rules! regi2c_write { }; } +pub use regi2c_write; // TODO: can be removed as soon as ROM is stabilized + #[doc(hidden)] #[macro_export] macro_rules! regi2c_write_mask { @@ -82,6 +84,8 @@ macro_rules! regi2c_write_mask { }; } +pub use regi2c_write_mask; // TODO: can be removed as soon as ROM is stabilized + #[inline(always)] pub(crate) fn ets_delay_us(us: u32) { extern "C" { diff --git a/esp-hal/src/rtc_cntl/rtc/esp32c2.rs b/esp-hal/src/rtc_cntl/rtc/esp32c2.rs index f4763966e23..79fda721109 100644 --- a/esp-hal/src/rtc_cntl/rtc/esp32c2.rs +++ b/esp-hal/src/rtc_cntl/rtc/esp32c2.rs @@ -2,7 +2,7 @@ use strum::FromRepr; use crate::{ peripherals::{APB_CTRL, EXTMEM, RTC_CNTL, SPI0, SPI1, SYSTEM}, - regi2c_write_mask, + rom::regi2c_write_mask, rtc_cntl::{RtcCalSel, RtcClock, RtcFastClock, RtcSlowClock}, }; diff --git a/esp-hal/src/rtc_cntl/rtc/esp32c3.rs b/esp-hal/src/rtc_cntl/rtc/esp32c3.rs index 6a2249ccb5a..ab6de7c4188 100644 --- a/esp-hal/src/rtc_cntl/rtc/esp32c3.rs +++ b/esp-hal/src/rtc_cntl/rtc/esp32c3.rs @@ -3,7 +3,7 @@ use strum::FromRepr; use crate::{ clock::XtalClock, peripherals::{APB_CTRL, EXTMEM, RTC_CNTL, SPI0, SPI1, SYSTEM}, - regi2c_write_mask, + rom::regi2c_write_mask, rtc_cntl::{RtcCalSel, RtcClock, RtcFastClock, RtcSlowClock}, }; diff --git a/esp-hal/src/rtc_cntl/sleep/esp32c2.rs b/esp-hal/src/rtc_cntl/sleep/esp32c2.rs index 9609ea5141f..940643ae6e2 100644 --- a/esp-hal/src/rtc_cntl/sleep/esp32c2.rs +++ b/esp-hal/src/rtc_cntl/sleep/esp32c2.rs @@ -1,7 +1,7 @@ use super::{TimerWakeupSource, WakeSource, WakeTriggers, WakeupLevel}; use crate::{ gpio::{RtcFunction, RtcPinWithResistors}, - regi2c_write_mask, + rom::regi2c_write_mask, rtc_cntl::{sleep::RtcioWakeupSource, Clock, Rtc, RtcClock}, }; diff --git a/esp-hal/src/rtc_cntl/sleep/esp32c3.rs b/esp-hal/src/rtc_cntl/sleep/esp32c3.rs index 48a23fcec69..8d0bc69dc34 100644 --- a/esp-hal/src/rtc_cntl/sleep/esp32c3.rs +++ b/esp-hal/src/rtc_cntl/sleep/esp32c3.rs @@ -1,7 +1,7 @@ use super::{TimerWakeupSource, WakeSource, WakeTriggers, WakeupLevel}; use crate::{ gpio::{RtcFunction, RtcPinWithResistors}, - regi2c_write_mask, + rom::regi2c_write_mask, rtc_cntl::{sleep::RtcioWakeupSource, Clock, Rtc, RtcClock}, }; diff --git a/esp-hal/src/rtc_cntl/sleep/esp32s3.rs b/esp-hal/src/rtc_cntl/sleep/esp32s3.rs index 44e8bd63899..550920e6a92 100644 --- a/esp-hal/src/rtc_cntl/sleep/esp32s3.rs +++ b/esp-hal/src/rtc_cntl/sleep/esp32s3.rs @@ -8,7 +8,7 @@ use super::{ }; use crate::{ gpio::{RtcFunction, RtcPin}, - regi2c_write_mask, + rom::regi2c_write_mask, rtc_cntl::{sleep::RtcioWakeupSource, Clock, Rtc, RtcClock}, }; diff --git a/esp-hal/src/soc/esp32c2/trng.rs b/esp-hal/src/soc/esp32c2/trng.rs index 92a565ae665..ff16a6a7112 100644 --- a/esp-hal/src/soc/esp32c2/trng.rs +++ b/esp-hal/src/soc/esp32c2/trng.rs @@ -13,7 +13,7 @@ const ADC_SARADC_ENT_TSENS_ADDR: u8 = 0x07; const ADC_SARADC_ENT_TSENS_ADDR_MSB: u8 = 2; const ADC_SARADC_ENT_TSENS_ADDR_LSB: u8 = 2; -use crate::regi2c_write_mask; +use crate::rom::regi2c_write_mask; /// Enable true randomness by enabling the entropy source. /// Blocks `ADC` usage. diff --git a/esp-hal/src/soc/esp32c3/trng.rs b/esp-hal/src/soc/esp32c3/trng.rs index a1e7f5d281b..781d9f7fbf5 100644 --- a/esp-hal/src/soc/esp32c3/trng.rs +++ b/esp-hal/src/soc/esp32c3/trng.rs @@ -13,7 +13,7 @@ const ADC_SARADC_ENT_TSENS_ADDR: u8 = 0x07; const ADC_SARADC_ENT_TSENS_ADDR_MSB: u8 = 2; const ADC_SARADC_ENT_TSENS_ADDR_LSB: u8 = 2; -use crate::regi2c_write_mask; +use crate::rom::regi2c_write_mask; /// Enable true randomness by enabling the entropy source. /// Blocks `ADC` usage. diff --git a/esp-hal/src/soc/esp32s3/trng.rs b/esp-hal/src/soc/esp32s3/trng.rs index fc98ddda813..67ca73c1af8 100644 --- a/esp-hal/src/soc/esp32s3/trng.rs +++ b/esp-hal/src/soc/esp32s3/trng.rs @@ -15,7 +15,7 @@ const ADC_SARADC_DTEST_RTC_ADDR: u32 = 0x7; const ADC_SARADC_DTEST_RTC_ADDR_MSB: u32 = 1; const ADC_SARADC_DTEST_RTC_ADDR_LSB: u32 = 0; -use crate::regi2c_write_mask; +use crate::rom::regi2c_write_mask; /// Enable true randomness by enabling the entropy source. /// Blocks `ADC` usage. diff --git a/esp-hal/src/spi/master.rs b/esp-hal/src/spi/master.rs index 2d2fe7e8590..1b6542b2fb9 100644 --- a/esp-hal/src/spi/master.rs +++ b/esp-hal/src/spi/master.rs @@ -3467,7 +3467,7 @@ macro_rules! master_instance { } fn handler(&self) -> InterruptHandler { - #[$crate::macros::handler] + #[$crate::handler] #[cfg_attr(place_spi_driver_in_ram, ram)] fn handle() { handle_async(unsafe { $crate::peripherals::$peri::steal() }) diff --git a/esp-hal/src/timer/systimer.rs b/esp-hal/src/timer/systimer.rs index 037171fb78f..83a1b1a468f 100644 --- a/esp-hal/src/timer/systimer.rs +++ b/esp-hal/src/timer/systimer.rs @@ -429,7 +429,7 @@ impl Alarm { static mut HANDLERS: [Option; 3] = [None, None, None]; - #[crate::macros::ram] + #[crate::ram] unsafe extern "C" fn _handle_interrupt() { if unsafe { &*SYSTIMER::PTR } .int_raw() diff --git a/esp-hal/src/touch.rs b/esp-hal/src/touch.rs index 09bb15926e5..8c7440aadc6 100644 --- a/esp-hal/src/touch.rs +++ b/esp-hal/src/touch.rs @@ -530,7 +530,8 @@ mod asynch { use super::*; use crate::{ asynch::AtomicWaker, - macros::{handler, ram}, + handler, + ram, Async, }; diff --git a/esp-hal/src/uart.rs b/esp-hal/src/uart.rs index 7ca3ed6cd98..3ec0ecc5477 100644 --- a/esp-hal/src/uart.rs +++ b/esp-hal/src/uart.rs @@ -2582,7 +2582,7 @@ macro_rules! impl_instance { ($inst:ident, $peri:ident, $txd:ident, $rxd:ident, $cts:ident, $rts:ident) => { impl Instance for crate::peripherals::$inst { fn parts(&self) -> (&'static Info, &'static State) { - #[crate::macros::handler] + #[crate::handler] pub(super) fn irq_handler() { intr_handler(&PERIPHERAL, &STATE); } diff --git a/esp-ieee802154/src/raw.rs b/esp-ieee802154/src/raw.rs index 1afb3e505fe..21a8cc1077c 100644 --- a/esp-ieee802154/src/raw.rs +++ b/esp-ieee802154/src/raw.rs @@ -2,8 +2,8 @@ use core::{cell::RefCell, ptr::addr_of}; use critical_section::Mutex; use esp_hal::{ + handler, interrupt::Priority, - macros::handler, peripherals::RADIO_CLK, system::{RadioClockController, RadioPeripherals}, }; diff --git a/esp-wifi/src/ble/btdm.rs b/esp-wifi/src/ble/btdm.rs index 0997ce1a5b5..8790b557f5a 100644 --- a/esp-wifi/src/ble/btdm.rs +++ b/esp-wifi/src/ble/btdm.rs @@ -13,7 +13,7 @@ use crate::{ HCI_OUT_COLLECTOR, }, compat::common::{self, str_from_c, ConcurrentQueue}, - hal::macros::ram, + hal::ram, }; #[cfg_attr(esp32c3, path = "os_adapter_esp32c3.rs")] diff --git a/esp-wifi/src/common_adapter/common_adapter_esp32.rs b/esp-wifi/src/common_adapter/common_adapter_esp32.rs index 1be2d065260..f9596bad80b 100644 --- a/esp-wifi/src/common_adapter/common_adapter_esp32.rs +++ b/esp-wifi/src/common_adapter/common_adapter_esp32.rs @@ -4,7 +4,7 @@ use super::phy_init_data::PHY_INIT_DATA_DEFAULT; use crate::{ binary::include::*, hal::{ - macros::ram, + ram, system::{RadioClockController, RadioPeripherals}, }, }; diff --git a/esp-wifi/src/common_adapter/common_adapter_esp32s2.rs b/esp-wifi/src/common_adapter/common_adapter_esp32s2.rs index 825f073df69..0d716dee570 100644 --- a/esp-wifi/src/common_adapter/common_adapter_esp32s2.rs +++ b/esp-wifi/src/common_adapter/common_adapter_esp32s2.rs @@ -4,7 +4,7 @@ use super::phy_init_data::PHY_INIT_DATA_DEFAULT; use crate::{ binary::include::*, hal::{ - macros::ram, + ram, system::{RadioClockController, RadioPeripherals}, }, }; diff --git a/esp-wifi/src/common_adapter/mod.rs b/esp-wifi/src/common_adapter/mod.rs index 2a1e5d9da89..2223ea3a108 100644 --- a/esp-wifi/src/common_adapter/mod.rs +++ b/esp-wifi/src/common_adapter/mod.rs @@ -1,5 +1,5 @@ use esp_wifi_sys::include::timeval; -use hal::macros::ram; +use hal::ram; use crate::{ binary::include::{esp_event_base_t, esp_timer_get_time}, diff --git a/esp-wifi/src/wifi/mod.rs b/esp-wifi/src/wifi/mod.rs index aee2f2281b1..8f804dba746 100644 --- a/esp-wifi/src/wifi/mod.rs +++ b/esp-wifi/src/wifi/mod.rs @@ -67,8 +67,8 @@ use crate::{ common_adapter::*, esp_wifi_result, hal::{ - macros::ram, peripheral::{Peripheral, PeripheralRef}, + ram, }, EspWifiController, }; diff --git a/examples/src/bin/debug_assist.rs b/examples/src/bin/debug_assist.rs index 25198e0006e..288e58b920c 100644 --- a/examples/src/bin/debug_assist.rs +++ b/examples/src/bin/debug_assist.rs @@ -12,12 +12,7 @@ use core::cell::RefCell; use critical_section::Mutex; use esp_backtrace as _; -use esp_hal::{ - assist_debug::DebugAssist, - entry, - interrupt::InterruptConfigurable, - macros::handler, -}; +use esp_hal::{assist_debug::DebugAssist, entry, handler, interrupt::InterruptConfigurable}; use esp_println::println; static DA: Mutex>> = Mutex::new(RefCell::new(None)); diff --git a/examples/src/bin/gpio_interrupt.rs b/examples/src/bin/gpio_interrupt.rs index 1675738fb25..93f9331d5cc 100644 --- a/examples/src/bin/gpio_interrupt.rs +++ b/examples/src/bin/gpio_interrupt.rs @@ -8,6 +8,7 @@ //! - BUTTON => GPIO0 (ESP32, ESP32-S2, ESP32-S3) / GPIO9 //% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3 +//% FEATURES: esp-hal/unstable #![no_std] #![no_main] @@ -20,8 +21,9 @@ use esp_hal::{ delay::Delay, entry, gpio::{Event, Input, Io, Level, Output, Pull}, + handler, interrupt::InterruptConfigurable, - macros::{handler, ram}, + ram, }; static BUTTON: Mutex>> = Mutex::new(RefCell::new(None)); diff --git a/examples/src/bin/lp_core_basic.rs b/examples/src/bin/lp_core_basic.rs index e771685eef3..3841ea493eb 100644 --- a/examples/src/bin/lp_core_basic.rs +++ b/examples/src/bin/lp_core_basic.rs @@ -18,8 +18,8 @@ use esp_backtrace as _; use esp_hal::{ entry, gpio::lp_io::LowPowerOutput, + load_lp_code, lp_core::{LpCore, LpCoreWakeupSource}, - macros::load_lp_code, }; use esp_println::{print, println}; diff --git a/examples/src/bin/touch.rs b/examples/src/bin/touch.rs index 4d2dd715e1e..37de40be439 100644 --- a/examples/src/bin/touch.rs +++ b/examples/src/bin/touch.rs @@ -20,8 +20,9 @@ use esp_hal::{ delay::Delay, entry, gpio::GpioPin, + handler, interrupt::InterruptConfigurable, - macros::{handler, ram}, + ram, rtc_cntl::Rtc, touch::{Continuous, Touch, TouchConfig, TouchPad}, Blocking, diff --git a/hil-test/tests/esp_wifi_floats.rs b/hil-test/tests/esp_wifi_floats.rs index 5e9893fe567..66ba744d2a2 100644 --- a/hil-test/tests/esp_wifi_floats.rs +++ b/hil-test/tests/esp_wifi_floats.rs @@ -12,8 +12,8 @@ use critical_section::Mutex; use esp_hal::{ clock::CpuClock, delay::Delay, + handler, interrupt::software::{SoftwareInterrupt, SoftwareInterruptControl}, - macros::handler, peripherals::Peripherals, rng::Rng, timer::timg::TimerGroup, diff --git a/hil-test/tests/gpio.rs b/hil-test/tests/gpio.rs index af03c232939..214b1b99a2d 100644 --- a/hil-test/tests/gpio.rs +++ b/hil-test/tests/gpio.rs @@ -12,8 +12,8 @@ use critical_section::Mutex; use esp_hal::{ delay::Delay, gpio::{AnyPin, Input, Io, Level, Output, Pin, Pull}, + handler, interrupt::InterruptConfigurable, - macros::handler, timer::timg::TimerGroup, }; use hil_test as _; diff --git a/hil-test/tests/gpio_custom_handler.rs b/hil-test/tests/gpio_custom_handler.rs index c7033206740..5b50fd4c81d 100644 --- a/hil-test/tests/gpio_custom_handler.rs +++ b/hil-test/tests/gpio_custom_handler.rs @@ -14,8 +14,8 @@ use embassy_time::{Duration, Timer}; use esp_hal::{ gpio::{AnyPin, Flex, Input, Io, Level, Output, Pull}, + handler, interrupt::InterruptConfigurable, - macros::handler, timer::timg::TimerGroup, }; use hil_test as _; diff --git a/hil-test/tests/systimer.rs b/hil-test/tests/systimer.rs index 7c7c0fe0400..936fa0e3b2c 100644 --- a/hil-test/tests/systimer.rs +++ b/hil-test/tests/systimer.rs @@ -12,7 +12,7 @@ use critical_section::Mutex; use embedded_hal::delay::DelayNs; use esp_hal::{ delay::Delay, - macros::handler, + handler, time::ExtU64, timer::{ systimer::{Alarm, SystemTimer}, diff --git a/qa-test/src/bin/embassy_executor_benchmark.rs b/qa-test/src/bin/embassy_executor_benchmark.rs index 77aa749e9e1..07855bbcbcc 100644 --- a/qa-test/src/bin/embassy_executor_benchmark.rs +++ b/qa-test/src/bin/embassy_executor_benchmark.rs @@ -16,7 +16,7 @@ use embassy_executor::{raw::TaskStorage, Spawner}; use esp_backtrace as _; use esp_hal::{ clock::{Clock, CpuClock}, - macros::handler, + handler, time::Duration, timer::{systimer::SystemTimer, OneShotTimer}, }; diff --git a/qa-test/src/bin/ram.rs b/qa-test/src/bin/ram.rs index 3dce40f3182..3a0b91aa55f 100644 --- a/qa-test/src/bin/ram.rs +++ b/qa-test/src/bin/ram.rs @@ -18,7 +18,7 @@ #![no_main] use esp_backtrace as _; -use esp_hal::{delay::Delay, entry, macros::ram, rtc_cntl::Rtc, time::ExtU64}; +use esp_hal::{delay::Delay, entry, ram, rtc_cntl::Rtc, time::ExtU64}; use esp_println::println; #[ram(rtc_fast)]