From 40d263d086dd86fd9621406fffecaf170a0a160d Mon Sep 17 00:00:00 2001 From: Kirill Mikhailov Date: Tue, 7 Jan 2025 17:14:54 +0100 Subject: [PATCH] address reviews --- esp-hal/CHANGELOG.md | 1 + esp-hal/MIGRATING-0.22.md | 10 ++++++++++ esp-hal/src/lib.rs | 9 ++++++--- esp-hal/src/rom/mod.rs | 10 ++++------ examples/src/bin/flash_read_write.rs | 2 +- 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/esp-hal/CHANGELOG.md b/esp-hal/CHANGELOG.md index 9613fcabfc8..329329c989d 100644 --- a/esp-hal/CHANGELOG.md +++ b/esp-hal/CHANGELOG.md @@ -96,6 +96,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - UART: Remove blocking version of `read_bytes` and rename `drain_fifo` to `read_bytes` instead (#2895) - Renamed variants of `CpuClock`, made the enum non-exhaustive (#2899) - SPI: Fix naming violations for `Mode` enum variants (#2902) +- `macros` module is now private (#2900) ### Fixed diff --git a/esp-hal/MIGRATING-0.22.md b/esp-hal/MIGRATING-0.22.md index d50fd69c278..8984c561dd2 100644 --- a/esp-hal/MIGRATING-0.22.md +++ b/esp-hal/MIGRATING-0.22.md @@ -414,3 +414,13 @@ The SPI mode variants are renamed from e.g. `Mode0` to `_0`. - Mode::Mode0 + Mode::_0 ``` + +## `macro` module is private now + +Macros from `procmacros` crate (`handler`, `ram`, `load_lp_code`) are now imported via `esp-hal`. + +```diff +- use esp_hal::macros::{handler, ram, load_lp_code}; ++ use esp_hal::{handler, ram, load_lp_code}; +``` + diff --git a/esp-hal/src/lib.rs b/esp-hal/src/lib.rs index ec458674bf0..1fd8aa68b14 100644 --- a/esp-hal/src/lib.rs +++ b/esp-hal/src/lib.rs @@ -143,8 +143,6 @@ // MUST be the first module mod fmt; -pub mod asynch; - #[cfg(riscv)] pub use esp_riscv_rt::{self, entry, riscv}; #[cfg(xtensa)] @@ -156,13 +154,17 @@ pub use xtensa_lx_rt::{self, entry}; #[cfg(any(esp32, esp32s3))] pub use self::soc::cpu_control; #[cfg(efuse)] +#[cfg(feature = "unstable")] pub use self::soc::efuse; #[cfg(lp_core)] +#[cfg(feature = "unstable")] pub use self::soc::lp_core; pub use self::soc::peripherals; +#[cfg(feature = "unstable")] #[cfg(any(feature = "quad-psram", feature = "octal-psram"))] pub use self::soc::psram; #[cfg(ulp_riscv_core)] +#[cfg(feature = "unstable")] pub use self::soc::ulp_core; #[cfg(any(dport, hp_sys, pcr, system))] @@ -216,6 +218,7 @@ unstable_module! { pub mod aes; #[cfg(any(adc, dac))] pub mod analog; + pub mod asynch; #[cfg(assist_debug)] pub mod assist_debug; pub mod config; @@ -541,7 +544,7 @@ pub fn init(config: Config) -> Peripherals { // Handle watchdog configuration with defaults cfg_if::cfg_if! { - if #[cfg(any(doc, feature = "unstable"))] + if #[cfg(feature = "unstable")] { #[cfg(not(any(esp32, esp32s2)))] if config.watchdog.swd { diff --git a/esp-hal/src/rom/mod.rs b/esp-hal/src/rom/mod.rs index bf7eef5cd9c..bcf681c3f98 100644 --- a/esp-hal/src/rom/mod.rs +++ b/esp-hal/src/rom/mod.rs @@ -44,8 +44,6 @@ extern "C" { ); } -#[doc(hidden)] -#[macro_export] macro_rules! regi2c_write { ( $block: ident, $reg_add: ident, $indata: expr ) => { paste::paste! { @@ -62,10 +60,9 @@ macro_rules! regi2c_write { }; } -pub use regi2c_write; // TODO: can be removed as soon as ROM is stabilized +#[allow(unused_imports)] +pub(crate) use regi2c_write; -#[doc(hidden)] -#[macro_export] macro_rules! regi2c_write_mask { ( $block: ident, $reg_add: ident, $indata: expr ) => { paste::paste! { @@ -84,7 +81,8 @@ macro_rules! regi2c_write_mask { }; } -pub use regi2c_write_mask; // TODO: can be removed as soon as ROM is stabilized +#[allow(unused_imports)] +pub(crate) use regi2c_write_mask; #[inline(always)] pub(crate) fn ets_delay_us(us: u32) { diff --git a/examples/src/bin/flash_read_write.rs b/examples/src/bin/flash_read_write.rs index 81b53a8d013..93b4cea7a39 100644 --- a/examples/src/bin/flash_read_write.rs +++ b/examples/src/bin/flash_read_write.rs @@ -3,7 +3,7 @@ //! Uses flash address 0x9000 (default NVS) //! See https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/partition-tables.html#built-in-partition-tables -//% FEATURES: esp-storage +//% FEATURES: esp-storage esp-hal/unstable //% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3 #![no_std]