#[doc = r" Macro to override a device specific interrupt handler"]
#[doc = r""]
#[doc = r" # Syntax"]
#[doc = r""]
#[doc = r" ``` ignore"]
#[doc = r" interrupt!("]
#[doc = r" // Name of the interrupt"]
#[doc = r" $Name:ident,"]
#[doc = r""]
#[doc = r" // Path to the interrupt handler (a function)"]
#[doc = r" $handler:path,"]
#[doc = r""]
#[doc = r" // Optional, state preserved across invocations of the handler"]
#[doc = r" state: $State:ty = $initial_state:expr,"]
#[doc = r" );"]
#[doc = r" ```"]
#[doc = r""]
#[doc = r" Where `$Name` must match the name of one of the variants of the [Interrupt]"]
#[doc = r" enum."]
#[doc = r""]
#[doc = r" The handler must have signature `fn()` is no state was associated to it;"]
#[doc = r" otherwise its signature must be `fn(&mut $State)`."]
#[macro_export]
macro_rules! interrupt {
($Name:ident, $handler:path,state: $State:ty = $initial_state:expr) => {
__interrupt_vector! ($Name, {
static mut STATE: $State = $initial_state;
let _ = $crate::Interrupt::$Name;
let f: fn(&mut $State) = $handler;
f(&mut STATE)
});
};
($Name:ident, $handler:path) => {
__interrupt_vector! ($Name, {
let _ = $crate::Interrupt::$Name;
let f: fn() = $handler;
f()
});
};
}