Allow for `keymaps` array to be implemented in a file other than `$(KEYMAP_C)` (#17559)

This commit is contained in:
Nick Brassel 2022-07-05 08:58:35 +10:00 committed by GitHub
parent 5cad58dfa9
commit 0e5d67145a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 3 deletions

View File

@ -400,6 +400,12 @@ endif
OPT_DEFS += -DKEYMAP_C=\"$(KEYMAP_C)\" OPT_DEFS += -DKEYMAP_C=\"$(KEYMAP_C)\"
# If a keymap or userspace places their keymap array in another file instead, allow for it to be included
# !!NOTE!! -- For this to work, the source file cannot be part of $(SRC), so users should not add it via `SRC += <file>`
ifneq ($(strip $(INTROSPECTION_KEYMAP_C)),)
OPT_DEFS += -DINTROSPECTION_KEYMAP_C=\"$(strip $(INTROSPECTION_KEYMAP_C))\"
endif
# project specific files # project specific files
SRC += \ SRC += \
$(KEYBOARD_SRC) \ $(KEYBOARD_SRC) \

View File

@ -4,6 +4,11 @@
// Pull the actual keymap code so that we can inspect stuff from it // Pull the actual keymap code so that we can inspect stuff from it
#include KEYMAP_C #include KEYMAP_C
// Allow for keymap or userspace rules.mk to specify an alternate location for the keymap array
#ifdef INTROSPECTION_KEYMAP_C
# include INTROSPECTION_KEYMAP_C
#endif // INTROSPECTION_KEYMAP_C
#include "keymap_introspection.h" #include "keymap_introspection.h"
#define NUM_KEYMAP_LAYERS ((uint8_t)(sizeof(keymaps) / ((MATRIX_ROWS) * (MATRIX_COLS) * sizeof(uint16_t)))) #define NUM_KEYMAP_LAYERS ((uint8_t)(sizeof(keymaps) / ((MATRIX_ROWS) * (MATRIX_COLS) * sizeof(uint16_t))))

View File

@ -1,8 +1,6 @@
# Copyright 2019 Manna Harbour # Copyright 2019 Manna Harbour
# https://github.com/manna-harbour/miryoku # https://github.com/manna-harbour/miryoku
SRC += manna-harbour_miryoku.c # keymaps
# alternative layouts: # alternative layouts:
# alphas # alphas

View File

@ -5,7 +5,7 @@ MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control EXTRAKEY_ENABLE = yes # Audio control and System control
AUTO_SHIFT_ENABLE = yes # Auto Shift AUTO_SHIFT_ENABLE = yes # Auto Shift
SRC += manna-harbour_miryoku.c # keymaps INTROSPECTION_KEYMAP_C = manna-harbour_miryoku.c # keymaps
include users/manna-harbour_miryoku/custom_rules.mk include users/manna-harbour_miryoku/custom_rules.mk