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 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, $af:ident)- simple case where you only need identifiers, and maybe the function.- group:
(($signal:ident, $group:ident $(, $number:literal)+), $gpio:ident, $af:ident, ($( $lp_input_af:ident => $lp_input_signal:ident )*) ($( $lp_output_af:ident => $lp_output_signal:ident )*))- expanded signal case, where you need the number(s) of a signal, or the general group to which the signal belongs. Every expanded branch ends with the pad’s LP input and output function groups (empty on chips without an LP GPIO matrix).
Macro fragments:
$signal: the name of the signal.$group: the name of the signal, with numbers replaced by placeholders. ForADC2_CH3this isADCn_CHm.$number: the numbers extracted from$signal.$gpio: the name of the GPIO.$af: the LP IO MUX function, as an identifier (i.e. for function 0 this is_0). This is the name of anLpFunctionvariant, and its number is the value to write to the pad’s function select field.$lp_input_af: the LP IO MUX function for an LP peripheral input on this pad.$lp_input_signal: the LP peripheral input signal name.$lp_output_af: the LP IO MUX function for an LP peripheral output on this pad.$lp_output_signal: the LP peripheral output signal name.
Example data:
(LP_GPIO15, GPIO12, _0)((LP_GPIO15, LP_GPIOn, 15), GPIO12, _0, () ())((LP_GPIO14, LP_GPIOn, 14), GPIO14, _1, () (_0 => LP_UART_TXD))((SAR_I2C_SCL_1, SAR_I2C_SCL_n, 1), GPIO2, _3, () ())
The expanded syntax is only available when the signal has at least one numbered component.