Remove the generics (sorry that GBA is no longer zero sized...)

This commit is contained in:
Gwilym Kuiper 2021-11-18 22:17:44 +00:00
parent 8ef46279c8
commit 8876c47aa9

View file

@ -33,31 +33,32 @@ impl Divider {
} }
} }
#[non_exhaustive] pub struct Timer {
pub struct Timer<const N: usize> {} timer_number: u16,
}
#[non_exhaustive] #[non_exhaustive]
pub struct TimerController { pub struct TimerController {
pub timer0: Timer<0>, pub timer0: Timer,
pub timer1: Timer<1>, pub timer1: Timer,
pub timer2: Timer<2>, pub timer2: Timer,
pub timer3: Timer<3>, pub timer3: Timer,
} }
impl TimerController { impl TimerController {
pub(crate) const unsafe fn new() -> Self { pub(crate) const unsafe fn new() -> Self {
Self { Self {
timer0: Timer::new(), timer0: Timer::new(0),
timer1: Timer::new(), timer1: Timer::new(1),
timer2: Timer::new(), timer2: Timer::new(2),
timer3: Timer::new(), timer3: Timer::new(3),
} }
} }
} }
impl<const N: usize> Timer<N> { impl Timer {
const unsafe fn new() -> Self { const unsafe fn new(timer_number: u16) -> Self {
Self {} Self { timer_number }
} }
pub fn set_overflow_amount(&mut self, n: u16) { pub fn set_overflow_amount(&mut self, n: u16) {
@ -93,6 +94,6 @@ impl<const N: usize> Timer<N> {
} }
fn get_timer_number(&self) -> usize { fn get_timer_number(&self) -> usize {
N self.timer_number as usize
} }
} }