add docs for vblank interrupt

This commit is contained in:
Corwin Kuiper 2021-08-07 13:57:50 +01:00
parent fa250cee60
commit 477b0465fb
2 changed files with 6 additions and 0 deletions

View file

@ -391,10 +391,14 @@ impl<'a, T> DerefMut for MutexRef<'a, T> {
pub struct VBlank {} pub struct VBlank {}
impl VBlank { impl VBlank {
/// Handles setting up everything reqired to be able to use the wait for
/// interrupt syscall.
pub fn get() -> Self { pub fn get() -> Self {
interrupt_to_root(Interrupt::VBlank).add(); interrupt_to_root(Interrupt::VBlank).add();
VBlank {} VBlank {}
} }
/// Pauses CPU until vblank interrupt is triggered where code execution is
/// resumed.
pub fn wait_for_vblank(&self) { pub fn wait_for_vblank(&self) {
crate::syscall::wait_for_vblank(); crate::syscall::wait_for_vblank();
} }

View file

@ -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() { pub fn wait_for_vblank() {
unsafe { unsafe {
asm!( asm!(