From 8876c47aa9d89df3ded4d3f24ef89d43d68163dc Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Thu, 18 Nov 2021 22:17:44 +0000 Subject: [PATCH] Remove the generics (sorry that GBA is no longer zero sized...) --- agb/src/timer.rs | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/agb/src/timer.rs b/agb/src/timer.rs index 431e34e4..46fc7b78 100644 --- a/agb/src/timer.rs +++ b/agb/src/timer.rs @@ -33,31 +33,32 @@ impl Divider { } } -#[non_exhaustive] -pub struct Timer {} +pub struct Timer { + timer_number: u16, +} #[non_exhaustive] pub struct TimerController { - pub timer0: Timer<0>, - pub timer1: Timer<1>, - pub timer2: Timer<2>, - pub timer3: Timer<3>, + pub timer0: Timer, + pub timer1: Timer, + pub timer2: Timer, + pub timer3: Timer, } impl TimerController { pub(crate) const unsafe fn new() -> Self { Self { - timer0: Timer::new(), - timer1: Timer::new(), - timer2: Timer::new(), - timer3: Timer::new(), + timer0: Timer::new(0), + timer1: Timer::new(1), + timer2: Timer::new(2), + timer3: Timer::new(3), } } } -impl Timer { - const unsafe fn new() -> Self { - Self {} +impl Timer { + const unsafe fn new(timer_number: u16) -> Self { + Self { timer_number } } pub fn set_overflow_amount(&mut self, n: u16) { @@ -93,6 +94,6 @@ impl Timer { } fn get_timer_number(&self) -> usize { - N + self.timer_number as usize } }