Function agb::interrupt::add_interrupt_handler
source · pub fn add_interrupt_handler<'a>(
interrupt: Interrupt,
handler: impl Fn(CriticalSection<'_>) + Send + Sync + 'a
) -> InterruptHandler<'a>
Expand description
Adds an interrupt handler as long as the returned value is alive. The
closure takes a CriticalSection
which can be used for mutexes.
Examples
use bare_metal::CriticalSection;
let _a = add_interrupt_handler(Interrupt::VBlank, |_: CriticalSection| {
agb::println!("Woah there! There's been a vblank!");
});