ruduino icon indicating copy to clipboard operation
ruduino copied to clipboard

Where does `timer1` in the README come from?

Open lord-ne opened this issue 4 years ago • 1 comments

The README has the following code snipped:

const DESIRED_HZ_TIM1: f64 = 2.0;
const TIM1_PRESCALER: u64 = 1024;
const INTERRUPT_EVERY_1_HZ_1024_PRESCALER: u16 =
    ((ruduino::config::CPU_FREQUENCY_HZ as f64 / (DESIRED_HZ_TIM1 * TIM1_PRESCALER as f64)) as u64 - 1) as u16;

timer1::Timer::new()
    .waveform_generation_mode(timer1::WaveformGenerationMode::ClearOnTimerMatchOutputCompare)
    .clock_source(timer1::ClockSource::Prescale1024)
    .output_compare_1(Some(INTERRUPT_EVERY_1_HZ_1024_PRESCALER))
    .configure();

I'm interested in using similar code to configure a timer. But where is the variable timer1 coming from?

lord-ne avatar Aug 25 '21 21:08 lord-ne

Have you solve the problem?I am learning this too

cty635788032 avatar Sep 07 '22 16:09 cty635788032