[][src]Crate ruspiro_interrupt_macros

Interrupt Macros

This crate provides the custom attribute #[IrqHandler(<interrupt type>[, <source>])] to be used when implementing an interrupt handler.

Usage

#[IrqHandler(ArmTimer)]
unsafe fn my_timer_handler() {
    // implement the interrupt handling here and do not forget
    // to acknowledge the interrupt in the interrupt specific registers
    // in case of the timer interrupt it would be done like so
 
    TIMERIRQ::Register.set(1);
}
 
define_registers! ( TIMERIRQ: WriteOnly<u32> @ 0x3F00_B40C => [] );

In some rare cases the interrupt line is shared between specific interrupt sources. In this case the source of the interrupt need to be passed as well as an identifier.

#[IrqHandler(Aux, Uart1)]
unsafe fn my_aux_uart1_handler() {
    // handle Uart1 interrupt here - this usually has no "acknowledge" register...
}

Attribute Macros

IrqHandler