Skip to content

CTC mode correction for Timer1 #80

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion GyverTimers/GyverTimers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ uint32_t Timer_1::setPeriod(uint32_t _timer1_period) {
#else
TCCR1A = (TCCR1A & 0xF0);
#endif
TCCR1A |= 1 << WGM11; // CTC - mode
TCCR1B = ((1 << WGM13) | (1 << WGM12) | _timer1_prescaler); // CTC mode + set prescaler
ICR1 = _timer1_top - 1; // Set timer top
_timer1_clock = (TCCR1B & 0x07); // Save timer clock settings
Expand Down Expand Up @@ -760,4 +761,4 @@ Timer_2 Timer2 = Timer_2();
Timer_3 Timer3 = Timer_3();
Timer_4 Timer4 = Timer_4();
Timer_5 Timer5 = Timer_5();
#endif
#endif