forked from mirrors/qmk_userspace
Initial support for ATtiny85 (#8632)
* Initial support for ATtiny85 * Update mcu selection
This commit is contained in:
parent
f2901375ce
commit
9c4bf0ac4a
4 changed files with 33 additions and 8 deletions
|
@ -45,19 +45,26 @@ void timer_init(void) {
|
|||
# error "Timer prescaler value is not valid"
|
||||
#endif
|
||||
|
||||
#ifndef __AVR_ATmega32A__
|
||||
#if defined(__AVR_ATmega32A__)
|
||||
// Timer0 CTC mode
|
||||
TCCR0 = _BV(WGM01) | prescaler;
|
||||
|
||||
OCR0 = TIMER_RAW_TOP;
|
||||
TIMSK = _BV(OCIE0);
|
||||
#elif defined(__AVR_ATtiny85__)
|
||||
// Timer0 CTC mode
|
||||
TCCR0A = _BV(WGM01);
|
||||
TCCR0B = prescaler;
|
||||
|
||||
OCR0A = TIMER_RAW_TOP;
|
||||
TIMSK = _BV(OCIE0A);
|
||||
#else
|
||||
// Timer0 CTC mode
|
||||
TCCR0A = _BV(WGM01);
|
||||
TCCR0B = prescaler;
|
||||
|
||||
OCR0A = TIMER_RAW_TOP;
|
||||
TIMSK0 = _BV(OCIE0A);
|
||||
#else
|
||||
// Timer0 CTC mode
|
||||
TCCR0 = _BV(WGM01) | prescaler;
|
||||
|
||||
OCR0 = TIMER_RAW_TOP;
|
||||
TIMSK = _BV(OCIE0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue