GlobalTimer: add support for starting timer with interrupt #108
|
@ -28,7 +28,7 @@ impl GlobalTimer {
|
|||
// Start
|
||||
regs.global_timer_control.write(
|
||||
mpcore::GlobalTimerControl::zeroed()
|
||||
.prescaler((Self::get_prescalar() - 1) as u8)
|
||||
.prescaler((Self::get_prescaler() - 1) as u8)
|
||||
.auto_increment_mode(true)
|
||||
.timer_enable(true)
|
||||
);
|
||||
|
@ -40,7 +40,7 @@ impl GlobalTimer {
|
|||
let mut regs = mpcore::RegisterBlock::mpcore();
|
||||
Self::reset(&mut regs);
|
||||
|
||||
let prescaler = Self::get_prescalar() as u64;
|
||||
let prescaler = Self::get_prescaler() as u64;
|
||||
let clocks = Clocks::get();
|
||||
let increment_val:u32 = (interrupt_period_us * clocks.cpu_3x2x() as u64 / (1_000_000 * (prescaler + 1))) as u32;
|
||||
|
||||
|
@ -87,7 +87,7 @@ impl GlobalTimer {
|
|||
);
|
||||
}
|
||||
|
||||
fn get_prescalar() -> u32 {
|
||||
fn get_prescaler() -> u32 {
|
||||
|
||||
// find a prescaler value that matches CPU speed / 2 to us
|
||||
let clocks = Clocks::get();
|
||||
let mut prescaler = clocks.cpu_3x2x() / 1_000_000;
|
||||
|
|
Loading…
Reference in New Issue
prescaler