Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where does timer1 in the README come from? #40

Open
lord-ne opened this issue Aug 25, 2021 · 1 comment
Open

Where does timer1 in the README come from? #40

lord-ne opened this issue Aug 25, 2021 · 1 comment

Comments

@lord-ne
Copy link

lord-ne commented Aug 25, 2021

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?

@cty635788032
Copy link

Have you solve the problem?I am learning this too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants