Skip to main content

for_each_pcnt_unit

Macro for_each_pcnt_unit 

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

This macro can be used to generate code for each PCNT unit.

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

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

  • names: ($instance:ident)
  • all: ($peri:ident, $variant:ident, $sys:ident, $regs:ident, $unit:literal, $interrupt:ident, $sig_ch0:ident, $sig_ch1:ident, $ctrl_ch0:ident, $ctrl_ch1:ident)
  • interrupt: ($interrupt:ident) (repeated: one ident per unique IRQ)
  • regs: ($regs:ident) (repeated: one ident per register block)

Macro fragments:

  • $peri: unit singleton name (PCNT0_UNIT0, PCNT1_UNIT0, …)
  • $variant: AnyPcntUnit enum variant (Pcnt0Unit0, Pcnt1Unit0, …)
  • $sys: esp_hal::system::Peripheral variant for clocks
  • $regs: register-block singleton (PCNT, PCNT1)
  • $unit: hardware unit index within that register block
  • $interrupt: shared peripheral interrupt
  • $sig_ch0, $sig_ch1, $ctrl_ch0, $ctrl_ch1: GPIO matrix input signals