From c49f0c401f2fcb87357b5123d8b530c5edc74689 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Fri, 16 Jul 2021 16:34:59 -0700 Subject: [PATCH] Adding BOOTLOADER_ENABLE=both mode, which combines full and lite mode Allowing BOOTMAGIC_ENABLE=both when VIA is enabled --- common_features.mk | 11 ++++++++--- docs/feature_bootmagic.md | 11 +++++++++-- quantum/bootmagic/bootmagic.h | 5 ++--- quantum/bootmagic/bootmagic_full.c | 2 +- quantum/bootmagic/bootmagic_full.h | 4 +++- quantum/bootmagic/bootmagic_lite.c | 2 -- quantum/bootmagic/magic.c | 7 ++++++- 7 files changed, 29 insertions(+), 13 deletions(-) diff --git a/common_features.mk b/common_features.mk index 74b94ecd77c3..c4d8862b838c 100644 --- a/common_features.mk +++ b/common_features.mk @@ -466,10 +466,13 @@ ifeq ($(strip $(VELOCIKEY_ENABLE)), yes) SRC += $(QUANTUM_DIR)/velocikey.c endif +BOOTMAGIC_ENABLE ?= no ifeq ($(strip $(VIA_ENABLE)), yes) DYNAMIC_KEYMAP_ENABLE := yes RAW_ENABLE := yes + ifneq ($(strip $(BOOTMAGIC_ENABLE)), both) BOOTMAGIC_ENABLE := lite + endif SRC += $(QUANTUM_DIR)/via.c OPT_DEFS += -DVIA_ENABLE endif @@ -484,13 +487,15 @@ ifeq ($(strip $(DIP_SWITCH_ENABLE)), yes) SRC += $(QUANTUM_DIR)/dip_switch.c endif -VALID_MAGIC_TYPES := yes full lite -BOOTMAGIC_ENABLE ?= no +VALID_MAGIC_TYPES := yes full lite both ifneq ($(strip $(BOOTMAGIC_ENABLE)), no) ifeq ($(filter $(BOOTMAGIC_ENABLE),$(VALID_MAGIC_TYPES)),) $(error BOOTMAGIC_ENABLE="$(BOOTMAGIC_ENABLE)" is not a valid type of magic) endif - ifneq ($(strip $(BOOTMAGIC_ENABLE)), full) + ifeq ($(strip $(BOOTMAGIC_ENABLE)), both) + OPT_DEFS += -DBOOTMAGIC_LITE -DBOOTMAGIC_ENABLE + QUANTUM_SRC += $(QUANTUM_DIR)/bootmagic/bootmagic_full.c $(QUANTUM_DIR)/bootmagic/bootmagic_lite.c + else ifneq ($(strip $(BOOTMAGIC_ENABLE)), full) OPT_DEFS += -DBOOTMAGIC_LITE QUANTUM_SRC += $(QUANTUM_DIR)/bootmagic/bootmagic_lite.c else diff --git a/docs/feature_bootmagic.md b/docs/feature_bootmagic.md index f084052cc74c..64a7581dec56 100644 --- a/docs/feature_bootmagic.md +++ b/docs/feature_bootmagic.md @@ -14,14 +14,21 @@ On some keyboards Bootmagic is disabled by default. If this is the case, it must BOOTMAGIC_ENABLE = full ``` -?> You may see `yes` being used in place of `full`, and this is okay. However, `yes` is deprecated, and ideally `full` (or `lite`) should be used instead. - Additionally, you can use [Bootmagic Lite](#bootmagic-lite) (a scaled down, very basic version of Bootmagic) by adding the following to your `rules.mk` file: ```make BOOTMAGIC_ENABLE = lite ``` +?> You may see `yes` being used in place of `lite`, and this is okay. However, `yes` is deprecated, and ideally `full` or `lite` should be used instead. + + +You can enable both `full` and `lite` mode by adding the following to your `rules.mk` file: + +```make +BOOTMAGIC_ENABLE = both +``` + ## Hotkeys Hold down the Bootmagic key (Space by default) and the desired hotkey while plugging in your keyboard. For example, holding Space+`B` should cause it to enter the bootloader. diff --git a/quantum/bootmagic/bootmagic.h b/quantum/bootmagic/bootmagic.h index 959750178d38..d00ed66bceb2 100644 --- a/quantum/bootmagic/bootmagic.h +++ b/quantum/bootmagic/bootmagic.h @@ -17,8 +17,7 @@ #if defined(BOOTMAGIC_ENABLE) # include "bootmagic_full.h" -#elif defined(BOOTMAGIC_LITE) +#endif +#if defined(BOOTMAGIC_LITE) # include "bootmagic_lite.h" #endif - -void bootmagic(void); diff --git a/quantum/bootmagic/bootmagic_full.c b/quantum/bootmagic/bootmagic_full.c index a7a0dcfcb2cb..b30e662bc731 100644 --- a/quantum/bootmagic/bootmagic_full.c +++ b/quantum/bootmagic/bootmagic_full.c @@ -53,7 +53,7 @@ static bool bootmagic_scan_keycode(uint8_t keycode) { return scan_keycode(keycode); } -void bootmagic(void) { +void bootmagic_full(void) { /* do scans in case of bounce */ print("bootmagic scan: ... "); uint8_t scan = 100; diff --git a/quantum/bootmagic/bootmagic_full.h b/quantum/bootmagic/bootmagic_full.h index 28f914c1b638..5f91432a9519 100644 --- a/quantum/bootmagic/bootmagic_full.h +++ b/quantum/bootmagic/bootmagic_full.h @@ -112,4 +112,6 @@ #endif #ifndef BOOTMAGIC_KEY_DEFAULT_LAYER_7 # define BOOTMAGIC_KEY_DEFAULT_LAYER_7 KC_7 -#endif \ No newline at end of file +#endif + +void bootmagic_full(void); diff --git a/quantum/bootmagic/bootmagic_lite.c b/quantum/bootmagic/bootmagic_lite.c index 9cbdcb0bbdfc..e5408f67c842 100644 --- a/quantum/bootmagic/bootmagic_lite.c +++ b/quantum/bootmagic/bootmagic_lite.c @@ -62,5 +62,3 @@ __attribute__((weak)) void bootmagic_lite(void) { bootloader_jump(); } } - -void bootmagic(void) { bootmagic_lite(); } diff --git a/quantum/bootmagic/magic.c b/quantum/bootmagic/magic.c index f1cb11c39576..8088f87ad300 100644 --- a/quantum/bootmagic/magic.c +++ b/quantum/bootmagic/magic.c @@ -43,7 +43,12 @@ void magic(void) { debug_config.raw = eeconfig_read_debug(); keymap_config.raw = eeconfig_read_keymap(); - bootmagic(); +#if defined(BOOTMAGIC_LITE) + bootmagic_lite(); +#endif +#if defined(BOOTMAGIC_ENABLE) + bootmagic_full(); +#endif /* read here just incase bootmagic process changed its value */ layer_state_t default_layer = (layer_state_t)eeconfig_read_default_layer();