diff options
Diffstat (limited to 'tmk_core/common')
-rw-r--r-- | tmk_core/common/avr/bootloader.c | 54 | ||||
-rw-r--r-- | tmk_core/common/keyboard.c | 19 | ||||
-rw-r--r-- | tmk_core/common/matrix.h | 5 |
3 files changed, 59 insertions, 19 deletions
diff --git a/tmk_core/common/avr/bootloader.c b/tmk_core/common/avr/bootloader.c index 7c744e8c79..fb9bf2d1c3 100644 --- a/tmk_core/common/avr/bootloader.c +++ b/tmk_core/common/avr/bootloader.c @@ -73,26 +73,46 @@ uint32_t reset_key __attribute__ ((section (".noinit"))); /* initialize MCU status by watchdog reset */ void bootloader_jump(void) { -#ifdef PROTOCOL_LUFA - USB_Disable(); - cli(); - _delay_ms(2000); -#endif + #ifndef CATERINA_BOOTLOADER -#ifdef PROTOCOL_PJRC - cli(); - UDCON = 1; - USBCON = (1<<FRZCLK); - UCSR1B = 0; - _delay_ms(5); -#endif + #ifdef PROTOCOL_LUFA + USB_Disable(); + cli(); + _delay_ms(2000); + #endif - // watchdog reset - reset_key = BOOTLOADER_RESET_KEY; - wdt_enable(WDTO_250MS); - for (;;); -} + #ifdef PROTOCOL_PJRC + cli(); + UDCON = 1; + USBCON = (1<<FRZCLK); + UCSR1B = 0; + _delay_ms(5); + #endif + + // watchdog reset + reset_key = BOOTLOADER_RESET_KEY; + wdt_enable(WDTO_250MS); + for (;;); + + #else + // this block may be optional + // TODO: figure it out + + uint16_t *const bootKeyPtr = (uint16_t *)0x0800; + // Value used by Caterina bootloader use to determine whether to run the + // sketch or the bootloader programmer. + uint16_t bootKey = 0x7777; + + *bootKeyPtr = bootKey; + + // setup watchdog timeout + wdt_enable(WDTO_60MS); + + while(1) {} // wait for watchdog timer to trigger + + #endif +} /* this runs before main() */ void bootloader_jump_after_watchdog_reset(void) __attribute__ ((used, naked, section (".init3"))); diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index 81df8eb73b..c46a701b3b 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c @@ -29,6 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "sendchar.h" #include "eeconfig.h" #include "backlight.h" +#include "action_layer.h" #ifdef BOOTMAGIC_ENABLE # include "bootmagic.h" #else @@ -49,6 +50,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifdef RGBLIGHT_ENABLE # include "rgblight.h" #endif +#ifdef SERIAL_LINK_ENABLE +# include "serial_link/system/serial_link.h" +#endif +#ifdef VISUALIZER_ENABLE +# include "visualizer/visualizer.h" +#endif #ifdef MATRIX_HAS_GHOST static bool has_ghost_in_row(uint8_t row) @@ -167,11 +174,19 @@ MATRIX_LOOP_END: #endif #ifdef SERIAL_MOUSE_ENABLE - serial_mouse_task(); + serial_mouse_task(); #endif #ifdef ADB_MOUSE_ENABLE - adb_mouse_task(); + adb_mouse_task(); +#endif + +#ifdef SERIAL_LINK_ENABLE + serial_link_update(); +#endif + +#ifdef VISUALIZER_ENABLE + visualizer_update(default_layer_state, layer_state, host_keyboard_leds()); #endif // update LED diff --git a/tmk_core/common/matrix.h b/tmk_core/common/matrix.h index 71153a5f58..cee3593eee 100644 --- a/tmk_core/common/matrix.h +++ b/tmk_core/common/matrix.h @@ -72,6 +72,11 @@ void matrix_scan_kb(void); void matrix_init_user(void); void matrix_scan_user(void); +#ifdef I2C_SPLIT + void slave_matrix_init(void); + uint8_t slave_matrix_scan(void); +#endif + #ifdef __cplusplus } #endif |