merge conditional read

This commit is contained in:
Jack Humbert 2018-11-02 12:51:07 -04:00
commit d581848c13
221 changed files with 19062 additions and 1295 deletions

View file

@ -949,8 +949,40 @@ void tap_random_base64(void) {
}
}
__attribute__((weak))
void bootmagic_lite(void) {
// The lite version of TMK's bootmagic based on Wilba.
// 100% less potential for accidentally making the
// keyboard do stupid things.
// We need multiple scans because debouncing can't be turned off.
matrix_scan();
#if defined(DEBOUNCING_DELAY) && DEBOUNCING_DELAY > 0
wait_ms(DEBOUNCING_DELAY * 2);
#elif defined(DEBOUNCE) && DEBOUNCE > 0
wait_ms(DEBOUNCE * 2);
#else
wait_ms(30);
#endif
matrix_scan();
// If the Esc and space bar are held down on power up,
// reset the EEPROM valid state and jump to bootloader.
// Assumes Esc is at [0,0].
// This isn't very generalized, but we need something that doesn't
// rely on user's keymaps in firmware or EEPROM.
if (matrix_get_row(BOOTMAGIC_LITE_ROW) & (1 << BOOTMAGIC_LITE_COLUMN)) {
eeconfig_disable();
// Jump to bootloader.
bootloader_jump();
}
}
void matrix_init_quantum() {
if (!eeconfig_is_enabled() && !eeconfig_is_disabled()) {
#ifdef BOOTMAGIC_LITE
bootmagic_lite();
#endif
if (!eeconfig_is_enabled()) {
eeconfig_init();
}
#ifdef BACKLIGHT_ENABLE

View file

@ -226,6 +226,15 @@ bool process_action_kb(keyrecord_t *record);
bool process_record_kb(uint16_t keycode, keyrecord_t *record);
bool process_record_user(uint16_t keycode, keyrecord_t *record);
#ifndef BOOTMAGIC_LITE_COLUMN
#define BOOTMAGIC_LITE_COLUMN 0
#endif
#ifndef BOOTMAGIC_LITE_ROW
#define BOOTMAGIC_LITE_ROW 0
#endif
void bootmagic_lite(void);
void reset_keyboard(void);
void startup_user(void);

View file

@ -92,9 +92,14 @@ void split_keyboard_setup(void) {
sei();
}
void disable_JTAG(void);
void keyboard_slave_loop(void) {
// Disable JTAG since we skip calling keyboard_init() on the slave side
// Future fix will possible call keyboard_init() on the slave to remove this need
disable_JTAG();
matrix_init();
//Init RGB
#ifdef RGBLIGHT_ENABLE
rgblight_init();
@ -103,7 +108,7 @@ void keyboard_slave_loop(void) {
while (1) {
// Matrix Slave Scan
matrix_slave_scan();
// Read Backlight Info
#ifdef BACKLIGHT_ENABLE
#ifdef USE_I2C
@ -122,14 +127,14 @@ void keyboard_slave_loop(void) {
// Disable interupts (RGB data is big)
cli();
// Create new DWORD for RGB data
uint32_t dword;
uint32_t dword;
// Fill the new DWORD with the data that was sent over
uint8_t *dword_dat = (uint8_t *)(&dword);
for (int i = 0; i < 4; i++) {
dword_dat[i] = i2c_slave_buffer[I2C_RGB_START+i];
}
// Update the RGB now with the new data and set RGB_DIRTY to false
rgblight_update_dword(dword);
RGB_DIRTY = false;
@ -152,3 +157,13 @@ void matrix_setup(void) {
keyboard_slave_loop();
}
}
// Temporary code to disable JTAG on the slave board
void disable_JTAG(void) {
/* Copied from tmk_core/common/keybaord.c */
// To use PORTF disable JTAG with writing JTD bit twice within four cycles.
#if (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__) || defined(__AVR_ATmega32U4__))
MCUCR |= _BV(JTD);
MCUCR |= _BV(JTD);
#endif
}

View file

@ -222,3 +222,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif
*/
/* Bootmagic Lite key configuration */
// #define BOOTMAGIC_LITE_ROW 0
// #define BOOTMAGIC_LITE_COLUMN 0

View file

@ -44,3 +44,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* key combination for command */
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
/* Bootmagic Lite key configuration */
// #define BOOTMAGIC_LITE_ROW 0
// #define BOOTMAGIC_LITE_COLUMN 0