Macro for_each_lp_function

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

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.

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.