From da6ff40a32c9d51fd57460e2e356e6b56bf86f14 Mon Sep 17 00:00:00 2001 From: Corwin Kuiper Date: Fri, 6 Aug 2021 23:21:50 +0100 Subject: [PATCH] add docs --- agb/src/interrupt.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/agb/src/interrupt.rs b/agb/src/interrupt.rs index 08caeca1..8e1b7549 100644 --- a/agb/src/interrupt.rs +++ b/agb/src/interrupt.rs @@ -242,6 +242,18 @@ pub fn add_interrupt<'a>(interrupt: Pin<&'a InterruptClosureBounded<'a>>) { } #[macro_export] +/// Creates a new interrupt handler in the current scope, when this scope drops +/// the interrupt handler is removed. Note that this returns nothing, but some +/// stack space is used. The interrupt handler is of the form `Fn(Key) + Send + +/// Sync` where Key can be used to unlock a mutex without checking whether +/// interrupts need to be disabled, as during an interrupt interrupts are +/// disabled. +/// +/// # Usage +/// ``` +/// add_interrupt_handler!(Interrupt::VBlank, |key| agb::println!("hello world!")); +/// ``` +/// macro_rules! add_interrupt_handler { ($interrupt: expr, $handler: expr) => { let a = $handler;