GlobalTimer: add support for starting timer with interrupt #108

Closed
morgan wants to merge 4 commits from morgan/zynq-rs:master into master
1 changed files with 3 additions and 3 deletions
Showing only changes of commit 1df7d1bb7d - Show all commits

View File

@ -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 {

prescaler

``prescaler``
// find a prescaler value that matches CPU speed / 2 to us
let clocks = Clocks::get();
let mut prescaler = clocks.cpu_3x2x() / 1_000_000;