atsamd_hal

Macro bind_multiple_interrupts

Source
macro_rules! bind_multiple_interrupts {
    ($vis:vis struct $name:ident { $int_source:ident: [ $($irq:ident),+ ] => $handler:ty; }) => { ... };
}
Expand description

Bind multiple interrupt sources to the same interrupt handler.

This defines the right interrupt handlers, creates a unit struct (like struct Irqs;) and implements the right Bindings for it. You can pass this struct to drivers to prove at compile-time that the right interrupts have been bound.

Due to limitations in the macro’s implementation, only one binding per macro call is supported. Call bind_multiple_interrupts as many times as you need multiple-interrupt bindings.

Refer to the module-level documentation for details on when to use bind_interrupts vs bind_multiple_interrupts.

§Example

atsamd_hal::bind_multiple_interrupts!(struct DmacIrqs {
    DMAC: [DMAC_0, DMAC_1, DMAC_2, DMAC_OTHER] => atsamd_hal::dmac::InterruptHandler;
});

atsamd_hal::bind_multiple_interrupts!(struct SpiIrqs {
    SERCOM0: [SERCOM0_0, SERCOM0_1, SERCOM0_2, SERCOM0_OTHER] => atsamd_hal::sercom::spi::InterruptHandler;
});