Skip to main content

peripherals

Macro peripherals 

Source
macro_rules! peripherals {
    ($($(#[$cfg:meta])? $name:ident),* $(,)?) => { ... };
}
Expand description

Declare a chip’s peripheral singletons and the Peripherals struct that hands them out once.

This is embassy_hal_internal::peripherals! with two deliberate changes:

  • No per-type defmt::Format derive. Consortium’s chips have hundreds of peripherals, and the derive emits a .defmt.* link section per type; on a defmt-enabled host build that overruns the Mach-O section limit and the HAL stops compiling on macOS. The markers are zero-sized and never formatted, so nothing is lost.
  • No #[unsafe(no_mangle)] on the once-guard. Two chip HALs can end up in one binary (the consortium-cfg UI tests link both), and an unmangled guard symbol would collide between them.

Invoke it at the chip HAL’s crate root; scripts/pac/gen_peripherals.py emits the invocation.