//! Top-level PAC-style bring-up entry for {{ ir.board.name }}.
//!
//! Call [`init`] once from your application reset handler before
//! touching any peripheral. It performs the following in order:
//!
//! 1. [`super::clocks::init`] — ungate the CMU clock-gate bits for the
//!    peripherals this board uses.
//! 2. [`super::io_mux::init`] — drive each board pin's GPIO mode bits
//!    and (for peripheral-owned pins) write the per-peripheral
//!    ROUTELOC + ROUTEPEN registers per the
//!    `db/boards/{{ board_stem }}.yaml` pin table.
//! 3. [`super::peripherals::init`] — per-peripheral init (USART/LEUART
//!    console real when configured, others stubbed).
//!
//! The generated code uses the `{{ ir.chip.pac_crate }}` PAC crate
//! pinned to `0.1.4` for all register access; add it as a dependency
//! of the consuming crate. Sibling references use `super::` so this
//! module can be either a crate root (when consumed directly) or a
//! child module of the host crate.

{% if ir.chip.pac_sku_module -%}
// `{{ ir.chip.pac_crate }}` gates its per-SKU `Peripherals` type behind
// a `{{ ir.chip.pac_sku_module }}` sub-module rather than re-exporting
// it at the crate root. Hoist the SKU sub-module's contents (including
// `Peripherals`) directly into this BSP module so consumers can reach
// `Peripherals` via `bsp_generated::<board>::pac::Peripherals` without
// a double-nest workaround (CHIPS-SILABS-07).
#[allow(unused_imports)]
pub use {{ ir.chip.pac_crate | replace("-", "_") }}::{{ ir.chip.pac_sku_module }}::*;
{%- else %}
#[allow(unused_imports)]
pub use {{ ir.chip.pac_crate | replace("-", "_") }}::*;
{%- endif %}

/// Bring up the board.
///
/// Safety: must be called exactly once from a single-threaded reset
/// handler before any other code touches
/// `{{ ir.chip.pac_crate | replace("-", "_") }}::Peripherals`.
pub fn init() {
    super::clocks::init();
    super::io_mux::init();
    super::peripherals::init();
}
