diff --git a/agb/src/interrupt.rs b/agb/src/interrupt.rs index c8dc7fb0..21e65016 100644 --- a/agb/src/interrupt.rs +++ b/agb/src/interrupt.rs @@ -391,10 +391,14 @@ impl<'a, T> DerefMut for MutexRef<'a, T> { pub struct VBlank {} impl VBlank { + /// Handles setting up everything reqired to be able to use the wait for + /// interrupt syscall. pub fn get() -> Self { interrupt_to_root(Interrupt::VBlank).add(); VBlank {} } + /// Pauses CPU until vblank interrupt is triggered where code execution is + /// resumed. pub fn wait_for_vblank(&self) { crate::syscall::wait_for_vblank(); } diff --git a/agb/src/syscall.rs b/agb/src/syscall.rs index 17df4bf3..f3869a1e 100644 --- a/agb/src/syscall.rs +++ b/agb/src/syscall.rs @@ -39,6 +39,8 @@ pub fn wait_for_interrupt() { } } +/// The vblank interrupt handler [VBlank][crate::interrupt::VBlank] should be +/// used instead of calling this function directly. pub fn wait_for_vblank() { unsafe { asm!(