Skip to content

Commit

Permalink
rename the global, and also make the demo less visually intense
Browse files Browse the repository at this point in the history
  • Loading branch information
Lokathor committed Jun 3, 2024
1 parent 21e7e99 commit 2092429
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use gba::{
IrqBits,
};

static SECONDS: GbaCell<u32> = GbaCell::new(0);
static OVERFLOWS: GbaCell<u32> = GbaCell::new(0);

gba::panic_handler!(mgba_log_err);

Expand All @@ -26,18 +26,18 @@ extern "C" fn main() -> ! {
TimerControl::new()
.with_enabled(true)
.with_send_irq(true)
// .with_cpus_per_tick(CpusPerTick::_64),
.with_cpus_per_tick(CpusPerTick::_64),
);

DISPCNT.write(DisplayControl::new().with_bg_mode(3));
loop {
VBlankIntrWait();
BACKDROP_COLOR.write(Color(SECONDS.read() as u16));
BACKDROP_COLOR.write(Color(OVERFLOWS.read() as u16));
}
}

extern "C" fn irq_handler(bits: IrqBits) {
if bits.timer0() {
SECONDS.write(SECONDS.read().wrapping_add(1));
OVERFLOWS.write(OVERFLOWS.read().wrapping_add(1));
}
}

0 comments on commit 2092429

Please sign in to comment.