summaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/common/avr/bootloader.c2
-rw-r--r--tmk_core/common/avr/timer.c19
2 files changed, 14 insertions, 7 deletions
diff --git a/tmk_core/common/avr/bootloader.c b/tmk_core/common/avr/bootloader.c
index ca9746f327..32f69ae8b4 100644
--- a/tmk_core/common/avr/bootloader.c
+++ b/tmk_core/common/avr/bootloader.c
@@ -247,7 +247,7 @@ void bootloader_jump(void) {
#else // Assume remaining boards are DFU, even if the flag isn't set
-# if !(defined(__AVR_ATmega32A__) || defined(__AVR_ATmega328P__)) // no USB - maybe BOOTLOADER_BOOTLOADHID instead though?
+# if !(defined(__AVR_ATmega32A__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATtiny85__)) // no USB - maybe BOOTLOADER_BOOTLOADHID instead though?
UDCON = 1;
USBCON = (1 << FRZCLK); // disable USB
UCSR1B = 0;
diff --git a/tmk_core/common/avr/timer.c b/tmk_core/common/avr/timer.c
index 88fa1dfa65..c2e6c6e081 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
}