Skip to main content

for_each_iomux_function

Macro for_each_iomux_function 

Source
macro_rules! for_each_iomux_function {
    ($($pattern:tt => $code:tt;)*) => { ... };
}
Available on crate feature _device-selected only.
Expand description

This macro can be used to generate code for each IOMUX digital function of each GPIO.

IOMUX functions are the alternate digital functions configured via the IO_MUX registers. Use this to implement signal-specific traits for peripherals whose pins must bypass the GPIO matrix (e.g., EMAC, USB).

For an explanation on the general syntax, as well as usage of individual/repeated matchers, refer to the crate-level documentation.

This macro has two options for its “Individual matcher” case:

  • all: ($signal:ident, $gpio:ident, $af:ident) - simple case where you only need identifiers, and maybe the alternate function.
  • group: (($signal:ident, $group:ident $(, $number:literal)+), $gpio:ident, $af:ident) - expanded signal case, where you need the number(s) of a signal, or the general group to which the signal belongs.

Macro fragments:

  • $signal: the name of the signal.
  • $group: the name of the signal, with numbers replaced by placeholders.
  • $number: the numbers extracted from $signal.
  • $gpio: the name of the GPIO.
  • $af: the alternate function number, as an identifier (e.g. _5).

Example data:

  • (EMAC_RXD0, GPIO25, _5)
  • ((EMAC_RXDn, EMAC_RXDn, 0), GPIO25, _5)

The expanded syntax is only available when the signal has at least one numbered component.