aboutsummaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/quantum.c34
-rw-r--r--quantum/quantum.h9
-rw-r--r--quantum/template/avr/config.h3
-rw-r--r--quantum/template/ps2avrgb/config.h4
4 files changed, 49 insertions, 1 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c
index c9bec6740..5f1a691c8 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -949,8 +949,40 @@ void tap_random_base64(void) {
949 } 949 }
950} 950}
951 951
952__attribute__((weak))
953void bootmagic_lite(void) {
954 // The lite version of TMK's bootmagic based on Wilba.
955 // 100% less potential for accidentally making the
956 // keyboard do stupid things.
957
958 // We need multiple scans because debouncing can't be turned off.
959 matrix_scan();
960 #if defined(DEBOUNCING_DELAY) && DEBOUNCING_DELAY > 0
961 wait_ms(DEBOUNCING_DELAY * 2);
962 #elif defined(DEBOUNCE) && DEBOUNCE > 0
963 wait_ms(DEBOUNCE * 2);
964 #else
965 wait_ms(30);
966 #endif
967 matrix_scan();
968
969 // If the Esc and space bar are held down on power up,
970 // reset the EEPROM valid state and jump to bootloader.
971 // Assumes Esc is at [0,0].
972 // This isn't very generalized, but we need something that doesn't
973 // rely on user's keymaps in firmware or EEPROM.
974 if (matrix_get_row(BOOTMAGIC_LITE_ROW) & (1 << BOOTMAGIC_LITE_COLUMN)) {
975 eeconfig_disable();
976 // Jump to bootloader.
977 bootloader_jump();
978 }
979}
980
952void matrix_init_quantum() { 981void matrix_init_quantum() {
953 if (!eeconfig_is_enabled() && !eeconfig_is_disabled()) { 982 #ifdef BOOTMAGIC_LITE
983 bootmagic_lite();
984 #endif
985 if (!eeconfig_is_enabled()) {
954 eeconfig_init(); 986 eeconfig_init();
955 } 987 }
956 #ifdef BACKLIGHT_ENABLE 988 #ifdef BACKLIGHT_ENABLE
diff --git a/quantum/quantum.h b/quantum/quantum.h
index 87a61356c..1d3ee033f 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -224,6 +224,15 @@ bool process_action_kb(keyrecord_t *record);
224bool process_record_kb(uint16_t keycode, keyrecord_t *record); 224bool process_record_kb(uint16_t keycode, keyrecord_t *record);
225bool process_record_user(uint16_t keycode, keyrecord_t *record); 225bool process_record_user(uint16_t keycode, keyrecord_t *record);
226 226
227#ifndef BOOTMAGIC_LITE_COLUMN
228 #define BOOTMAGIC_LITE_COLUMN 0
229#endif
230#ifndef BOOTMAGIC_LITE_ROW
231 #define BOOTMAGIC_LITE_ROW 0
232#endif
233
234void bootmagic_lite(void);
235
227void reset_keyboard(void); 236void reset_keyboard(void);
228 237
229void startup_user(void); 238void startup_user(void);
diff --git a/quantum/template/avr/config.h b/quantum/template/avr/config.h
index caa72af0c..56395f376 100644
--- a/quantum/template/avr/config.h
+++ b/quantum/template/avr/config.h
@@ -222,3 +222,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
222#endif 222#endif
223*/ 223*/
224 224
225/* Bootmagic Lite key configuration */
226// #define BOOTMAGIC_LITE_ROW 0
227// #define BOOTMAGIC_LITE_COLUMN 0
diff --git a/quantum/template/ps2avrgb/config.h b/quantum/template/ps2avrgb/config.h
index d2c83781f..4ff3513bc 100644
--- a/quantum/template/ps2avrgb/config.h
+++ b/quantum/template/ps2avrgb/config.h
@@ -44,3 +44,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
44 44
45/* key combination for command */ 45/* key combination for command */
46#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) 46#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
47
48/* Bootmagic Lite key configuration */
49// #define BOOTMAGIC_LITE_ROW 0
50// #define BOOTMAGIC_LITE_COLUMN 0