diff options
author | Joel Challis <git@zvecr.com> | 2020-04-02 22:23:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-02 22:23:57 +0100 |
commit | 9c4bf0ac4aed4ab315f27bfa5d2f54b0dd931138 (patch) | |
tree | 65e9caa97daa7616565835b0c0b88fe4ce79a8c4 /tmk_core/common/avr/timer.c | |
parent | f2901375ce9fbf14e4a95eabf3b6abc7bfbc4300 (diff) | |
download | qmk_firmware-9c4bf0ac4aed4ab315f27bfa5d2f54b0dd931138.tar.gz |
Initial support for ATtiny85 (#8632)
* Initial support for ATtiny85
* Update mcu selection
Diffstat (limited to 'tmk_core/common/avr/timer.c')
-rw-r--r-- | tmk_core/common/avr/timer.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/tmk_core/common/avr/timer.c b/tmk_core/common/avr/timer.c index 88fa1dfa6..c2e6c6e08 100644 --- a/tmk_core/common/avr/timer.c +++ b/tmk_core/common/avr/timer.c @@ -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; - TIMSK0 = _BV(OCIE0A); + OCR0A = TIMER_RAW_TOP; + TIMSK = _BV(OCIE0A); #else // Timer0 CTC mode - TCCR0 = _BV(WGM01) | prescaler; + TCCR0A = _BV(WGM01); + TCCR0B = prescaler; - OCR0 = TIMER_RAW_TOP; - TIMSK = _BV(OCIE0); + OCR0A = TIMER_RAW_TOP; + TIMSK0 = _BV(OCIE0A); #endif } |