// Do NOT edit this file directly. Make your changes to esp-metadata,
// then run `cargo xtask update-metadata`.

/// The name of the chip as `&str`
///
/// # Example
///
/// ```rust, no_run
/// use esp_hal::chip;
/// let chip_name = chip!();
#[doc = concat!("assert_eq!(chip_name, ", chip!(), ")")]
/// ```
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! chip {
    () => {
        "esp32s2"
    };
}
/// The properties of this chip and its drivers.
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! property {
    ("chip") => {
        "esp32s2"
    };
    ("arch") => {
        "xtensa"
    };
    ("cores") => {
        1
    };
    ("cores", str) => {
        stringify!(1)
    };
    ("trm") => {
        "https://www.espressif.com/sites/default/files/documentation/esp32-s2_technical_reference_manual_en.pdf"
    };
    ("soc.cpu_has_csr_pc") => {
        false
    };
    ("soc.cpu_has_prv_mode") => {
        false
    };
    ("soc.ref_tick_hz") => {
        1000000
    };
    ("soc.ref_tick_hz", str) => {
        stringify!(1000000)
    };
    ("soc.rc_fast_clk_default") => {
        8500000
    };
    ("soc.rc_fast_clk_default", str) => {
        stringify!(8500000)
    };
    ("soc.rc_slow_clock") => {
        90000
    };
    ("soc.rc_slow_clock", str) => {
        stringify!(90000)
    };
    ("soc.xtal_frequency") => {
        40
    };
    ("soc.xtal_frequency", str) => {
        stringify!(40)
    };
    ("aes.dma") => {
        true
    };
    ("aes.has_split_text_registers") => {
        true
    };
    ("aes.endianness_configurable") => {
        true
    };
    ("gpio.has_bank_1") => {
        true
    };
    ("gpio.gpio_function") => {
        1
    };
    ("gpio.gpio_function", str) => {
        stringify!(1)
    };
    ("gpio.constant_0_input") => {
        60
    };
    ("gpio.constant_0_input", str) => {
        stringify!(60)
    };
    ("gpio.constant_1_input") => {
        56
    };
    ("gpio.constant_1_input", str) => {
        stringify!(56)
    };
    ("gpio.remap_iomux_pin_registers") => {
        false
    };
    ("gpio.func_in_sel_offset") => {
        0
    };
    ("gpio.func_in_sel_offset", str) => {
        stringify!(0)
    };
    ("gpio.input_signal_max") => {
        242
    };
    ("gpio.input_signal_max", str) => {
        stringify!(242)
    };
    ("gpio.output_signal_max") => {
        256
    };
    ("gpio.output_signal_max", str) => {
        stringify!(256)
    };
    ("i2c_master.has_fsm_timeouts") => {
        false
    };
    ("i2c_master.has_hw_bus_clear") => {
        false
    };
    ("i2c_master.has_bus_timeout_enable") => {
        true
    };
    ("i2c_master.separate_filter_config_registers") => {
        true
    };
    ("i2c_master.can_estimate_nack_reason") => {
        false
    };
    ("i2c_master.has_conf_update") => {
        false
    };
    ("i2c_master.has_reliable_fsm_reset") => {
        false
    };
    ("i2c_master.has_arbitration_en") => {
        true
    };
    ("i2c_master.has_tx_fifo_watermark") => {
        false
    };
    ("i2c_master.bus_timeout_is_exponential") => {
        false
    };
    ("i2c_master.i2c0_data_register_ahb_address") => {
        1610690588
    };
    ("i2c_master.i2c0_data_register_ahb_address", str) => {
        stringify!(1610690588)
    };
    ("i2c_master.max_bus_timeout") => {
        16777215
    };
    ("i2c_master.max_bus_timeout", str) => {
        stringify!(16777215)
    };
    ("i2c_master.ll_intr_mask") => {
        131071
    };
    ("i2c_master.ll_intr_mask", str) => {
        stringify!(131071)
    };
    ("i2c_master.fifo_size") => {
        32
    };
    ("i2c_master.fifo_size", str) => {
        stringify!(32)
    };
    ("interrupts.status_registers") => {
        3
    };
    ("interrupts.status_registers", str) => {
        stringify!(3)
    };
    ("rmt.ram_start") => {
        1061250048
    };
    ("rmt.ram_start", str) => {
        stringify!(1061250048)
    };
    ("rmt.channel_ram_size") => {
        64
    };
    ("rmt.channel_ram_size", str) => {
        stringify!(64)
    };
    ("rmt.has_tx_immediate_stop") => {
        true
    };
    ("rmt.has_tx_loop_count") => {
        true
    };
    ("rmt.has_tx_loop_auto_stop") => {
        false
    };
    ("rmt.has_tx_carrier_data_only") => {
        true
    };
    ("rmt.has_tx_sync") => {
        true
    };
    ("rmt.has_rx_wrap") => {
        false
    };
    ("rmt.has_rx_demodulation") => {
        true
    };
    ("rmt.has_dma") => {
        false
    };
    ("rmt.has_per_channel_clock") => {
        true
    };
    ("rng.apb_cycle_wait_num") => {
        16
    };
    ("rng.apb_cycle_wait_num", str) => {
        stringify!(16)
    };
    ("rsa.size_increment") => {
        32
    };
    ("rsa.size_increment", str) => {
        stringify!(32)
    };
    ("rsa.memory_size_bytes") => {
        512
    };
    ("rsa.memory_size_bytes", str) => {
        stringify!(512)
    };
    ("sha.dma") => {
        true
    };
    ("spi_master.has_octal") => {
        true
    };
    ("timergroup.timg_has_timer1") => {
        true
    };
    ("timergroup.timg_has_divcnt_rst") => {
        false
    };
    ("timergroup.default_clock_source") => {
        0
    };
    ("timergroup.default_clock_source", str) => {
        stringify!(0)
    };
    ("uart.ram_size") => {
        128
    };
    ("uart.ram_size", str) => {
        stringify!(128)
    };
    ("uart.peripheral_controls_mem_clk") => {
        false
    };
    ("wifi.has_wifi6") => {
        false
    };
    ("phy.combo_module") => {
        false
    };
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_soc_xtal_options {
    ($($pattern:tt => $code:tt;)*) => {
        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
        _for_each_inner!((40)); _for_each_inner!((all(40)));
    };
}
/// Implement the `Peripheral` enum and enable/disable/reset functions.
///
/// This macro is intended to be placed in `esp_hal::system`.
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! implement_peripheral_clocks {
    () => {
        #[doc(hidden)]
        #[derive(Debug, Clone, Copy, PartialEq, Eq)]
        #[repr(u8)]
        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
        pub enum Peripheral {
            #[doc = "AES peripheral clock signal"]
            Aes,
            #[doc = "APB_SAR_ADC peripheral clock signal"]
            ApbSarAdc,
            #[doc = "COPY_DMA peripheral clock signal"]
            CopyDma,
            #[doc = "CRYPTO_DMA peripheral clock signal"]
            CryptoDma,
            #[doc = "DS peripheral clock signal"]
            Ds,
            #[doc = "HMAC peripheral clock signal"]
            Hmac,
            #[doc = "I2C_EXT0 peripheral clock signal"]
            I2cExt0,
            #[doc = "I2C_EXT1 peripheral clock signal"]
            I2cExt1,
            #[doc = "I2S0 peripheral clock signal"]
            I2s0,
            #[doc = "LEDC peripheral clock signal"]
            Ledc,
            #[doc = "MCPWM0 peripheral clock signal"]
            Mcpwm0,
            #[doc = "MCPWM1 peripheral clock signal"]
            Mcpwm1,
            #[doc = "PCNT peripheral clock signal"]
            Pcnt,
            #[doc = "RMT peripheral clock signal"]
            Rmt,
            #[doc = "RSA peripheral clock signal"]
            Rsa,
            #[doc = "SHA peripheral clock signal"]
            Sha,
            #[doc = "SPI2 peripheral clock signal"]
            Spi2,
            #[doc = "SPI2_DMA peripheral clock signal"]
            Spi2Dma,
            #[doc = "SPI3 peripheral clock signal"]
            Spi3,
            #[doc = "SPI3_DMA peripheral clock signal"]
            Spi3Dma,
            #[doc = "SYSTIMER peripheral clock signal"]
            Systimer,
            #[doc = "TIMG0 peripheral clock signal"]
            Timg0,
            #[doc = "TIMG1 peripheral clock signal"]
            Timg1,
            #[doc = "TWAI0 peripheral clock signal"]
            Twai0,
            #[doc = "UART0 peripheral clock signal"]
            Uart0,
            #[doc = "UART1 peripheral clock signal"]
            Uart1,
            #[doc = "UART_MEM peripheral clock signal"]
            UartMem,
            #[doc = "UHCI0 peripheral clock signal"]
            Uhci0,
            #[doc = "UHCI1 peripheral clock signal"]
            Uhci1,
            #[doc = "USB peripheral clock signal"]
            Usb,
            #[doc = "WDG peripheral clock signal"]
            Wdg,
        }
        impl Peripheral {
            const KEEP_ENABLED: &[Peripheral] =
                &[Self::Systimer, Self::Timg0, Self::Uart0, Self::UartMem];
            const COUNT: usize = Self::ALL.len();
            const ALL: &[Self] = &[
                Self::Aes,
                Self::ApbSarAdc,
                Self::CopyDma,
                Self::CryptoDma,
                Self::Ds,
                Self::Hmac,
                Self::I2cExt0,
                Self::I2cExt1,
                Self::I2s0,
                Self::Ledc,
                Self::Mcpwm0,
                Self::Mcpwm1,
                Self::Pcnt,
                Self::Rmt,
                Self::Rsa,
                Self::Sha,
                Self::Spi2,
                Self::Spi2Dma,
                Self::Spi3,
                Self::Spi3Dma,
                Self::Systimer,
                Self::Timg0,
                Self::Timg1,
                Self::Twai0,
                Self::Uart0,
                Self::Uart1,
                Self::UartMem,
                Self::Uhci0,
                Self::Uhci1,
                Self::Usb,
                Self::Wdg,
            ];
        }
        unsafe fn enable_internal_racey(peripheral: Peripheral, enable: bool) {
            match peripheral {
                Peripheral::Aes => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en1()
                        .modify(|_, w| w.crypto_aes_clk_en().bit(enable));
                }
                Peripheral::ApbSarAdc => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.apb_saradc_clk_en().bit(enable));
                }
                Peripheral::CopyDma => {
                    crate::peripherals::DMA_COPY::regs()
                        .conf()
                        .modify(|_, w| w.clk_en().bit(enable));
                }
                Peripheral::CryptoDma => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en1()
                        .modify(|_, w| w.crypto_dma_clk_en().bit(enable));
                }
                Peripheral::Ds => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en1()
                        .modify(|_, w| w.crypto_ds_clk_en().bit(enable));
                }
                Peripheral::Hmac => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en1()
                        .modify(|_, w| w.crypto_hmac_clk_en().bit(enable));
                }
                Peripheral::I2cExt0 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.i2c_ext0_clk_en().bit(enable));
                }
                Peripheral::I2cExt1 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.i2c_ext1_clk_en().bit(enable));
                }
                Peripheral::I2s0 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.i2s0_clk_en().bit(enable));
                }
                Peripheral::Ledc => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.ledc_clk_en().bit(enable));
                }
                Peripheral::Mcpwm0 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.pwm0_clk_en().bit(enable));
                }
                Peripheral::Mcpwm1 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.pwm1_clk_en().bit(enable));
                }
                Peripheral::Pcnt => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.pcnt_clk_en().bit(enable));
                }
                Peripheral::Rmt => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.rmt_clk_en().bit(enable));
                }
                Peripheral::Rsa => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en1()
                        .modify(|_, w| w.crypto_rsa_clk_en().bit(enable));
                }
                Peripheral::Sha => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en1()
                        .modify(|_, w| w.crypto_sha_clk_en().bit(enable));
                }
                Peripheral::Spi2 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.spi2_clk_en().bit(enable));
                }
                Peripheral::Spi2Dma => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.spi2_dma_clk_en().bit(enable));
                }
                Peripheral::Spi3 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.spi3_clk_en().bit(enable));
                }
                Peripheral::Spi3Dma => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.spi3_dma_clk_en().bit(enable));
                }
                Peripheral::Systimer => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.systimer_clk_en().bit(enable));
                }
                Peripheral::Timg0 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.timergroup_clk_en().bit(enable));
                }
                Peripheral::Timg1 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.timergroup1_clk_en().bit(enable));
                }
                Peripheral::Twai0 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.twai_clk_en().bit(enable));
                }
                Peripheral::Uart0 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.uart_clk_en().bit(enable));
                }
                Peripheral::Uart1 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.uart1_clk_en().bit(enable));
                }
                Peripheral::UartMem => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.uart_mem_clk_en().bit(enable));
                }
                Peripheral::Uhci0 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.uhci0_clk_en().bit(enable));
                }
                Peripheral::Uhci1 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.uhci1_clk_en().bit(enable));
                }
                Peripheral::Usb => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.usb_clk_en().bit(enable));
                }
                Peripheral::Wdg => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_clk_en0()
                        .modify(|_, w| w.wdg_clk_en().bit(enable));
                }
            }
        }
        unsafe fn assert_peri_reset_racey(peripheral: Peripheral, reset: bool) {
            match peripheral {
                Peripheral::Aes => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en1()
                        .modify(|_, w| w.crypto_aes_rst().bit(reset));
                }
                Peripheral::ApbSarAdc => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.apb_saradc_rst().bit(reset));
                }
                Peripheral::CopyDma => {
                    crate::peripherals::DMA_COPY::regs().conf().modify(|_, w| {
                        w.in_rst()
                            .bit(reset)
                            .out_rst()
                            .bit(reset)
                            .cmdfifo_rst()
                            .bit(reset)
                            .fifo_rst()
                            .bit(reset)
                    });
                }
                Peripheral::CryptoDma => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en1()
                        .modify(|_, w| w.crypto_dma_rst().bit(reset));
                }
                Peripheral::Ds => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en1()
                        .modify(|_, w| w.crypto_ds_rst().bit(reset));
                }
                Peripheral::Hmac => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en1()
                        .modify(|_, w| w.crypto_hmac_rst().bit(reset));
                }
                Peripheral::I2cExt0 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.i2c_ext0_rst().bit(reset));
                }
                Peripheral::I2cExt1 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.i2c_ext1_rst().bit(reset));
                }
                Peripheral::I2s0 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.i2s0_rst().bit(reset));
                }
                Peripheral::Ledc => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.ledc_rst().bit(reset));
                }
                Peripheral::Mcpwm0 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.pwm0_rst().bit(reset));
                }
                Peripheral::Mcpwm1 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.pwm1_rst().bit(reset));
                }
                Peripheral::Pcnt => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.pcnt_rst().bit(reset));
                }
                Peripheral::Rmt => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.rmt_rst().bit(reset));
                }
                Peripheral::Rsa => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en1()
                        .modify(|_, w| w.crypto_rsa_rst().bit(reset));
                }
                Peripheral::Sha => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en1()
                        .modify(|_, w| w.crypto_sha_rst().bit(reset));
                }
                Peripheral::Spi2 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.spi2_rst().bit(reset));
                }
                Peripheral::Spi2Dma => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.spi2_dma_rst().bit(reset));
                }
                Peripheral::Spi3 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.spi3_rst().bit(reset));
                }
                Peripheral::Spi3Dma => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.spi3_dma_rst().bit(reset));
                }
                Peripheral::Systimer => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.systimer_rst().bit(reset));
                }
                Peripheral::Timg0 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.timergroup_rst().bit(reset));
                }
                Peripheral::Timg1 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.timergroup1_rst().bit(reset));
                }
                Peripheral::Twai0 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.twai_rst().bit(reset));
                }
                Peripheral::Uart0 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.uart_rst().bit(reset));
                }
                Peripheral::Uart1 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.uart1_rst().bit(reset));
                }
                Peripheral::UartMem => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.uart_mem_rst().bit(reset));
                }
                Peripheral::Uhci0 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.uhci0_rst().bit(reset));
                }
                Peripheral::Uhci1 => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.uhci1_rst().bit(reset));
                }
                Peripheral::Usb => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.usb_rst().bit(reset));
                }
                Peripheral::Wdg => {
                    crate::peripherals::SYSTEM::regs()
                        .perip_rst_en0()
                        .modify(|_, w| w.wdg_rst().bit(reset));
                }
            }
        }
    };
}
/// Macro to get the address range of the given memory region.
///
/// This macro provides two syntax options for each memory region:
///
/// - `memory_range!("region_name")` returns the address range as a range expression (`start..end`).
/// - `memory_range!(size as str, "region_name")` returns the size of the region as a string
///   literal.
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! memory_range {
    ("DRAM") => {
        1073414144..1073741824
    };
    (size as str, "DRAM") => {
        "327680"
    };
    ("DRAM2_UNINIT") => {
        1073602560..1073741824
    };
    (size as str, "DRAM2_UNINIT") => {
        "139264"
    };
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_aes_key_length {
    ($($pattern:tt => $code:tt;)*) => {
        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
        _for_each_inner!((128)); _for_each_inner!((192)); _for_each_inner!((256));
        _for_each_inner!((128, 0, 4)); _for_each_inner!((192, 1, 5));
        _for_each_inner!((256, 2, 6)); _for_each_inner!((bits(128), (192), (256)));
        _for_each_inner!((modes(128, 0, 4), (192, 1, 5), (256, 2, 6)));
    };
}
/// This macro can be used to generate code for each channel of the RMT peripheral.
///
/// For an explanation on the general syntax, as well as usage of individual/repeated
/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
///
/// This macro has three options for its "Individual matcher" case:
///
/// - `all`: `($num:literal)`
/// - `tx`: `($num:literal, $idx:literal)`
/// - `rx`: `($num:literal, $idx:literal)`
///
/// Macro fragments:
///
/// - `$num`: number of the channel, e.g. `0`
/// - `$idx`: index of the channel among channels of the same capability, e.g. `0`
///
/// Example data:
///
/// - `all`: `(0)`
/// - `tx`: `(1, 1)`
/// - `rx`: `(2, 0)`
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_rmt_channel {
    ($($pattern:tt => $code:tt;)*) => {
        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
        _for_each_inner!((0)); _for_each_inner!((1)); _for_each_inner!((2));
        _for_each_inner!((3)); _for_each_inner!((0, 0)); _for_each_inner!((1, 1));
        _for_each_inner!((2, 2)); _for_each_inner!((3, 3)); _for_each_inner!((0, 0));
        _for_each_inner!((1, 1)); _for_each_inner!((2, 2)); _for_each_inner!((3, 3));
        _for_each_inner!((all(0), (1), (2), (3))); _for_each_inner!((tx(0, 0), (1, 1),
        (2, 2), (3, 3))); _for_each_inner!((rx(0, 0), (1, 1), (2, 2), (3, 3)));
    };
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_rmt_clock_source {
    ($($pattern:tt => $code:tt;)*) => {
        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
        _for_each_inner!((RefTick, 0)); _for_each_inner!((Apb, 1));
        _for_each_inner!((Apb)); _for_each_inner!((all(RefTick, 0), (Apb, 1)));
        _for_each_inner!((default(Apb))); _for_each_inner!((is_boolean));
    };
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_rsa_exponentiation {
    ($($pattern:tt => $code:tt;)*) => {
        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
        _for_each_inner!((32)); _for_each_inner!((64)); _for_each_inner!((96));
        _for_each_inner!((128)); _for_each_inner!((160)); _for_each_inner!((192));
        _for_each_inner!((224)); _for_each_inner!((256)); _for_each_inner!((288));
        _for_each_inner!((320)); _for_each_inner!((352)); _for_each_inner!((384));
        _for_each_inner!((416)); _for_each_inner!((448)); _for_each_inner!((480));
        _for_each_inner!((512)); _for_each_inner!((544)); _for_each_inner!((576));
        _for_each_inner!((608)); _for_each_inner!((640)); _for_each_inner!((672));
        _for_each_inner!((704)); _for_each_inner!((736)); _for_each_inner!((768));
        _for_each_inner!((800)); _for_each_inner!((832)); _for_each_inner!((864));
        _for_each_inner!((896)); _for_each_inner!((928)); _for_each_inner!((960));
        _for_each_inner!((992)); _for_each_inner!((1024)); _for_each_inner!((1056));
        _for_each_inner!((1088)); _for_each_inner!((1120)); _for_each_inner!((1152));
        _for_each_inner!((1184)); _for_each_inner!((1216)); _for_each_inner!((1248));
        _for_each_inner!((1280)); _for_each_inner!((1312)); _for_each_inner!((1344));
        _for_each_inner!((1376)); _for_each_inner!((1408)); _for_each_inner!((1440));
        _for_each_inner!((1472)); _for_each_inner!((1504)); _for_each_inner!((1536));
        _for_each_inner!((1568)); _for_each_inner!((1600)); _for_each_inner!((1632));
        _for_each_inner!((1664)); _for_each_inner!((1696)); _for_each_inner!((1728));
        _for_each_inner!((1760)); _for_each_inner!((1792)); _for_each_inner!((1824));
        _for_each_inner!((1856)); _for_each_inner!((1888)); _for_each_inner!((1920));
        _for_each_inner!((1952)); _for_each_inner!((1984)); _for_each_inner!((2016));
        _for_each_inner!((2048)); _for_each_inner!((2080)); _for_each_inner!((2112));
        _for_each_inner!((2144)); _for_each_inner!((2176)); _for_each_inner!((2208));
        _for_each_inner!((2240)); _for_each_inner!((2272)); _for_each_inner!((2304));
        _for_each_inner!((2336)); _for_each_inner!((2368)); _for_each_inner!((2400));
        _for_each_inner!((2432)); _for_each_inner!((2464)); _for_each_inner!((2496));
        _for_each_inner!((2528)); _for_each_inner!((2560)); _for_each_inner!((2592));
        _for_each_inner!((2624)); _for_each_inner!((2656)); _for_each_inner!((2688));
        _for_each_inner!((2720)); _for_each_inner!((2752)); _for_each_inner!((2784));
        _for_each_inner!((2816)); _for_each_inner!((2848)); _for_each_inner!((2880));
        _for_each_inner!((2912)); _for_each_inner!((2944)); _for_each_inner!((2976));
        _for_each_inner!((3008)); _for_each_inner!((3040)); _for_each_inner!((3072));
        _for_each_inner!((3104)); _for_each_inner!((3136)); _for_each_inner!((3168));
        _for_each_inner!((3200)); _for_each_inner!((3232)); _for_each_inner!((3264));
        _for_each_inner!((3296)); _for_each_inner!((3328)); _for_each_inner!((3360));
        _for_each_inner!((3392)); _for_each_inner!((3424)); _for_each_inner!((3456));
        _for_each_inner!((3488)); _for_each_inner!((3520)); _for_each_inner!((3552));
        _for_each_inner!((3584)); _for_each_inner!((3616)); _for_each_inner!((3648));
        _for_each_inner!((3680)); _for_each_inner!((3712)); _for_each_inner!((3744));
        _for_each_inner!((3776)); _for_each_inner!((3808)); _for_each_inner!((3840));
        _for_each_inner!((3872)); _for_each_inner!((3904)); _for_each_inner!((3936));
        _for_each_inner!((3968)); _for_each_inner!((4000)); _for_each_inner!((4032));
        _for_each_inner!((4064)); _for_each_inner!((4096)); _for_each_inner!((all(32),
        (64), (96), (128), (160), (192), (224), (256), (288), (320), (352), (384), (416),
        (448), (480), (512), (544), (576), (608), (640), (672), (704), (736), (768),
        (800), (832), (864), (896), (928), (960), (992), (1024), (1056), (1088), (1120),
        (1152), (1184), (1216), (1248), (1280), (1312), (1344), (1376), (1408), (1440),
        (1472), (1504), (1536), (1568), (1600), (1632), (1664), (1696), (1728), (1760),
        (1792), (1824), (1856), (1888), (1920), (1952), (1984), (2016), (2048), (2080),
        (2112), (2144), (2176), (2208), (2240), (2272), (2304), (2336), (2368), (2400),
        (2432), (2464), (2496), (2528), (2560), (2592), (2624), (2656), (2688), (2720),
        (2752), (2784), (2816), (2848), (2880), (2912), (2944), (2976), (3008), (3040),
        (3072), (3104), (3136), (3168), (3200), (3232), (3264), (3296), (3328), (3360),
        (3392), (3424), (3456), (3488), (3520), (3552), (3584), (3616), (3648), (3680),
        (3712), (3744), (3776), (3808), (3840), (3872), (3904), (3936), (3968), (4000),
        (4032), (4064), (4096)));
    };
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_rsa_multiplication {
    ($($pattern:tt => $code:tt;)*) => {
        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
        _for_each_inner!((32)); _for_each_inner!((64)); _for_each_inner!((96));
        _for_each_inner!((128)); _for_each_inner!((160)); _for_each_inner!((192));
        _for_each_inner!((224)); _for_each_inner!((256)); _for_each_inner!((288));
        _for_each_inner!((320)); _for_each_inner!((352)); _for_each_inner!((384));
        _for_each_inner!((416)); _for_each_inner!((448)); _for_each_inner!((480));
        _for_each_inner!((512)); _for_each_inner!((544)); _for_each_inner!((576));
        _for_each_inner!((608)); _for_each_inner!((640)); _for_each_inner!((672));
        _for_each_inner!((704)); _for_each_inner!((736)); _for_each_inner!((768));
        _for_each_inner!((800)); _for_each_inner!((832)); _for_each_inner!((864));
        _for_each_inner!((896)); _for_each_inner!((928)); _for_each_inner!((960));
        _for_each_inner!((992)); _for_each_inner!((1024)); _for_each_inner!((1056));
        _for_each_inner!((1088)); _for_each_inner!((1120)); _for_each_inner!((1152));
        _for_each_inner!((1184)); _for_each_inner!((1216)); _for_each_inner!((1248));
        _for_each_inner!((1280)); _for_each_inner!((1312)); _for_each_inner!((1344));
        _for_each_inner!((1376)); _for_each_inner!((1408)); _for_each_inner!((1440));
        _for_each_inner!((1472)); _for_each_inner!((1504)); _for_each_inner!((1536));
        _for_each_inner!((1568)); _for_each_inner!((1600)); _for_each_inner!((1632));
        _for_each_inner!((1664)); _for_each_inner!((1696)); _for_each_inner!((1728));
        _for_each_inner!((1760)); _for_each_inner!((1792)); _for_each_inner!((1824));
        _for_each_inner!((1856)); _for_each_inner!((1888)); _for_each_inner!((1920));
        _for_each_inner!((1952)); _for_each_inner!((1984)); _for_each_inner!((2016));
        _for_each_inner!((2048)); _for_each_inner!((all(32), (64), (96), (128), (160),
        (192), (224), (256), (288), (320), (352), (384), (416), (448), (480), (512),
        (544), (576), (608), (640), (672), (704), (736), (768), (800), (832), (864),
        (896), (928), (960), (992), (1024), (1056), (1088), (1120), (1152), (1184),
        (1216), (1248), (1280), (1312), (1344), (1376), (1408), (1440), (1472), (1504),
        (1536), (1568), (1600), (1632), (1664), (1696), (1728), (1760), (1792), (1824),
        (1856), (1888), (1920), (1952), (1984), (2016), (2048)));
    };
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_sha_algorithm {
    ($($pattern:tt => $code:tt;)*) => {
        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
        _for_each_inner!((Sha1, "SHA-1"(sizes : 64, 20, 8) (insecure_against :
        "collision", "length extension"), 0)); _for_each_inner!((Sha224, "SHA-224"(sizes
        : 64, 28, 8) (insecure_against : "length extension"), 1));
        _for_each_inner!((Sha256, "SHA-256"(sizes : 64, 32, 8) (insecure_against :
        "length extension"), 2)); _for_each_inner!((Sha384, "SHA-384"(sizes : 128, 48,
        16) (insecure_against :), 3)); _for_each_inner!((Sha512, "SHA-512"(sizes : 128,
        64, 16) (insecure_against : "length extension"), 4));
        _for_each_inner!((Sha512_224, "SHA-512/224"(sizes : 128, 28, 16)
        (insecure_against :), 5)); _for_each_inner!((Sha512_256, "SHA-512/256"(sizes :
        128, 32, 16) (insecure_against :), 6)); _for_each_inner!((algos(Sha1,
        "SHA-1"(sizes : 64, 20, 8) (insecure_against : "collision", "length extension"),
        0), (Sha224, "SHA-224"(sizes : 64, 28, 8) (insecure_against :
        "length extension"), 1), (Sha256, "SHA-256"(sizes : 64, 32, 8) (insecure_against
        : "length extension"), 2), (Sha384, "SHA-384"(sizes : 128, 48, 16)
        (insecure_against :), 3), (Sha512, "SHA-512"(sizes : 128, 64, 16)
        (insecure_against : "length extension"), 4), (Sha512_224, "SHA-512/224"(sizes :
        128, 28, 16) (insecure_against :), 5), (Sha512_256, "SHA-512/256"(sizes : 128,
        32, 16) (insecure_against :), 6)));
    };
}
/// This macro can be used to generate code for each peripheral instance of the I2C master driver.
///
/// For an explanation on the general syntax, as well as usage of individual/repeated
/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
///
/// This macro has one option for its "Individual matcher" case:
///
/// Syntax: `($instance:ident, $sys:ident, $scl:ident, $sda:ident)`
///
/// Macro fragments:
///
/// - `$instance`: the name of the I2C instance
/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
/// - `$scl`, `$sda`: peripheral signal names.
///
/// Example data: `(I2C0, I2cExt0, I2CEXT0_SCL, I2CEXT0_SDA)`
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_i2c_master {
    ($($pattern:tt => $code:tt;)*) => {
        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
        _for_each_inner!((I2C0, I2cExt0, I2CEXT0_SCL, I2CEXT0_SDA));
        _for_each_inner!((I2C1, I2cExt1, I2CEXT1_SCL, I2CEXT1_SDA));
        _for_each_inner!((all(I2C0, I2cExt0, I2CEXT0_SCL, I2CEXT0_SDA), (I2C1, I2cExt1,
        I2CEXT1_SCL, I2CEXT1_SDA)));
    };
}
/// This macro can be used to generate code for each peripheral instance of the UART driver.
///
/// For an explanation on the general syntax, as well as usage of individual/repeated
/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
///
/// This macro has one option for its "Individual matcher" case:
///
/// Syntax: `($instance:ident, $sys:ident, $rx:ident, $tx:ident, $cts:ident, $rts:ident)`
///
/// Macro fragments:
///
/// - `$instance`: the name of the UART instance
/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
/// - `$rx`, `$tx`, `$cts`, `$rts`: signal names.
///
/// Example data: `(UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS)`
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_uart {
    ($($pattern:tt => $code:tt;)*) => {
        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
        _for_each_inner!((UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS));
        _for_each_inner!((UART1, Uart1, U1RXD, U1TXD, U1CTS, U1RTS));
        _for_each_inner!((all(UART0, Uart0, U0RXD, U0TXD, U0CTS, U0RTS), (UART1, Uart1,
        U1RXD, U1TXD, U1CTS, U1RTS)));
    };
}
/// This macro can be used to generate code for each peripheral instance of the SPI master driver.
///
/// For an explanation on the general syntax, as well as usage of individual/repeated
/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
///
/// This macro has one option for its "Individual matcher" case:
///
/// Syntax: `($instance:ident, $sys:ident, $sclk:ident, [$($cs:ident),*] [$($sio:ident),*
/// $($is_qspi:iteral)?])`
///
/// Macro fragments:
///
/// - `$instance`: the name of the SPI instance
/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
/// - `$cs`, `$sio`: chip select and SIO signal names.
/// - `$is_qspi`: a `true` literal present if the SPI instance supports QSPI.
///
/// Example data:
/// - `(SPI2, Spi2, FSPICLK [FSPICS0, FSPICS1, FSPICS2, FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ,
///   FSPIWP, FSPIHD, FSPIIO4, FSPIIO5, FSPIIO6, FSPIIO7], true)`
/// - `(SPI3, Spi3, SPI3_CLK [SPI3_CS0, SPI3_CS1, SPI3_CS2] [SPI3_D, SPI3_Q])`
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_spi_master {
    ($($pattern:tt => $code:tt;)*) => {
        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
        _for_each_inner!((SPI2, Spi2, FSPICLK[FSPICS0, FSPICS1, FSPICS2, FSPICS3,
        FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD, FSPIIO4, FSPIIO5, FSPIIO6,
        FSPIIO7], true)); _for_each_inner!((SPI3, Spi3, SPI3_CLK[SPI3_CS0, SPI3_CS1,
        SPI3_CS2] [SPI3_D, SPI3_Q])); _for_each_inner!((all(SPI2, Spi2, FSPICLK[FSPICS0,
        FSPICS1, FSPICS2, FSPICS3, FSPICS4, FSPICS5] [FSPID, FSPIQ, FSPIWP, FSPIHD,
        FSPIIO4, FSPIIO5, FSPIIO6, FSPIIO7], true), (SPI3, Spi3, SPI3_CLK[SPI3_CS0,
        SPI3_CS1, SPI3_CS2] [SPI3_D, SPI3_Q])));
    };
}
/// This macro can be used to generate code for each peripheral instance of the SPI slave driver.
///
/// For an explanation on the general syntax, as well as usage of individual/repeated
/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
///
/// This macro has one option for its "Individual matcher" case:
///
/// Syntax: `($instance:ident, $sys:ident, $sclk:ident, $mosi:ident, $miso:ident, $cs:ident)`
///
/// Macro fragments:
///
/// - `$instance`: the name of the I2C instance
/// - `$sys`: the name of the instance as it is in the `esp_hal::system::Peripheral` enum.
/// - `$mosi`, `$miso`, `$cs`: signal names.
///
/// Example data: `(SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0)`
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_spi_slave {
    ($($pattern:tt => $code:tt;)*) => {
        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
        _for_each_inner!((SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0));
        _for_each_inner!((SPI3, Spi3, SPI3_CLK, SPI3_D, SPI3_Q, SPI3_CS0));
        _for_each_inner!((all(SPI2, Spi2, FSPICLK, FSPID, FSPIQ, FSPICS0), (SPI3, Spi3,
        SPI3_CLK, SPI3_D, SPI3_Q, SPI3_CS0)));
    };
}
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_peripheral {
    ($($pattern:tt => $code:tt;)*) => {
        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
        _for_each_inner!((GPIO0 <= virtual())); _for_each_inner!((GPIO1 <= virtual()));
        _for_each_inner!((GPIO2 <= virtual())); _for_each_inner!((GPIO3 <= virtual()));
        _for_each_inner!((GPIO4 <= virtual())); _for_each_inner!((GPIO5 <= virtual()));
        _for_each_inner!((GPIO6 <= virtual())); _for_each_inner!((GPIO7 <= virtual()));
        _for_each_inner!((GPIO8 <= virtual())); _for_each_inner!((GPIO9 <= virtual()));
        _for_each_inner!((GPIO10 <= virtual())); _for_each_inner!((GPIO11 <= virtual()));
        _for_each_inner!((GPIO12 <= virtual())); _for_each_inner!((GPIO13 <= virtual()));
        _for_each_inner!((GPIO14 <= virtual())); _for_each_inner!((GPIO15 <= virtual()));
        _for_each_inner!((GPIO16 <= virtual())); _for_each_inner!((GPIO17 <= virtual()));
        _for_each_inner!((GPIO18 <= virtual())); _for_each_inner!((GPIO19 <= virtual()));
        _for_each_inner!((GPIO20 <= virtual())); _for_each_inner!((GPIO21 <= virtual()));
        _for_each_inner!((GPIO33 <= virtual())); _for_each_inner!((GPIO34 <= virtual()));
        _for_each_inner!((GPIO35 <= virtual())); _for_each_inner!((GPIO36 <= virtual()));
        _for_each_inner!((GPIO37 <= virtual())); _for_each_inner!((GPIO38 <= virtual()));
        _for_each_inner!((GPIO39 <= virtual())); _for_each_inner!((GPIO40 <= virtual()));
        _for_each_inner!((GPIO41 <= virtual())); _for_each_inner!((GPIO42 <= virtual()));
        _for_each_inner!((GPIO43 <= virtual())); _for_each_inner!((GPIO44 <= virtual()));
        _for_each_inner!((GPIO45 <= virtual())); _for_each_inner!((GPIO46 <= virtual()));
        _for_each_inner!((AES <= AES(AES : { bind_peri_interrupt, enable_peri_interrupt,
        disable_peri_interrupt }) (unstable))); _for_each_inner!((APB_SARADC <=
        APB_SARADC() (unstable))); _for_each_inner!((DEDICATED_GPIO <= DEDICATED_GPIO()
        (unstable))); _for_each_inner!((DS <= DS() (unstable))); _for_each_inner!((EFUSE
        <= EFUSE() (unstable))); _for_each_inner!((EXTMEM <= EXTMEM() (unstable)));
        _for_each_inner!((FE <= FE() (unstable))); _for_each_inner!((FE2 <= FE2()
        (unstable))); _for_each_inner!((GPIO <= GPIO() (unstable)));
        _for_each_inner!((GPIO_SD <= GPIO_SD() (unstable))); _for_each_inner!((HMAC <=
        HMAC() (unstable))); _for_each_inner!((I2C_ANA_MST <= I2C_ANA_MST() (unstable)));
        _for_each_inner!((I2C0 <= I2C0(I2C_EXT0 : { bind_peri_interrupt,
        enable_peri_interrupt, disable_peri_interrupt }))); _for_each_inner!((I2C1 <=
        I2C1(I2C_EXT1 : { bind_peri_interrupt, enable_peri_interrupt,
        disable_peri_interrupt }))); _for_each_inner!((I2S0 <= I2S0(I2S0 : {
        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
        (unstable))); _for_each_inner!((INTERRUPT_CORE0 <= INTERRUPT_CORE0()
        (unstable))); _for_each_inner!((IO_MUX <= IO_MUX() (unstable)));
        _for_each_inner!((LEDC <= LEDC() (unstable))); _for_each_inner!((NRX <= NRX()
        (unstable))); _for_each_inner!((PCNT <= PCNT() (unstable)));
        _for_each_inner!((PMS <= PMS() (unstable))); _for_each_inner!((RMT <= RMT()
        (unstable))); _for_each_inner!((RNG <= RNG() (unstable))); _for_each_inner!((RSA
        <= RSA(RSA : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
        }) (unstable))); _for_each_inner!((LPWR <= RTC_CNTL() (unstable)));
        _for_each_inner!((RTC_I2C <= RTC_I2C() (unstable))); _for_each_inner!((RTC_IO <=
        RTC_IO() (unstable))); _for_each_inner!((SENS <= SENS() (unstable)));
        _for_each_inner!((SHA <= SHA(SHA : { bind_peri_interrupt, enable_peri_interrupt,
        disable_peri_interrupt }) (unstable))); _for_each_inner!((SPI0 <= SPI0()
        (unstable))); _for_each_inner!((SPI1 <= SPI1() (unstable)));
        _for_each_inner!((SPI2 <= SPI2(SPI2_DMA : { bind_dma_interrupt,
        enable_dma_interrupt, disable_dma_interrupt }, SPI2 : { bind_peri_interrupt,
        enable_peri_interrupt, disable_peri_interrupt }))); _for_each_inner!((SPI3 <=
        SPI3(SPI3_DMA : { bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt
        }, SPI3 : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
        }))); _for_each_inner!((SYSCON <= SYSCON() (unstable))); _for_each_inner!((SYSTEM
        <= SYSTEM() (unstable))); _for_each_inner!((SYSTIMER <= SYSTIMER() (unstable)));
        _for_each_inner!((TIMG0 <= TIMG0() (unstable))); _for_each_inner!((TIMG1 <=
        TIMG1() (unstable))); _for_each_inner!((TWAI0 <= TWAI0() (unstable)));
        _for_each_inner!((UART0 <= UART0(UART0 : { bind_peri_interrupt,
        enable_peri_interrupt, disable_peri_interrupt }))); _for_each_inner!((UART1 <=
        UART1(UART1 : { bind_peri_interrupt, enable_peri_interrupt,
        disable_peri_interrupt }))); _for_each_inner!((UHCI0 <= UHCI0() (unstable)));
        _for_each_inner!((USB0 <= USB0() (unstable))); _for_each_inner!((USB_WRAP <=
        USB_WRAP() (unstable))); _for_each_inner!((XTS_AES <= XTS_AES() (unstable)));
        _for_each_inner!((WIFI <= WIFI() (unstable))); _for_each_inner!((DMA_SPI2 <=
        SPI2() (unstable))); _for_each_inner!((DMA_SPI3 <= SPI3() (unstable)));
        _for_each_inner!((DMA_I2S0 <= I2S0() (unstable))); _for_each_inner!((DMA_CRYPTO
        <= CRYPTO_DMA() (unstable))); _for_each_inner!((DMA_COPY <= COPY_DMA()
        (unstable))); _for_each_inner!((ADC1 <= virtual() (unstable)));
        _for_each_inner!((ADC2 <= virtual() (unstable))); _for_each_inner!((DAC1 <=
        virtual() (unstable))); _for_each_inner!((DAC2 <= virtual() (unstable)));
        _for_each_inner!((FLASH <= virtual() (unstable))); _for_each_inner!((PSRAM <=
        virtual() (unstable))); _for_each_inner!((SW_INTERRUPT <= virtual() (unstable)));
        _for_each_inner!((ULP_RISCV_CORE <= virtual() (unstable)));
        _for_each_inner!((all(GPIO0 <= virtual()), (GPIO1 <= virtual()), (GPIO2 <=
        virtual()), (GPIO3 <= virtual()), (GPIO4 <= virtual()), (GPIO5 <= virtual()),
        (GPIO6 <= virtual()), (GPIO7 <= virtual()), (GPIO8 <= virtual()), (GPIO9 <=
        virtual()), (GPIO10 <= virtual()), (GPIO11 <= virtual()), (GPIO12 <= virtual()),
        (GPIO13 <= virtual()), (GPIO14 <= virtual()), (GPIO15 <= virtual()), (GPIO16 <=
        virtual()), (GPIO17 <= virtual()), (GPIO18 <= virtual()), (GPIO19 <= virtual()),
        (GPIO20 <= virtual()), (GPIO21 <= virtual()), (GPIO33 <= virtual()), (GPIO34 <=
        virtual()), (GPIO35 <= virtual()), (GPIO36 <= virtual()), (GPIO37 <= virtual()),
        (GPIO38 <= virtual()), (GPIO39 <= virtual()), (GPIO40 <= virtual()), (GPIO41 <=
        virtual()), (GPIO42 <= virtual()), (GPIO43 <= virtual()), (GPIO44 <= virtual()),
        (GPIO45 <= virtual()), (GPIO46 <= virtual()), (AES <= AES(AES : {
        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })
        (unstable)), (APB_SARADC <= APB_SARADC() (unstable)), (DEDICATED_GPIO <=
        DEDICATED_GPIO() (unstable)), (DS <= DS() (unstable)), (EFUSE <= EFUSE()
        (unstable)), (EXTMEM <= EXTMEM() (unstable)), (FE <= FE() (unstable)), (FE2 <=
        FE2() (unstable)), (GPIO <= GPIO() (unstable)), (GPIO_SD <= GPIO_SD()
        (unstable)), (HMAC <= HMAC() (unstable)), (I2C_ANA_MST <= I2C_ANA_MST()
        (unstable)), (I2C0 <= I2C0(I2C_EXT0 : { bind_peri_interrupt,
        enable_peri_interrupt, disable_peri_interrupt })), (I2C1 <= I2C1(I2C_EXT1 : {
        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (I2S0 <=
        I2S0(I2S0 : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
        }) (unstable)), (INTERRUPT_CORE0 <= INTERRUPT_CORE0() (unstable)), (IO_MUX <=
        IO_MUX() (unstable)), (LEDC <= LEDC() (unstable)), (NRX <= NRX() (unstable)),
        (PCNT <= PCNT() (unstable)), (PMS <= PMS() (unstable)), (RMT <= RMT()
        (unstable)), (RNG <= RNG() (unstable)), (RSA <= RSA(RSA : { bind_peri_interrupt,
        enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (LPWR <= RTC_CNTL()
        (unstable)), (RTC_I2C <= RTC_I2C() (unstable)), (RTC_IO <= RTC_IO() (unstable)),
        (SENS <= SENS() (unstable)), (SHA <= SHA(SHA : { bind_peri_interrupt,
        enable_peri_interrupt, disable_peri_interrupt }) (unstable)), (SPI0 <= SPI0()
        (unstable)), (SPI1 <= SPI1() (unstable)), (SPI2 <= SPI2(SPI2_DMA : {
        bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt }, SPI2 : {
        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (SPI3 <=
        SPI3(SPI3_DMA : { bind_dma_interrupt, enable_dma_interrupt, disable_dma_interrupt
        }, SPI3 : { bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt
        })), (SYSCON <= SYSCON() (unstable)), (SYSTEM <= SYSTEM() (unstable)), (SYSTIMER
        <= SYSTIMER() (unstable)), (TIMG0 <= TIMG0() (unstable)), (TIMG1 <= TIMG1()
        (unstable)), (TWAI0 <= TWAI0() (unstable)), (UART0 <= UART0(UART0 : {
        bind_peri_interrupt, enable_peri_interrupt, disable_peri_interrupt })), (UART1 <=
        UART1(UART1 : { bind_peri_interrupt, enable_peri_interrupt,
        disable_peri_interrupt })), (UHCI0 <= UHCI0() (unstable)), (USB0 <= USB0()
        (unstable)), (USB_WRAP <= USB_WRAP() (unstable)), (XTS_AES <= XTS_AES()
        (unstable)), (WIFI <= WIFI() (unstable)), (DMA_SPI2 <= SPI2() (unstable)),
        (DMA_SPI3 <= SPI3() (unstable)), (DMA_I2S0 <= I2S0() (unstable)), (DMA_CRYPTO <=
        CRYPTO_DMA() (unstable)), (DMA_COPY <= COPY_DMA() (unstable)), (ADC1 <= virtual()
        (unstable)), (ADC2 <= virtual() (unstable)), (DAC1 <= virtual() (unstable)),
        (DAC2 <= virtual() (unstable)), (FLASH <= virtual() (unstable)), (PSRAM <=
        virtual() (unstable)), (SW_INTERRUPT <= virtual() (unstable)), (ULP_RISCV_CORE <=
        virtual() (unstable))));
    };
}
/// This macro can be used to generate code for each `GPIOn` instance.
///
/// For an explanation on the general syntax, as well as usage of individual/repeated
/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
///
/// This macro has one option for its "Individual matcher" case:
///
/// Syntax: `($n:literal, $gpio:ident ($($digital_input_function:ident =>
/// $digital_input_signal:ident)*) ($($digital_output_function:ident =>
/// $digital_output_signal:ident)*) ($([$pin_attribute:ident])*))`
///
/// Macro fragments:
///
/// - `$n`: the number of the GPIO. For `GPIO0`, `$n` is 0.
/// - `$gpio`: the name of the GPIO.
/// - `$digital_input_function`: the number of the digital function, as an identifier (i.e. for
///   function 0 this is `_0`).
/// - `$digital_input_function`: the name of the digital function, as an identifier.
/// - `$digital_output_function`: the number of the digital function, as an identifier (i.e. for
///   function 0 this is `_0`).
/// - `$digital_output_function`: the name of the digital function, as an identifier.
/// - `$pin_attribute`: `Input` and/or `Output`, marks the possible directions of the GPIO.
///   Bracketed so that they can also be matched as optional fragments. Order is always Input first.
///
/// Example data: `(0, GPIO0 (_5 => EMAC_TX_CLK) (_1 => CLK_OUT1 _5 => EMAC_TX_CLK) ([Input]
/// [Output]))`
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_gpio {
    ($($pattern:tt => $code:tt;)*) => {
        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
        _for_each_inner!((0, GPIO0() () ([Input] [Output]))); _for_each_inner!((1,
        GPIO1() () ([Input] [Output]))); _for_each_inner!((2, GPIO2() () ([Input]
        [Output]))); _for_each_inner!((3, GPIO3() () ([Input] [Output])));
        _for_each_inner!((4, GPIO4() () ([Input] [Output]))); _for_each_inner!((5,
        GPIO5() () ([Input] [Output]))); _for_each_inner!((6, GPIO6() () ([Input]
        [Output]))); _for_each_inner!((7, GPIO7() () ([Input] [Output])));
        _for_each_inner!((8, GPIO8() (_3 => SUBSPICS1) ([Input] [Output])));
        _for_each_inner!((9, GPIO9(_3 => SUBSPIHD _4 => FSPIHD) (_3 => SUBSPIHD _4 =>
        FSPIHD) ([Input] [Output]))); _for_each_inner!((10, GPIO10(_2 => FSPIIO4 _4 =>
        FSPICS0) (_2 => FSPIIO4 _3 => SUBSPICS0 _4 => FSPICS0) ([Input] [Output])));
        _for_each_inner!((11, GPIO11(_2 => FSPIIO5 _3 => SUBSPID _4 => FSPID) (_2 =>
        FSPIIO5 _3 => SUBSPID _4 => FSPID) ([Input] [Output]))); _for_each_inner!((12,
        GPIO12(_2 => FSPIIO6 _4 => FSPICLK) (_2 => FSPIIO6 _3 => SUBSPICLK _4 => FSPICLK)
        ([Input] [Output]))); _for_each_inner!((13, GPIO13(_2 => FSPIIO7 _3 => SUBSPIQ _4
        => FSPIQ) (_2 => FSPIIO7 _3 => SUBSPIQ _4 => FSPIQ) ([Input] [Output])));
        _for_each_inner!((14, GPIO14(_3 => SUBSPIWP _4 => FSPIWP) (_2 => FSPIDQS _3 =>
        SUBSPIWP _4 => FSPIWP) ([Input] [Output]))); _for_each_inner!((15, GPIO15() (_2
        => U0RTS) ([Input] [Output]))); _for_each_inner!((16, GPIO16(_2 => U0CTS) ()
        ([Input] [Output]))); _for_each_inner!((17, GPIO17() (_2 => U1TXD) ([Input]
        [Output]))); _for_each_inner!((18, GPIO18(_2 => U1RXD) (_3 => CLK_OUT3) ([Input]
        [Output]))); _for_each_inner!((19, GPIO19() (_2 => U1RTS _3 => CLK_OUT2) ([Input]
        [Output]))); _for_each_inner!((20, GPIO20(_2 => U1CTS) (_3 => CLK_OUT1) ([Input]
        [Output]))); _for_each_inner!((21, GPIO21() () ([Input] [Output])));
        _for_each_inner!((33, GPIO33(_2 => FSPIHD _3 => SUBSPIHD) (_2 => FSPIHD _3 =>
        SUBSPIHD) ([Input] [Output]))); _for_each_inner!((34, GPIO34(_2 => FSPICS0) (_2
        => FSPICS0 _3 => SUBSPICS0) ([Input] [Output]))); _for_each_inner!((35, GPIO35(_2
        => FSPID _3 => SUBSPID) (_2 => FSPID _3 => SUBSPID) ([Input] [Output])));
        _for_each_inner!((36, GPIO36(_2 => FSPICLK) (_2 => FSPICLK _3 => SUBSPICLK)
        ([Input] [Output]))); _for_each_inner!((37, GPIO37(_2 => FSPIQ _3 => SUBSPIQ _4
        => SPIDQS) (_2 => FSPIQ _3 => SUBSPIQ _4 => SPIDQS) ([Input] [Output])));
        _for_each_inner!((38, GPIO38(_2 => FSPIWP _3 => SUBSPIWP) (_2 => FSPIWP _3 =>
        SUBSPIWP) ([Input] [Output]))); _for_each_inner!((39, GPIO39(_0 => MTCK) (_2 =>
        CLK_OUT3 _3 => SUBSPICS1) ([Input] [Output]))); _for_each_inner!((40, GPIO40()
        (_0 => MTDO _2 => CLK_OUT2) ([Input] [Output]))); _for_each_inner!((41, GPIO41(_0
        => MTDI) (_2 => CLK_OUT1) ([Input] [Output]))); _for_each_inner!((42, GPIO42(_0
        => MTMS) () ([Input] [Output]))); _for_each_inner!((43, GPIO43() (_0 => U0TXD _2
        => CLK_OUT1) ([Input] [Output]))); _for_each_inner!((44, GPIO44(_0 => U0RXD) (_2
        => CLK_OUT2) ([Input] [Output]))); _for_each_inner!((45, GPIO45() () ([Input]
        [Output]))); _for_each_inner!((46, GPIO46() () ([Input] [Output])));
        _for_each_inner!((all(0, GPIO0() () ([Input] [Output])), (1, GPIO1() () ([Input]
        [Output])), (2, GPIO2() () ([Input] [Output])), (3, GPIO3() () ([Input]
        [Output])), (4, GPIO4() () ([Input] [Output])), (5, GPIO5() () ([Input]
        [Output])), (6, GPIO6() () ([Input] [Output])), (7, GPIO7() () ([Input]
        [Output])), (8, GPIO8() (_3 => SUBSPICS1) ([Input] [Output])), (9, GPIO9(_3 =>
        SUBSPIHD _4 => FSPIHD) (_3 => SUBSPIHD _4 => FSPIHD) ([Input] [Output])), (10,
        GPIO10(_2 => FSPIIO4 _4 => FSPICS0) (_2 => FSPIIO4 _3 => SUBSPICS0 _4 => FSPICS0)
        ([Input] [Output])), (11, GPIO11(_2 => FSPIIO5 _3 => SUBSPID _4 => FSPID) (_2 =>
        FSPIIO5 _3 => SUBSPID _4 => FSPID) ([Input] [Output])), (12, GPIO12(_2 => FSPIIO6
        _4 => FSPICLK) (_2 => FSPIIO6 _3 => SUBSPICLK _4 => FSPICLK) ([Input] [Output])),
        (13, GPIO13(_2 => FSPIIO7 _3 => SUBSPIQ _4 => FSPIQ) (_2 => FSPIIO7 _3 => SUBSPIQ
        _4 => FSPIQ) ([Input] [Output])), (14, GPIO14(_3 => SUBSPIWP _4 => FSPIWP) (_2 =>
        FSPIDQS _3 => SUBSPIWP _4 => FSPIWP) ([Input] [Output])), (15, GPIO15() (_2 =>
        U0RTS) ([Input] [Output])), (16, GPIO16(_2 => U0CTS) () ([Input] [Output])), (17,
        GPIO17() (_2 => U1TXD) ([Input] [Output])), (18, GPIO18(_2 => U1RXD) (_3 =>
        CLK_OUT3) ([Input] [Output])), (19, GPIO19() (_2 => U1RTS _3 => CLK_OUT2)
        ([Input] [Output])), (20, GPIO20(_2 => U1CTS) (_3 => CLK_OUT1) ([Input]
        [Output])), (21, GPIO21() () ([Input] [Output])), (33, GPIO33(_2 => FSPIHD _3 =>
        SUBSPIHD) (_2 => FSPIHD _3 => SUBSPIHD) ([Input] [Output])), (34, GPIO34(_2 =>
        FSPICS0) (_2 => FSPICS0 _3 => SUBSPICS0) ([Input] [Output])), (35, GPIO35(_2 =>
        FSPID _3 => SUBSPID) (_2 => FSPID _3 => SUBSPID) ([Input] [Output])), (36,
        GPIO36(_2 => FSPICLK) (_2 => FSPICLK _3 => SUBSPICLK) ([Input] [Output])), (37,
        GPIO37(_2 => FSPIQ _3 => SUBSPIQ _4 => SPIDQS) (_2 => FSPIQ _3 => SUBSPIQ _4 =>
        SPIDQS) ([Input] [Output])), (38, GPIO38(_2 => FSPIWP _3 => SUBSPIWP) (_2 =>
        FSPIWP _3 => SUBSPIWP) ([Input] [Output])), (39, GPIO39(_0 => MTCK) (_2 =>
        CLK_OUT3 _3 => SUBSPICS1) ([Input] [Output])), (40, GPIO40() (_0 => MTDO _2 =>
        CLK_OUT2) ([Input] [Output])), (41, GPIO41(_0 => MTDI) (_2 => CLK_OUT1) ([Input]
        [Output])), (42, GPIO42(_0 => MTMS) () ([Input] [Output])), (43, GPIO43() (_0 =>
        U0TXD _2 => CLK_OUT1) ([Input] [Output])), (44, GPIO44(_0 => U0RXD) (_2 =>
        CLK_OUT2) ([Input] [Output])), (45, GPIO45() () ([Input] [Output])), (46,
        GPIO46() () ([Input] [Output]))));
    };
}
/// This macro can be used to generate code for each analog function of each GPIO.
///
/// For an explanation on the general syntax, as well as usage of individual/repeated
/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
///
/// This macro has two options for its "Individual matcher" case:
///
/// - `all`: `($signal:ident, $gpio:ident)` - simple case where you only need identifiers
/// - `all_expanded`: `(($signal:ident, $group:ident $(, $number:literal)+), $gpio:ident)` -
///   expanded signal case, where you need the number(s) of a signal, or the general group to which
///   the signal belongs. For example, in case of `ADC2_CH3` the expanded form looks like
///   `(ADC2_CH3, ADCn_CHm, 2, 3)`.
///
/// Macro fragments:
///
/// - `$signal`: the name of the signal.
/// - `$group`: the name of the signal, with numbers replaced by placeholders. For `ADC2_CH3` this
///   is `ADCn_CHm`.
/// - `$number`: the numbers extracted from `$signal`.
/// - `$gpio`: the name of the GPIO.
///
/// Example data:
/// - `(ADC2_CH5, GPIO12)`
/// - `((ADC2_CH5, ADCn_CHm, 2, 5), GPIO12)`
///
/// The expanded syntax is only available when the signal has at least one numbered component.
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_analog_function {
    ($($pattern:tt => $code:tt;)*) => {
        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
        _for_each_inner!((TOUCH1, GPIO1)); _for_each_inner!((ADC1_CH0, GPIO1));
        _for_each_inner!((TOUCH2, GPIO2)); _for_each_inner!((ADC1_CH1, GPIO2));
        _for_each_inner!((TOUCH3, GPIO3)); _for_each_inner!((ADC1_CH2, GPIO3));
        _for_each_inner!((TOUCH4, GPIO4)); _for_each_inner!((ADC1_CH3, GPIO4));
        _for_each_inner!((TOUCH5, GPIO5)); _for_each_inner!((ADC1_CH4, GPIO5));
        _for_each_inner!((TOUCH6, GPIO6)); _for_each_inner!((ADC1_CH5, GPIO6));
        _for_each_inner!((TOUCH7, GPIO7)); _for_each_inner!((ADC1_CH6, GPIO7));
        _for_each_inner!((TOUCH8, GPIO8)); _for_each_inner!((ADC1_CH7, GPIO8));
        _for_each_inner!((TOUCH9, GPIO9)); _for_each_inner!((ADC1_CH8, GPIO9));
        _for_each_inner!((TOUCH10, GPIO10)); _for_each_inner!((ADC1_CH9, GPIO10));
        _for_each_inner!((TOUCH11, GPIO11)); _for_each_inner!((ADC2_CH0, GPIO11));
        _for_each_inner!((TOUCH12, GPIO12)); _for_each_inner!((ADC2_CH1, GPIO12));
        _for_each_inner!((TOUCH13, GPIO13)); _for_each_inner!((ADC2_CH2, GPIO13));
        _for_each_inner!((TOUCH14, GPIO14)); _for_each_inner!((ADC2_CH3, GPIO14));
        _for_each_inner!((XTAL_32K_P, GPIO15)); _for_each_inner!((ADC2_CH4, GPIO15));
        _for_each_inner!((XTAL_32K_N, GPIO16)); _for_each_inner!((ADC2_CH5, GPIO16));
        _for_each_inner!((DAC_1, GPIO17)); _for_each_inner!((ADC2_CH6, GPIO17));
        _for_each_inner!((DAC_2, GPIO18)); _for_each_inner!((ADC2_CH7, GPIO18));
        _for_each_inner!((USB_DM, GPIO19)); _for_each_inner!((ADC2_CH8, GPIO19));
        _for_each_inner!((USB_DP, GPIO20)); _for_each_inner!((ADC2_CH9, GPIO20));
        _for_each_inner!(((TOUCH1, TOUCHn, 1), GPIO1)); _for_each_inner!(((ADC1_CH0,
        ADCn_CHm, 1, 0), GPIO1)); _for_each_inner!(((TOUCH2, TOUCHn, 2), GPIO2));
        _for_each_inner!(((ADC1_CH1, ADCn_CHm, 1, 1), GPIO2)); _for_each_inner!(((TOUCH3,
        TOUCHn, 3), GPIO3)); _for_each_inner!(((ADC1_CH2, ADCn_CHm, 1, 2), GPIO3));
        _for_each_inner!(((TOUCH4, TOUCHn, 4), GPIO4)); _for_each_inner!(((ADC1_CH3,
        ADCn_CHm, 1, 3), GPIO4)); _for_each_inner!(((TOUCH5, TOUCHn, 5), GPIO5));
        _for_each_inner!(((ADC1_CH4, ADCn_CHm, 1, 4), GPIO5)); _for_each_inner!(((TOUCH6,
        TOUCHn, 6), GPIO6)); _for_each_inner!(((ADC1_CH5, ADCn_CHm, 1, 5), GPIO6));
        _for_each_inner!(((TOUCH7, TOUCHn, 7), GPIO7)); _for_each_inner!(((ADC1_CH6,
        ADCn_CHm, 1, 6), GPIO7)); _for_each_inner!(((TOUCH8, TOUCHn, 8), GPIO8));
        _for_each_inner!(((ADC1_CH7, ADCn_CHm, 1, 7), GPIO8)); _for_each_inner!(((TOUCH9,
        TOUCHn, 9), GPIO9)); _for_each_inner!(((ADC1_CH8, ADCn_CHm, 1, 8), GPIO9));
        _for_each_inner!(((TOUCH10, TOUCHn, 10), GPIO10)); _for_each_inner!(((ADC1_CH9,
        ADCn_CHm, 1, 9), GPIO10)); _for_each_inner!(((TOUCH11, TOUCHn, 11), GPIO11));
        _for_each_inner!(((ADC2_CH0, ADCn_CHm, 2, 0), GPIO11));
        _for_each_inner!(((TOUCH12, TOUCHn, 12), GPIO12)); _for_each_inner!(((ADC2_CH1,
        ADCn_CHm, 2, 1), GPIO12)); _for_each_inner!(((TOUCH13, TOUCHn, 13), GPIO13));
        _for_each_inner!(((ADC2_CH2, ADCn_CHm, 2, 2), GPIO13));
        _for_each_inner!(((TOUCH14, TOUCHn, 14), GPIO14)); _for_each_inner!(((ADC2_CH3,
        ADCn_CHm, 2, 3), GPIO14)); _for_each_inner!(((ADC2_CH4, ADCn_CHm, 2, 4),
        GPIO15)); _for_each_inner!(((ADC2_CH5, ADCn_CHm, 2, 5), GPIO16));
        _for_each_inner!(((DAC_1, DAC_n, 1), GPIO17)); _for_each_inner!(((ADC2_CH6,
        ADCn_CHm, 2, 6), GPIO17)); _for_each_inner!(((DAC_2, DAC_n, 2), GPIO18));
        _for_each_inner!(((ADC2_CH7, ADCn_CHm, 2, 7), GPIO18));
        _for_each_inner!(((ADC2_CH8, ADCn_CHm, 2, 8), GPIO19));
        _for_each_inner!(((ADC2_CH9, ADCn_CHm, 2, 9), GPIO20));
        _for_each_inner!((all(TOUCH1, GPIO1), (ADC1_CH0, GPIO1), (TOUCH2, GPIO2),
        (ADC1_CH1, GPIO2), (TOUCH3, GPIO3), (ADC1_CH2, GPIO3), (TOUCH4, GPIO4),
        (ADC1_CH3, GPIO4), (TOUCH5, GPIO5), (ADC1_CH4, GPIO5), (TOUCH6, GPIO6),
        (ADC1_CH5, GPIO6), (TOUCH7, GPIO7), (ADC1_CH6, GPIO7), (TOUCH8, GPIO8),
        (ADC1_CH7, GPIO8), (TOUCH9, GPIO9), (ADC1_CH8, GPIO9), (TOUCH10, GPIO10),
        (ADC1_CH9, GPIO10), (TOUCH11, GPIO11), (ADC2_CH0, GPIO11), (TOUCH12, GPIO12),
        (ADC2_CH1, GPIO12), (TOUCH13, GPIO13), (ADC2_CH2, GPIO13), (TOUCH14, GPIO14),
        (ADC2_CH3, GPIO14), (XTAL_32K_P, GPIO15), (ADC2_CH4, GPIO15), (XTAL_32K_N,
        GPIO16), (ADC2_CH5, GPIO16), (DAC_1, GPIO17), (ADC2_CH6, GPIO17), (DAC_2,
        GPIO18), (ADC2_CH7, GPIO18), (USB_DM, GPIO19), (ADC2_CH8, GPIO19), (USB_DP,
        GPIO20), (ADC2_CH9, GPIO20))); _for_each_inner!((all_expanded((TOUCH1, TOUCHn,
        1), GPIO1), ((ADC1_CH0, ADCn_CHm, 1, 0), GPIO1), ((TOUCH2, TOUCHn, 2), GPIO2),
        ((ADC1_CH1, ADCn_CHm, 1, 1), GPIO2), ((TOUCH3, TOUCHn, 3), GPIO3), ((ADC1_CH2,
        ADCn_CHm, 1, 2), GPIO3), ((TOUCH4, TOUCHn, 4), GPIO4), ((ADC1_CH3, ADCn_CHm, 1,
        3), GPIO4), ((TOUCH5, TOUCHn, 5), GPIO5), ((ADC1_CH4, ADCn_CHm, 1, 4), GPIO5),
        ((TOUCH6, TOUCHn, 6), GPIO6), ((ADC1_CH5, ADCn_CHm, 1, 5), GPIO6), ((TOUCH7,
        TOUCHn, 7), GPIO7), ((ADC1_CH6, ADCn_CHm, 1, 6), GPIO7), ((TOUCH8, TOUCHn, 8),
        GPIO8), ((ADC1_CH7, ADCn_CHm, 1, 7), GPIO8), ((TOUCH9, TOUCHn, 9), GPIO9),
        ((ADC1_CH8, ADCn_CHm, 1, 8), GPIO9), ((TOUCH10, TOUCHn, 10), GPIO10), ((ADC1_CH9,
        ADCn_CHm, 1, 9), GPIO10), ((TOUCH11, TOUCHn, 11), GPIO11), ((ADC2_CH0, ADCn_CHm,
        2, 0), GPIO11), ((TOUCH12, TOUCHn, 12), GPIO12), ((ADC2_CH1, ADCn_CHm, 2, 1),
        GPIO12), ((TOUCH13, TOUCHn, 13), GPIO13), ((ADC2_CH2, ADCn_CHm, 2, 2), GPIO13),
        ((TOUCH14, TOUCHn, 14), GPIO14), ((ADC2_CH3, ADCn_CHm, 2, 3), GPIO14),
        ((ADC2_CH4, ADCn_CHm, 2, 4), GPIO15), ((ADC2_CH5, ADCn_CHm, 2, 5), GPIO16),
        ((DAC_1, DAC_n, 1), GPIO17), ((ADC2_CH6, ADCn_CHm, 2, 6), GPIO17), ((DAC_2,
        DAC_n, 2), GPIO18), ((ADC2_CH7, ADCn_CHm, 2, 7), GPIO18), ((ADC2_CH8, ADCn_CHm,
        2, 8), GPIO19), ((ADC2_CH9, ADCn_CHm, 2, 9), GPIO20)));
    };
}
/// This macro can be used to generate code for each LP/RTC function of each GPIO.
///
/// For an explanation on the general syntax, as well as usage of individual/repeated
/// matchers, refer to [the crate-level documentation][crate#for_each-macros].
///
/// This macro has two options for its "Individual matcher" case:
///
/// - `all`: `($signal:ident, $gpio:ident)` - simple case where you only need identifiers
/// - `all_expanded`: `(($signal:ident, $group:ident $(, $number:literal)+), $gpio:ident)` -
///   expanded signal case, where you need the number(s) of a signal, or the general group to which
///   the signal belongs. For example, in case of `SAR_I2C_SCL_1` the expanded form looks like
///   `(SAR_I2C_SCL_1, SAR_I2C_SCL_n, 1)`.
///
/// Macro fragments:
///
/// - `$signal`: the name of the signal.
/// - `$group`: the name of the signal, with numbers replaced by placeholders. For `ADC2_CH3` this
///   is `ADCn_CHm`.
/// - `$number`: the numbers extracted from `$signal`.
/// - `$gpio`: the name of the GPIO.
///
/// Example data:
/// - `(RTC_GPIO15, GPIO12)`
/// - `((RTC_GPIO15, RTC_GPIOn, 15), GPIO12)`
///
/// The expanded syntax is only available when the signal has at least one numbered component.
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! for_each_lp_function {
    ($($pattern:tt => $code:tt;)*) => {
        macro_rules! _for_each_inner { $(($pattern) => $code;)* ($other : tt) => {} }
        _for_each_inner!((RTC_GPIO0, GPIO0)); _for_each_inner!((RTC_GPIO1, GPIO1));
        _for_each_inner!((RTC_GPIO2, GPIO2)); _for_each_inner!((RTC_GPIO3, GPIO3));
        _for_each_inner!((RTC_GPIO4, GPIO4)); _for_each_inner!((RTC_GPIO5, GPIO5));
        _for_each_inner!((RTC_GPIO6, GPIO6)); _for_each_inner!((RTC_GPIO7, GPIO7));
        _for_each_inner!((RTC_GPIO8, GPIO8)); _for_each_inner!((RTC_GPIO9, GPIO9));
        _for_each_inner!((RTC_GPIO10, GPIO10)); _for_each_inner!((RTC_GPIO11, GPIO11));
        _for_each_inner!((RTC_GPIO12, GPIO12)); _for_each_inner!((RTC_GPIO13, GPIO13));
        _for_each_inner!((RTC_GPIO14, GPIO14)); _for_each_inner!((RTC_GPIO15, GPIO15));
        _for_each_inner!((RTC_GPIO16, GPIO16)); _for_each_inner!((RTC_GPIO17, GPIO17));
        _for_each_inner!((RTC_GPIO18, GPIO18)); _for_each_inner!((RTC_GPIO19, GPIO19));
        _for_each_inner!((RTC_GPIO20, GPIO20)); _for_each_inner!((RTC_GPIO21, GPIO21));
        _for_each_inner!(((RTC_GPIO0, RTC_GPIOn, 0), GPIO0));
        _for_each_inner!(((RTC_GPIO1, RTC_GPIOn, 1), GPIO1));
        _for_each_inner!(((RTC_GPIO2, RTC_GPIOn, 2), GPIO2));
        _for_each_inner!(((RTC_GPIO3, RTC_GPIOn, 3), GPIO3));
        _for_each_inner!(((RTC_GPIO4, RTC_GPIOn, 4), GPIO4));
        _for_each_inner!(((RTC_GPIO5, RTC_GPIOn, 5), GPIO5));
        _for_each_inner!(((RTC_GPIO6, RTC_GPIOn, 6), GPIO6));
        _for_each_inner!(((RTC_GPIO7, RTC_GPIOn, 7), GPIO7));
        _for_each_inner!(((RTC_GPIO8, RTC_GPIOn, 8), GPIO8));
        _for_each_inner!(((RTC_GPIO9, RTC_GPIOn, 9), GPIO9));
        _for_each_inner!(((RTC_GPIO10, RTC_GPIOn, 10), GPIO10));
        _for_each_inner!(((RTC_GPIO11, RTC_GPIOn, 11), GPIO11));
        _for_each_inner!(((RTC_GPIO12, RTC_GPIOn, 12), GPIO12));
        _for_each_inner!(((RTC_GPIO13, RTC_GPIOn, 13), GPIO13));
        _for_each_inner!(((RTC_GPIO14, RTC_GPIOn, 14), GPIO14));
        _for_each_inner!(((RTC_GPIO15, RTC_GPIOn, 15), GPIO15));
        _for_each_inner!(((RTC_GPIO16, RTC_GPIOn, 16), GPIO16));
        _for_each_inner!(((RTC_GPIO17, RTC_GPIOn, 17), GPIO17));
        _for_each_inner!(((RTC_GPIO18, RTC_GPIOn, 18), GPIO18));
        _for_each_inner!(((RTC_GPIO19, RTC_GPIOn, 19), GPIO19));
        _for_each_inner!(((RTC_GPIO20, RTC_GPIOn, 20), GPIO20));
        _for_each_inner!(((RTC_GPIO21, RTC_GPIOn, 21), GPIO21));
        _for_each_inner!((all(RTC_GPIO0, GPIO0), (RTC_GPIO1, GPIO1), (RTC_GPIO2, GPIO2),
        (RTC_GPIO3, GPIO3), (RTC_GPIO4, GPIO4), (RTC_GPIO5, GPIO5), (RTC_GPIO6, GPIO6),
        (RTC_GPIO7, GPIO7), (RTC_GPIO8, GPIO8), (RTC_GPIO9, GPIO9), (RTC_GPIO10, GPIO10),
        (RTC_GPIO11, GPIO11), (RTC_GPIO12, GPIO12), (RTC_GPIO13, GPIO13), (RTC_GPIO14,
        GPIO14), (RTC_GPIO15, GPIO15), (RTC_GPIO16, GPIO16), (RTC_GPIO17, GPIO17),
        (RTC_GPIO18, GPIO18), (RTC_GPIO19, GPIO19), (RTC_GPIO20, GPIO20), (RTC_GPIO21,
        GPIO21))); _for_each_inner!((all_expanded((RTC_GPIO0, RTC_GPIOn, 0), GPIO0),
        ((RTC_GPIO1, RTC_GPIOn, 1), GPIO1), ((RTC_GPIO2, RTC_GPIOn, 2), GPIO2),
        ((RTC_GPIO3, RTC_GPIOn, 3), GPIO3), ((RTC_GPIO4, RTC_GPIOn, 4), GPIO4),
        ((RTC_GPIO5, RTC_GPIOn, 5), GPIO5), ((RTC_GPIO6, RTC_GPIOn, 6), GPIO6),
        ((RTC_GPIO7, RTC_GPIOn, 7), GPIO7), ((RTC_GPIO8, RTC_GPIOn, 8), GPIO8),
        ((RTC_GPIO9, RTC_GPIOn, 9), GPIO9), ((RTC_GPIO10, RTC_GPIOn, 10), GPIO10),
        ((RTC_GPIO11, RTC_GPIOn, 11), GPIO11), ((RTC_GPIO12, RTC_GPIOn, 12), GPIO12),
        ((RTC_GPIO13, RTC_GPIOn, 13), GPIO13), ((RTC_GPIO14, RTC_GPIOn, 14), GPIO14),
        ((RTC_GPIO15, RTC_GPIOn, 15), GPIO15), ((RTC_GPIO16, RTC_GPIOn, 16), GPIO16),
        ((RTC_GPIO17, RTC_GPIOn, 17), GPIO17), ((RTC_GPIO18, RTC_GPIOn, 18), GPIO18),
        ((RTC_GPIO19, RTC_GPIOn, 19), GPIO19), ((RTC_GPIO20, RTC_GPIOn, 20), GPIO20),
        ((RTC_GPIO21, RTC_GPIOn, 21), GPIO21)));
    };
}
/// Defines the `InputSignal` and `OutputSignal` enums.
///
/// This macro is intended to be called in esp-hal only.
#[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! define_io_mux_signals {
    () => {
        #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
        #[derive(Debug, PartialEq, Copy, Clone)]
        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
        #[doc(hidden)]
        pub enum InputSignal {
            SPIQ              = 0,
            SPID              = 1,
            SPIHD             = 2,
            SPIWP             = 3,
            SPID4             = 7,
            SPID5             = 8,
            SPID6             = 9,
            SPID7             = 10,
            SPIDQS            = 11,
            U0RXD             = 14,
            U0CTS             = 15,
            U0DSR             = 16,
            U1RXD             = 17,
            U1CTS             = 18,
            U1DSR             = 21,
            I2S0O_BCK         = 23,
            I2S0O_WS          = 25,
            I2S0I_BCK         = 27,
            I2S0I_WS          = 28,
            I2CEXT0_SCL       = 29,
            I2CEXT0_SDA       = 30,
            PCNT0_SIG_CH0     = 39,
            PCNT0_SIG_CH1     = 40,
            PCNT0_CTRL_CH0    = 41,
            PCNT0_CTRL_CH1    = 42,
            PCNT1_SIG_CH0     = 43,
            PCNT1_SIG_CH1     = 44,
            PCNT1_CTRL_CH0    = 45,
            PCNT1_CTRL_CH1    = 46,
            PCNT2_SIG_CH0     = 47,
            PCNT2_SIG_CH1     = 48,
            PCNT2_CTRL_CH0    = 49,
            PCNT2_CTRL_CH1    = 50,
            PCNT3_SIG_CH0     = 51,
            PCNT3_SIG_CH1     = 52,
            PCNT3_CTRL_CH0    = 53,
            PCNT3_CTRL_CH1    = 54,
            USB_EXTPHY_VP     = 61,
            USB_EXTPHY_VM     = 62,
            USB_EXTPHY_RCV    = 63,
            USB_OTG_IDDIG     = 64,
            USB_OTG_AVALID    = 65,
            USB_SRP_BVALID    = 66,
            USB_OTG_VBUSVALID = 67,
            USB_SRP_SESSEND   = 68,
            SPI3_CLK          = 72,
            SPI3_Q            = 73,
            SPI3_D            = 74,
            SPI3_HD           = 75,
            SPI3_CS0          = 76,
            RMT_SIG_0         = 83,
            RMT_SIG_1         = 84,
            RMT_SIG_2         = 85,
            RMT_SIG_3         = 86,
            I2CEXT1_SCL       = 95,
            I2CEXT1_SDA       = 96,
            FSPICLK           = 108,
            FSPIQ             = 109,
            FSPID             = 110,
            FSPIHD            = 111,
            FSPIWP            = 112,
            FSPIIO4           = 113,
            FSPIIO5           = 114,
            FSPIIO6           = 115,
            FSPIIO7           = 116,
            FSPICS0           = 117,
            TWAI_RX           = 123,
            SUBSPIQ           = 127,
            SUBSPID           = 128,
            SUBSPIHD          = 129,
            SUBSPIWP          = 130,
            I2S0I_DATA_IN15   = 158,
            SUBSPID4          = 167,
            SUBSPID5          = 168,
            SUBSPID6          = 169,
            SUBSPID7          = 170,
            SUBSPIDQS         = 171,
            PCMFSYNC          = 203,
            PCMCLK            = 204,
            PRO_ALONEGPIO_IN0 = 235,
            PRO_ALONEGPIO_IN1 = 236,
            PRO_ALONEGPIO_IN2 = 237,
            PRO_ALONEGPIO_IN3 = 238,
            PRO_ALONEGPIO_IN4 = 239,
            PRO_ALONEGPIO_IN5 = 240,
            PRO_ALONEGPIO_IN6 = 241,
            PRO_ALONEGPIO_IN7 = 242,
            MTDI,
            MTCK,
            MTMS,
        }
        #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
        #[derive(Debug, PartialEq, Copy, Clone)]
        #[cfg_attr(feature = "defmt", derive(defmt::Format))]
        #[doc(hidden)]
        pub enum OutputSignal {
            SPIQ               = 0,
            SPID               = 1,
            SPIHD              = 2,
            SPIWP              = 3,
            SPICLK             = 4,
            SPICS0             = 5,
            SPICS1             = 6,
            SPID4              = 7,
            SPID5              = 8,
            SPID6              = 9,
            SPID7              = 10,
            SPIDQS             = 11,
            U0TXD              = 14,
            U0RTS              = 15,
            U0DTR              = 16,
            U1TXD              = 17,
            U1RTS              = 18,
            U1DTR              = 21,
            I2S0O_BCK          = 23,
            I2S0O_WS           = 25,
            I2S0I_BCK          = 27,
            I2S0I_WS           = 28,
            I2CEXT0_SCL        = 29,
            I2CEXT0_SDA        = 30,
            SDIO_TOHOST_INT    = 31,
            USB_EXTPHY_OEN     = 61,
            USB_EXTPHY_VPO     = 63,
            USB_EXTPHY_VMO     = 64,
            SPI3_CLK           = 72,
            SPI3_Q             = 73,
            SPI3_D             = 74,
            SPI3_HD            = 75,
            SPI3_CS0           = 76,
            SPI3_CS1           = 77,
            SPI3_CS2           = 78,
            LEDC_LS_SIG0       = 79,
            LEDC_LS_SIG1       = 80,
            LEDC_LS_SIG2       = 81,
            LEDC_LS_SIG3       = 82,
            LEDC_LS_SIG4       = 83,
            LEDC_LS_SIG5       = 84,
            LEDC_LS_SIG6       = 85,
            LEDC_LS_SIG7       = 86,
            RMT_SIG_0          = 87,
            RMT_SIG_1          = 88,
            RMT_SIG_2          = 89,
            RMT_SIG_3          = 90,
            I2CEXT1_SCL        = 95,
            I2CEXT1_SDA        = 96,
            GPIO_SD0           = 100,
            GPIO_SD1           = 101,
            GPIO_SD2           = 102,
            GPIO_SD3           = 103,
            GPIO_SD4           = 104,
            GPIO_SD5           = 105,
            GPIO_SD6           = 106,
            GPIO_SD7           = 107,
            FSPICLK            = 108,
            FSPIQ              = 109,
            FSPID              = 110,
            FSPIHD             = 111,
            FSPIWP             = 112,
            FSPIIO4            = 113,
            FSPIIO5            = 114,
            FSPIIO6            = 115,
            FSPIIO7            = 116,
            FSPICS0            = 117,
            FSPICS1            = 118,
            FSPICS2            = 119,
            FSPICS3            = 120,
            FSPICS4            = 121,
            FSPICS5            = 122,
            TWAI_TX            = 123,
            SUBSPICLK          = 126,
            SUBSPIQ            = 127,
            SUBSPID            = 128,
            SUBSPIHD           = 129,
            SUBSPIWP           = 130,
            SUBSPICS0          = 131,
            SUBSPICS1          = 132,
            FSPIDQS            = 133,
            FSPI_HSYNC         = 134,
            FSPI_VSYNC         = 135,
            FSPI_DE            = 136,
            FSPICD             = 137,
            SPI3_CD            = 139,
            SPI3_DQS           = 140,
            I2S0O_DATA_OUT23   = 166,
            SUBSPID4           = 167,
            SUBSPID5           = 168,
            SUBSPID6           = 169,
            SUBSPID7           = 170,
            SUBSPIDQS          = 171,
            PCMFSYNC           = 209,
            PCMCLK             = 210,
            PRO_ALONEGPIO_OUT0 = 235,
            PRO_ALONEGPIO_OUT1 = 236,
            PRO_ALONEGPIO_OUT2 = 237,
            PRO_ALONEGPIO_OUT3 = 238,
            PRO_ALONEGPIO_OUT4 = 239,
            PRO_ALONEGPIO_OUT5 = 240,
            PRO_ALONEGPIO_OUT6 = 241,
            PRO_ALONEGPIO_OUT7 = 242,
            CLK_I2S            = 251,
            GPIO               = 256,
            CLK_OUT1,
            CLK_OUT2,
            CLK_OUT3,
            MTDO,
        }
    };
}
/// Defines and implements the `io_mux_reg` function.
///
/// The generated function has the following signature:
///
/// ```rust,ignore
/// pub(crate) fn io_mux_reg(gpio_num: u8) -> &'static crate::pac::io_mux::GPIO0 {
///     // ...
/// # unimplemented!()
/// }
/// ```
///
/// This macro is intended to be called in esp-hal only.
#[macro_export]
#[expect(clippy::crate_in_macro_def)]
#[cfg_attr(docsrs, doc(cfg(feature = "_device-selected")))]
macro_rules! define_io_mux_reg {
    () => {
        pub(crate) fn io_mux_reg(gpio_num: u8) -> &'static crate::pac::io_mux::GPIO {
            crate::peripherals::IO_MUX::regs().gpio(gpio_num as usize)
        }
    };
}
