update examples

This commit is contained in:
Corwin 2022-03-21 21:52:46 +00:00
parent 1f3d3380f1
commit c74707b1a6
2 changed files with 3 additions and 3 deletions

View file

@ -8,13 +8,13 @@ use bare_metal::{CriticalSection, Mutex};
#[agb::entry]
fn main(_gba: agb::Gba) -> ! {
let count = Mutex::new(RefCell::new(0));
agb::add_interrupt_handler!(
let _a = agb::interrupt::add_interrupt_handler(
agb::interrupt::Interrupt::VBlank,
|key: &CriticalSection| {
let mut count = count.borrow(*key).borrow_mut();
agb::println!("Hello, world, frame = {}", *count);
*count += 1;
}
},
);
loop {}
}

View file

@ -28,7 +28,7 @@ fn main(mut gba: agb::Gba) -> ! {
let back = Mutex::new(RefCell::new(BackCosines { cosines, row: 0 }));
agb::add_interrupt_handler!(Interrupt::HBlank, |key: &CriticalSection| {
let _a = agb::interrupt::add_interrupt_handler(Interrupt::HBlank, |key: &CriticalSection| {
let mut backc = back.borrow(*key).borrow_mut();
let deflection = backc.cosines[backc.row % 32];
unsafe { ((0x0400_0010) as *mut u16).write_volatile(deflection) }