From a3223846f44c1cc892c59800fa3d2639219e781e Mon Sep 17 00:00:00 2001 From: skullY Date: Sat, 9 May 2020 10:27:10 -0700 Subject: [PATCH 1/3] Initial attempt at allowing keyboards to indicate what features they do not support --- build_keyboard.mk | 3 ++ disable_features.mk | 89 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 disable_features.mk diff --git a/build_keyboard.mk b/build_keyboard.mk index 4108704875d2..30588f0a493c 100644 --- a/build_keyboard.mk +++ b/build_keyboard.mk @@ -290,6 +290,9 @@ ifneq ("$(wildcard $(USER_PATH)/config.h)","") CONFIG_H += $(USER_PATH)/config.h endif +# Disable features that a keyboard doesn't support +-include disable_features.mk + # Object files directory # To put object files in current directory, use a dot (.), do NOT make # this an empty or blank macro! diff --git a/disable_features.mk b/disable_features.mk new file mode 100644 index 000000000000..38bf61705166 --- /dev/null +++ b/disable_features.mk @@ -0,0 +1,89 @@ +# Unconditionally disable features that a keyboard advertises it doesn't support + +ifeq ($(strip $(ADAFRUIT_BLE_SUPPORTED)), no) + ADAFRUIT_BLE_ENABLE=no +endif + +ifeq ($(strip $(AUDIO_SUPPORTED)), no) + AUDIO_ENABLE=no +endif + +ifeq ($(strip $(BACKLIGHT_SUPPORTED)), no) + BACKLIGHT_ENABLE=no +endif + +ifeq ($(strip $(BLUETOOTH_SUPPORTED)), no) + BLUETOOTH_ENABLE=no +endif + +ifeq ($(strip $(DIP_SWITCH_SUPPORTED)), no) + DIP_SWITCH_ENABLE=no +endif + +ifeq ($(strip $(DYNAMIC_KEYMAP_SUPPORTED)), no) + DYNAMIC_KEYMAP_ENABLE=no +endif + +ifeq ($(strip $(ENCODER_SUPPORTED)), no) + ENCODER_ENABLE=no +endif + +ifeq ($(strip $(HAPTIC_SUPPORTED)), no) + HAPTIC_ENABLE=no +endif + +ifeq ($(strip $(HD44780_SUPPORTED)), no) + HD44780_ENABLE=no +endif + +ifeq ($(strip $(IOS_DEVICE_SUPPORTED)), no) + IOS_DEVICE_ENABLE=no +endif + +ifeq ($(strip $(LCD_BACKLIGHT_SUPPORTED)), no) + LCD_BACKLIGHT_ENABLE=no +endif + +ifeq ($(strip $(LCD_SUPPORTED)), no) + LCD_ENABLE=no +endif + +ifeq ($(strip $(OLED_SUPPORTED)), no) + OLED_ENABLE=no +endif + +ifeq ($(strip $(PRINTING_SUPPORTED)), no) + PRINTING_ENABLE=no +endif + +ifeq ($(strip $(PS2_MOUSE_SUPPORTED)), no) + PS2_MOUSE_ENABLE=no +endif + +ifeq ($(strip $(RGBLIGHT_SUPPORTED)), no) + RGBLIGHT_ENABLE=no +endif + +ifeq ($(strip $(RGB_MATRIX_SUPPORTED)), no) + RGB_MATRIX_ENABLE=no +endif + +ifeq ($(strip $(STENO_SUPPORTED)), no) + STENO_ENABLE=no +endif + +ifeq ($(strip $(SWAP_HANDS_SUPPORTED)), no) + SWAP_HANDS_ENABLE=no +endif + +ifeq ($(strip $(VISUALIZER_SUPPORTED)), no) + VISUALIZER_ENABLE=no +endif + +ifeq ($(strip $(WATCHDOG_SUPPORTED)), no) + WATCHDOG_ENABLE=no +endif + +ifeq ($(strip $(XT_SUPPORTED)), no) + XT_ENABLE=no +endif From e6af06e77be5dbad78fd79ac04be1f9198d70898 Mon Sep 17 00:00:00 2001 From: skullY Date: Mon, 11 May 2020 21:08:42 -0700 Subject: [PATCH 2/3] try to use a for loop instead --- disable_features.mk | 113 +++++-------------- keyboards/clueboard/66_hotswap/gen1/rules.mk | 2 + 2 files changed, 28 insertions(+), 87 deletions(-) diff --git a/disable_features.mk b/disable_features.mk index 38bf61705166..c28cbdcda106 100644 --- a/disable_features.mk +++ b/disable_features.mk @@ -1,89 +1,28 @@ # Unconditionally disable features that a keyboard advertises it doesn't support -ifeq ($(strip $(ADAFRUIT_BLE_SUPPORTED)), no) - ADAFRUIT_BLE_ENABLE=no -endif - -ifeq ($(strip $(AUDIO_SUPPORTED)), no) - AUDIO_ENABLE=no -endif - -ifeq ($(strip $(BACKLIGHT_SUPPORTED)), no) - BACKLIGHT_ENABLE=no -endif - -ifeq ($(strip $(BLUETOOTH_SUPPORTED)), no) - BLUETOOTH_ENABLE=no -endif - -ifeq ($(strip $(DIP_SWITCH_SUPPORTED)), no) - DIP_SWITCH_ENABLE=no -endif - -ifeq ($(strip $(DYNAMIC_KEYMAP_SUPPORTED)), no) - DYNAMIC_KEYMAP_ENABLE=no -endif - -ifeq ($(strip $(ENCODER_SUPPORTED)), no) - ENCODER_ENABLE=no -endif - -ifeq ($(strip $(HAPTIC_SUPPORTED)), no) - HAPTIC_ENABLE=no -endif - -ifeq ($(strip $(HD44780_SUPPORTED)), no) - HD44780_ENABLE=no -endif - -ifeq ($(strip $(IOS_DEVICE_SUPPORTED)), no) - IOS_DEVICE_ENABLE=no -endif - -ifeq ($(strip $(LCD_BACKLIGHT_SUPPORTED)), no) - LCD_BACKLIGHT_ENABLE=no -endif - -ifeq ($(strip $(LCD_SUPPORTED)), no) - LCD_ENABLE=no -endif - -ifeq ($(strip $(OLED_SUPPORTED)), no) - OLED_ENABLE=no -endif - -ifeq ($(strip $(PRINTING_SUPPORTED)), no) - PRINTING_ENABLE=no -endif - -ifeq ($(strip $(PS2_MOUSE_SUPPORTED)), no) - PS2_MOUSE_ENABLE=no -endif - -ifeq ($(strip $(RGBLIGHT_SUPPORTED)), no) - RGBLIGHT_ENABLE=no -endif - -ifeq ($(strip $(RGB_MATRIX_SUPPORTED)), no) - RGB_MATRIX_ENABLE=no -endif - -ifeq ($(strip $(STENO_SUPPORTED)), no) - STENO_ENABLE=no -endif - -ifeq ($(strip $(SWAP_HANDS_SUPPORTED)), no) - SWAP_HANDS_ENABLE=no -endif - -ifeq ($(strip $(VISUALIZER_SUPPORTED)), no) - VISUALIZER_ENABLE=no -endif - -ifeq ($(strip $(WATCHDOG_SUPPORTED)), no) - WATCHDOG_ENABLE=no -endif - -ifeq ($(strip $(XT_SUPPORTED)), no) - XT_ENABLE=no -endif +FEATURE_NAMES := +FEATURE_NAMES += ADAFRUIT_BLE +FEATURE_NAMES += AUDIO +FEATURE_NAMES += BACKLIGHT +FEATURE_NAMES += BLUETOOTH +FEATURE_NAMES += DIP_SWITCH +FEATURE_NAMES += DYNAMIC_KEYMAP +FEATURE_NAMES += ENCODER +FEATURE_NAMES += HAPTIC +FEATURE_NAMES += HD44780 +FEATURE_NAMES += IOS_DEVICE +FEATURE_NAMES += LCD_BACKLIGHT +FEATURE_NAMES += LCD +FEATURE_NAMES += OLED +FEATURE_NAMES += PRINTING +FEATURE_NAMES += PS2_MOUSE +FEATURE_NAMES += RGBLIGHT +FEATURE_NAMES += RGB_MATRIX +FEATURE_NAMES += STENO +FEATURE_NAMES += SWAP_HANDS +FEATURE_NAMES += VISUALIZER +FEATURE_NAMES += WATCHDOG +FEATURE_NAMES += XT + +$(foreach AFEATURE,$(FEATURE_NAMES),\ + $(if $(filter $($(AFEATURE)_SUPPORTED),no),$(eval $(AFEATURE)_FEATURE=no))) diff --git a/keyboards/clueboard/66_hotswap/gen1/rules.mk b/keyboards/clueboard/66_hotswap/gen1/rules.mk index 1de003ce5a93..123fc7874b66 100644 --- a/keyboards/clueboard/66_hotswap/gen1/rules.mk +++ b/keyboards/clueboard/66_hotswap/gen1/rules.mk @@ -22,3 +22,5 @@ AUDIO_ENABLE = yes # project specific files SRC = led.c LAYOUTS += 66_ansi + +AUDIO_SUPPORTED = no From d6ae54c2aa84465be9b886e38b29341a58cf034b Mon Sep 17 00:00:00 2001 From: Zach White Date: Mon, 11 May 2020 21:17:33 -0700 Subject: [PATCH 3/3] Update disable_features.mk Co-authored-by: Drashna Jaelre --- disable_features.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/disable_features.mk b/disable_features.mk index c28cbdcda106..a3aaf0e17783 100644 --- a/disable_features.mk +++ b/disable_features.mk @@ -25,4 +25,4 @@ FEATURE_NAMES += WATCHDOG FEATURE_NAMES += XT $(foreach AFEATURE,$(FEATURE_NAMES),\ - $(if $(filter $($(AFEATURE)_SUPPORTED),no),$(eval $(AFEATURE)_FEATURE=no))) + $(if $(filter $($(AFEATURE)_SUPPORTED),no),$(eval $(AFEATURE)_ENABLE=no)))