Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BOOTMAGIC_ENABLE=both which combines lite and full mode #13572

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions common_features.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
11 changes: 9 additions & 2 deletions docs/feature_bootmagic.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 2 additions & 3 deletions quantum/bootmagic/bootmagic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
2 changes: 1 addition & 1 deletion quantum/bootmagic/bootmagic_full.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion quantum/bootmagic/bootmagic_full.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,6 @@
#endif
#ifndef BOOTMAGIC_KEY_DEFAULT_LAYER_7
# define BOOTMAGIC_KEY_DEFAULT_LAYER_7 KC_7
#endif
#endif

void bootmagic_full(void);
2 changes: 0 additions & 2 deletions quantum/bootmagic/bootmagic_lite.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,3 @@ __attribute__((weak)) void bootmagic_lite(void) {
bootloader_jump();
}
}

void bootmagic(void) { bootmagic_lite(); }
7 changes: 6 additions & 1 deletion quantum/bootmagic/magic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down