aboutsummaryrefslogtreecommitdiffstats
path: root/tmk_core/common
diff options
context:
space:
mode:
authormilestogo <milestogo@users.noreply.github.com>2017-02-04 20:08:07 -0800
committermilestogo <milestogo@users.noreply.github.com>2017-02-04 20:08:07 -0800
commitb0dfb037dc0b8b20fd87b3c88449a2ce20ff80e1 (patch)
treedf9fb78b55c4a9b8262e35ac7bd26ec0ebdb64db /tmk_core/common
parente8ba4838d30ef3af6d8e69ebc1d00a1910806ac2 (diff)
parentf0633f2540be3ba86797522a2075a9f5ba2ad5c6 (diff)
downloadfirmware-b0dfb037dc0b8b20fd87b3c88449a2ce20ff80e1.tar.gz
firmware-b0dfb037dc0b8b20fd87b3c88449a2ce20ff80e1.tar.bz2
firmware-b0dfb037dc0b8b20fd87b3c88449a2ce20ff80e1.zip
Merge branch 'master' of https://github.com/jackhumbert/qmk_firmware
Diffstat (limited to 'tmk_core/common')
-rw-r--r--tmk_core/common/avr/bootloader.c12
-rw-r--r--tmk_core/common/avr/timer.c33
-rw-r--r--tmk_core/common/command.c3
-rw-r--r--tmk_core/common/keyboard.c2
4 files changed, 40 insertions, 10 deletions
diff --git a/tmk_core/common/avr/bootloader.c b/tmk_core/common/avr/bootloader.c
index ad547b985..34db8d0b0 100644
--- a/tmk_core/common/avr/bootloader.c
+++ b/tmk_core/common/avr/bootloader.c
@@ -1,6 +1,7 @@
#include <stdint.h>
#include <stdbool.h>
#include <avr/io.h>
+#include <avr/eeprom.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>
#include <util/delay.h>
@@ -89,6 +90,12 @@ void bootloader_jump(void) {
_delay_ms(5);
#endif
+ #ifdef BOOTLOADHID_BOOTLOADER
+ // force bootloadHID to stay in bootloader mode, so that it waits
+ // for a new firmware to be flashed
+ eeprom_write_byte((uint8_t *)1, 0x00);
+ #endif
+
// watchdog reset
reset_key = BOOTLOADER_RESET_KEY;
wdt_enable(WDTO_250MS);
@@ -114,6 +121,11 @@ void bootloader_jump(void) {
#endif
}
+#ifdef __AVR_ATmega32A__
+// MCUSR is actually called MCUCSR in ATmega32A
+#define MCUSR MCUCSR
+#endif
+
/* this runs before main() */
void bootloader_jump_after_watchdog_reset(void) __attribute__ ((used, naked, section (".init3")));
void bootloader_jump_after_watchdog_reset(void)
diff --git a/tmk_core/common/avr/timer.c b/tmk_core/common/avr/timer.c
index 84af44488..369015200 100644
--- a/tmk_core/common/avr/timer.c
+++ b/tmk_core/common/avr/timer.c
@@ -29,25 +29,35 @@ volatile uint32_t timer_count;
void timer_init(void)
{
- // Timer0 CTC mode
- TCCR0A = 0x02;
-
#if TIMER_PRESCALER == 1
- TCCR0B = 0x01;
+ uint8_t prescaler = 0x01;
#elif TIMER_PRESCALER == 8
- TCCR0B = 0x02;
+ uint8_t prescaler = 0x02;
#elif TIMER_PRESCALER == 64
- TCCR0B = 0x03;
+ uint8_t prescaler = 0x03;
#elif TIMER_PRESCALER == 256
- TCCR0B = 0x04;
+ uint8_t prescaler = 0x04;
#elif TIMER_PRESCALER == 1024
- TCCR0B = 0x05;
+ uint8_t prescaler = 0x05;
#else
# error "Timer prescaler value is NOT vaild."
#endif
+#ifndef __AVR_ATmega32A__
+ // Timer0 CTC mode
+ TCCR0A = 0x02;
+
+ TCCR0B = prescaler;
+
OCR0A = TIMER_RAW_TOP;
TIMSK0 = (1<<OCIE0A);
+#else
+ // Timer0 CTC mode
+ TCCR0 = (1 << WGM01) | prescaler;
+
+ OCR0 = TIMER_RAW_TOP;
+ TIMSK = (1 << OCIE0);
+#endif
}
inline
@@ -107,7 +117,12 @@ uint32_t timer_elapsed32(uint32_t last)
}
// excecuted once per 1ms.(excess for just timer count?)
-ISR(TIMER0_COMPA_vect)
+#ifndef __AVR_ATmega32A__
+#define TIMER_INTERRUPT_VECTOR TIMER0_COMPA_vect
+#else
+#define TIMER_INTERRUPT_VECTOR TIMER0_COMP_vect
+#endif
+ISR(TIMER_INTERRUPT_VECTOR, ISR_NOBLOCK)
{
timer_count++;
}
diff --git a/tmk_core/common/command.c b/tmk_core/common/command.c
index 5f29bc0b4..f79d5a257 100644
--- a/tmk_core/common/command.c
+++ b/tmk_core/common/command.c
@@ -235,8 +235,11 @@ static void print_status(void)
print("\n\t- Status -\n");
print_val_hex8(host_keyboard_leds());
+#ifndef PROTOCOL_VUSB
+ // these aren't set on the V-USB protocol, so we just ignore them for now
print_val_hex8(keyboard_protocol);
print_val_hex8(keyboard_idle);
+#endif
#ifdef NKRO_ENABLE
print_val_hex8(keymap_config.nkro);
#endif
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c
index 371d93f3e..765350792 100644
--- a/tmk_core/common/keyboard.c
+++ b/tmk_core/common/keyboard.c
@@ -188,7 +188,7 @@ MATRIX_LOOP_END:
#endif
#ifdef VISUALIZER_ENABLE
- visualizer_update(default_layer_state, layer_state, host_keyboard_leds());
+ visualizer_update(default_layer_state, layer_state, visualizer_get_mods(), host_keyboard_leds());
#endif
// update LED