mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-12 01:51:34 +11:00
update examples
This commit is contained in:
parent
1f3d3380f1
commit
c74707b1a6
|
@ -8,13 +8,13 @@ use bare_metal::{CriticalSection, Mutex};
|
||||||
#[agb::entry]
|
#[agb::entry]
|
||||||
fn main(_gba: agb::Gba) -> ! {
|
fn main(_gba: agb::Gba) -> ! {
|
||||||
let count = Mutex::new(RefCell::new(0));
|
let count = Mutex::new(RefCell::new(0));
|
||||||
agb::add_interrupt_handler!(
|
let _a = agb::interrupt::add_interrupt_handler(
|
||||||
agb::interrupt::Interrupt::VBlank,
|
agb::interrupt::Interrupt::VBlank,
|
||||||
|key: &CriticalSection| {
|
|key: &CriticalSection| {
|
||||||
let mut count = count.borrow(*key).borrow_mut();
|
let mut count = count.borrow(*key).borrow_mut();
|
||||||
agb::println!("Hello, world, frame = {}", *count);
|
agb::println!("Hello, world, frame = {}", *count);
|
||||||
*count += 1;
|
*count += 1;
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ fn main(mut gba: agb::Gba) -> ! {
|
||||||
|
|
||||||
let back = Mutex::new(RefCell::new(BackCosines { cosines, row: 0 }));
|
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 mut backc = back.borrow(*key).borrow_mut();
|
||||||
let deflection = backc.cosines[backc.row % 32];
|
let deflection = backc.cosines[backc.row % 32];
|
||||||
unsafe { ((0x0400_0010) as *mut u16).write_volatile(deflection) }
|
unsafe { ((0x0400_0010) as *mut u16).write_volatile(deflection) }
|
||||||
|
|
Loading…
Reference in a new issue