Browse Source

Migrate some common features to generic (#22403)

Joel Challis 2 years ago
parent
commit
147865cf57

+ 12 - 60
builddefs/common_features.mk

@@ -75,10 +75,7 @@ ifeq ($(strip $(AUDIO_ENABLE)), yes)
 endif
 endif
 
 
 ifeq ($(strip $(SEQUENCER_ENABLE)), yes)
 ifeq ($(strip $(SEQUENCER_ENABLE)), yes)
-    OPT_DEFS += -DSEQUENCER_ENABLE
     MUSIC_ENABLE = yes
     MUSIC_ENABLE = yes
-    SRC += $(QUANTUM_DIR)/sequencer/sequencer.c
-    SRC += $(QUANTUM_DIR)/process_keycode/process_sequencer.c
 endif
 endif
 
 
 ifeq ($(strip $(MIDI_ENABLE)), yes)
 ifeq ($(strip $(MIDI_ENABLE)), yes)
@@ -94,11 +91,6 @@ ifeq ($(strip $(MIDI_ENABLE)), yes)
     SRC += $(QUANTUM_DIR)/process_keycode/process_midi.c
     SRC += $(QUANTUM_DIR)/process_keycode/process_midi.c
 endif
 endif
 
 
-MUSIC_ENABLE ?= no
-ifeq ($(MUSIC_ENABLE), yes)
-    SRC += $(QUANTUM_DIR)/process_keycode/process_music.c
-endif
-
 VALID_STENO_PROTOCOL_TYPES := geminipr txbolt all
 VALID_STENO_PROTOCOL_TYPES := geminipr txbolt all
 STENO_PROTOCOL ?= all
 STENO_PROTOCOL ?= all
 ifeq ($(strip $(STENO_ENABLE)), yes)
 ifeq ($(strip $(STENO_ENABLE)), yes)
@@ -124,14 +116,8 @@ ifeq ($(strip $(STENO_ENABLE)), yes)
     endif
     endif
 endif
 endif
 
 
-ifeq ($(strip $(VIRTSER_ENABLE)), yes)
-    OPT_DEFS += -DVIRTSER_ENABLE
-endif
-
 ifeq ($(strip $(MOUSEKEY_ENABLE)), yes)
 ifeq ($(strip $(MOUSEKEY_ENABLE)), yes)
-    OPT_DEFS += -DMOUSEKEY_ENABLE
     MOUSE_ENABLE := yes
     MOUSE_ENABLE := yes
-    SRC += $(QUANTUM_DIR)/mousekey.c
 endif
 endif
 
 
 VALID_POINTING_DEVICE_DRIVER_TYPES := adns5050 adns9800 analog_joystick cirque_pinnacle_i2c cirque_pinnacle_spi paw3204 pmw3320 pmw3360 pmw3389 pimoroni_trackball custom
 VALID_POINTING_DEVICE_DRIVER_TYPES := adns5050 adns9800 analog_joystick cirque_pinnacle_i2c cirque_pinnacle_spi paw3204 pmw3320 pmw3360 pmw3389 pimoroni_trackball custom
@@ -360,10 +346,7 @@ ifeq ($(strip $(LED_MATRIX_ENABLE)), yes)
     endif
     endif
     OPT_DEFS += -DLED_MATRIX_ENABLE
     OPT_DEFS += -DLED_MATRIX_ENABLE
     OPT_DEFS += -DLED_MATRIX_$(strip $(shell echo $(LED_MATRIX_DRIVER) | tr '[:lower:]' '[:upper:]'))
     OPT_DEFS += -DLED_MATRIX_$(strip $(shell echo $(LED_MATRIX_DRIVER) | tr '[:lower:]' '[:upper:]'))
-ifneq (,$(filter $(MCU), atmega16u2 atmega32u2 at90usb162))
-    # ATmegaxxU2 does not have hardware MUL instruction - lib8tion must be told to use software multiplication routines
-    OPT_DEFS += -DLIB8_ATTINY
-endif
+
     COMMON_VPATH += $(QUANTUM_DIR)/led_matrix
     COMMON_VPATH += $(QUANTUM_DIR)/led_matrix
     COMMON_VPATH += $(QUANTUM_DIR)/led_matrix/animations
     COMMON_VPATH += $(QUANTUM_DIR)/led_matrix/animations
     COMMON_VPATH += $(QUANTUM_DIR)/led_matrix/animations/runners
     COMMON_VPATH += $(QUANTUM_DIR)/led_matrix/animations/runners
@@ -371,7 +354,7 @@ endif
     SRC += $(QUANTUM_DIR)/process_keycode/process_backlight.c
     SRC += $(QUANTUM_DIR)/process_keycode/process_backlight.c
     SRC += $(QUANTUM_DIR)/led_matrix/led_matrix.c
     SRC += $(QUANTUM_DIR)/led_matrix/led_matrix.c
     SRC += $(QUANTUM_DIR)/led_matrix/led_matrix_drivers.c
     SRC += $(QUANTUM_DIR)/led_matrix/led_matrix_drivers.c
-    SRC += $(LIB_PATH)/lib8tion/lib8tion.c
+    LIB8TION_ENABLE := yes
     CIE1931_CURVE := yes
     CIE1931_CURVE := yes
 
 
     ifeq ($(strip $(LED_MATRIX_DRIVER)), is31fl3218)
     ifeq ($(strip $(LED_MATRIX_DRIVER)), is31fl3218)
@@ -463,10 +446,7 @@ ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
     endif
     endif
     OPT_DEFS += -DRGB_MATRIX_ENABLE
     OPT_DEFS += -DRGB_MATRIX_ENABLE
     OPT_DEFS += -DRGB_MATRIX_$(strip $(shell echo $(RGB_MATRIX_DRIVER) | tr '[:lower:]' '[:upper:]'))
     OPT_DEFS += -DRGB_MATRIX_$(strip $(shell echo $(RGB_MATRIX_DRIVER) | tr '[:lower:]' '[:upper:]'))
-ifneq (,$(filter $(MCU), atmega16u2 atmega32u2 at90usb162))
-    # ATmegaxxU2 does not have hardware MUL instruction - lib8tion must be told to use software multiplication routines
-    OPT_DEFS += -DLIB8_ATTINY
-endif
+
     COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix
     COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix
     COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix/animations
     COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix/animations
     COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix/animations/runners
     COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix/animations/runners
@@ -474,7 +454,7 @@ endif
     SRC += $(QUANTUM_DIR)/color.c
     SRC += $(QUANTUM_DIR)/color.c
     SRC += $(QUANTUM_DIR)/rgb_matrix/rgb_matrix.c
     SRC += $(QUANTUM_DIR)/rgb_matrix/rgb_matrix.c
     SRC += $(QUANTUM_DIR)/rgb_matrix/rgb_matrix_drivers.c
     SRC += $(QUANTUM_DIR)/rgb_matrix/rgb_matrix_drivers.c
-    SRC += $(LIB_PATH)/lib8tion/lib8tion.c
+    LIB8TION_ENABLE := yes
     CIE1931_CURVE := yes
     CIE1931_CURVE := yes
     RGB_KEYCODES_ENABLE := yes
     RGB_KEYCODES_ENABLE := yes
 
 
@@ -632,8 +612,6 @@ ifeq ($(strip $(VIA_ENABLE)), yes)
     RAW_ENABLE := yes
     RAW_ENABLE := yes
     BOOTMAGIC_ENABLE := yes
     BOOTMAGIC_ENABLE := yes
     TRI_LAYER_ENABLE := yes
     TRI_LAYER_ENABLE := yes
-    SRC += $(QUANTUM_DIR)/via.c
-    OPT_DEFS += -DVIA_ENABLE
 endif
 endif
 
 
 VALID_MAGIC_TYPES := yes
 VALID_MAGIC_TYPES := yes
@@ -718,17 +696,20 @@ ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
     COMMON_VPATH += $(QUANTUM_PATH)/split_common
     COMMON_VPATH += $(QUANTUM_PATH)/split_common
 endif
 endif
 
 
-ifeq ($(strip $(CRC_ENABLE)), yes)
-    OPT_DEFS += -DCRC_ENABLE
-    SRC += crc.c
-endif
-
 ifeq ($(strip $(FNV_ENABLE)), yes)
 ifeq ($(strip $(FNV_ENABLE)), yes)
     OPT_DEFS += -DFNV_ENABLE
     OPT_DEFS += -DFNV_ENABLE
     VPATH += $(LIB_PATH)/fnv
     VPATH += $(LIB_PATH)/fnv
     SRC += qmk_fnv_type_validation.c hash_32a.c hash_64a.c
     SRC += qmk_fnv_type_validation.c hash_32a.c hash_64a.c
 endif
 endif
 
 
+ifeq ($(strip $(LIB8TION_ENABLE)), yes)
+    ifneq (,$(filter $(MCU), atmega16u2 atmega32u2 at90usb162))
+        # ATmegaxxU2 does not have hardware MUL instruction - lib8tion must be told to use software multiplication routines
+        OPT_DEFS += -DLIB8_ATTINY
+    endif
+    SRC += $(LIB_PATH)/lib8tion/lib8tion.c
+endif
+
 VALID_HAPTIC_DRIVER_TYPES := drv2605l solenoid
 VALID_HAPTIC_DRIVER_TYPES := drv2605l solenoid
 ifeq ($(strip $(HAPTIC_ENABLE)),yes)
 ifeq ($(strip $(HAPTIC_ENABLE)),yes)
     ifeq ($(filter $(HAPTIC_DRIVER),$(VALID_HAPTIC_DRIVER_TYPES)),)
     ifeq ($(filter $(HAPTIC_DRIVER),$(VALID_HAPTIC_DRIVER_TYPES)),)
@@ -819,27 +800,6 @@ ifeq ($(strip $(UNICODE_COMMON)), yes)
            $(QUANTUM_DIR)/unicode/utf8.c
            $(QUANTUM_DIR)/unicode/utf8.c
 endif
 endif
 
 
-MAGIC_ENABLE ?= yes
-ifeq ($(strip $(MAGIC_ENABLE)), yes)
-    SRC += $(QUANTUM_DIR)/process_keycode/process_magic.c
-    OPT_DEFS += -DMAGIC_KEYCODE_ENABLE
-endif
-
-SEND_STRING_ENABLE ?= yes
-ifeq ($(strip $(SEND_STRING_ENABLE)), yes)
-    OPT_DEFS += -DSEND_STRING_ENABLE
-    COMMON_VPATH += $(QUANTUM_DIR)/send_string
-    SRC += $(QUANTUM_DIR)/send_string/send_string.c
-endif
-
-ifeq ($(strip $(AUTO_SHIFT_ENABLE)), yes)
-    SRC += $(QUANTUM_DIR)/process_keycode/process_auto_shift.c
-    OPT_DEFS += -DAUTO_SHIFT_ENABLE
-    ifeq ($(strip $(AUTO_SHIFT_MODIFIERS)), yes)
-        OPT_DEFS += -DAUTO_SHIFT_MODIFIERS
-    endif
-endif
-
 ifeq ($(strip $(PS2_MOUSE_ENABLE)), yes)
 ifeq ($(strip $(PS2_MOUSE_ENABLE)), yes)
     PS2_ENABLE := yes
     PS2_ENABLE := yes
     MOUSE_ENABLE := yes
     MOUSE_ENABLE := yes
@@ -946,14 +906,6 @@ ifeq ($(strip $(ENCODER_ENABLE)), yes)
     endif
     endif
 endif
 endif
 
 
-ifeq ($(strip $(OS_DETECTION_ENABLE)), yes)
-    SRC += $(QUANTUM_DIR)/os_detection.c
-    OPT_DEFS += -DOS_DETECTION_ENABLE
-    ifeq ($(strip $(OS_DETECTION_DEBUG_ENABLE)), yes)
-        OPT_DEFS += -DOS_DETECTION_DEBUG_ENABLE
-    endif
-endif
-
 VALID_WS2812_DRIVER_TYPES := bitbang custom i2c pwm spi vendor
 VALID_WS2812_DRIVER_TYPES := bitbang custom i2c pwm spi vendor
 
 
 WS2812_DRIVER ?= bitbang
 WS2812_DRIVER ?= bitbang

+ 15 - 3
builddefs/generic_features.mk

@@ -13,33 +13,45 @@
 # You should have received a copy of the GNU General Public License
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-SPACE_CADET_ENABLE ?= yes
 GRAVE_ESC_ENABLE ?= yes
 GRAVE_ESC_ENABLE ?= yes
+MAGIC_ENABLE ?= yes
+SEND_STRING_ENABLE ?= yes
+SPACE_CADET_ENABLE ?= yes
 
 
 GENERIC_FEATURES = \
 GENERIC_FEATURES = \
+    AUTO_SHIFT \
     AUTOCORRECT \
     AUTOCORRECT \
     CAPS_WORD \
     CAPS_WORD \
     COMBO \
     COMBO \
     COMMAND \
     COMMAND \
+    CRC \
     DEFERRED_EXEC \
     DEFERRED_EXEC \
     DIGITIZER \
     DIGITIZER \
     DIP_SWITCH \
     DIP_SWITCH \
     DYNAMIC_KEYMAP \
     DYNAMIC_KEYMAP \
     DYNAMIC_MACRO \
     DYNAMIC_MACRO \
+    DYNAMIC_TAPPING_TERM \
     GRAVE_ESC \
     GRAVE_ESC \
     HAPTIC \
     HAPTIC \
     KEY_LOCK \
     KEY_LOCK \
     KEY_OVERRIDE \
     KEY_OVERRIDE \
     LEADER \
     LEADER \
+    MAGIC \
+    MOUSEKEY \
+    MUSIC \
+    OS_DETECTION \
     PROGRAMMABLE_BUTTON \
     PROGRAMMABLE_BUTTON \
     REPEAT_KEY \
     REPEAT_KEY \
     SECURE \
     SECURE \
+    SEND_STRING \
+    SEQUENCER \
     SPACE_CADET \
     SPACE_CADET \
     SWAP_HANDS \
     SWAP_HANDS \
     TAP_DANCE \
     TAP_DANCE \
+    TRI_LAYER \
+    VIA \
+    VIRTSER \
     WPM \
     WPM \
-    DYNAMIC_TAPPING_TERM \
-    TRI_LAYER
 
 
 define HANDLE_GENERIC_FEATURE
 define HANDLE_GENERIC_FEATURE
     # $$(info "Processing: $1_ENABLE $2.c")
     # $$(info "Processing: $1_ENABLE $2.c")

+ 0 - 1
builddefs/show_options.mk

@@ -37,7 +37,6 @@ OTHER_OPTION_NAMES = \
   UNICODEMAP_ENABLE \
   UNICODEMAP_ENABLE \
   UNICODE_COMMON \
   UNICODE_COMMON \
   AUTO_SHIFT_ENABLE \
   AUTO_SHIFT_ENABLE \
-  AUTO_SHIFT_MODIFIERS \
   DYNAMIC_TAPPING_TERM_ENABLE \
   DYNAMIC_TAPPING_TERM_ENABLE \
   COMBO_ENABLE \
   COMBO_ENABLE \
   KEY_LOCK_ENABLE \
   KEY_LOCK_ENABLE \

+ 7 - 2
docs/feature_os_detection.md

@@ -36,10 +36,15 @@ This time is quite short, probably hundreds of milliseconds, but this data may b
 
 
 If OS is guessed incorrectly, you may want to collect data about USB setup packets to refine the detection logic.
 If OS is guessed incorrectly, you may want to collect data about USB setup packets to refine the detection logic.
 
 
-To do so in your `rules.mk` add:
+To do so in your `config.h` add:
+
+```c
+#define OS_DETECTION_DEBUG_ENABLE
+```
+
+And in your `rules.mk` add:
 
 
 ```make
 ```make
-OS_DETECTION_DEBUG_ENABLE = yes
 CONSOLE_ENABLE = yes
 CONSOLE_ENABLE = yes
 ```
 ```
 
 

+ 0 - 1
keyboards/ergodox_ez/keymaps/hacker_dvorak/rules.mk

@@ -31,7 +31,6 @@ SWAP_HANDS_ENABLE = no  # Allow swapping hands of keyboard.
 # POINTING_DEVICE_ENABLE = no
 # POINTING_DEVICE_ENABLE = no
 
 
 # AUTO_SHIFT_ENABLE    = no
 # AUTO_SHIFT_ENABLE    = no
-# AUTO_SHIFT_MODIFIERS = no
 
 
 # This don't need argument?
 # This don't need argument?
 # CUSTOM_MATRIX    # Custom matrix file for the ErgoDox EZ
 # CUSTOM_MATRIX    # Custom matrix file for the ErgoDox EZ

+ 0 - 1
keyboards/keebio/levinson/keymaps/drogglbecher/rules.mk

@@ -1,5 +1,4 @@
 AUTO_SHIFT_ENABLE = no
 AUTO_SHIFT_ENABLE = no
-AUTO_SHIFT_MODIFIERS = no
 RGBLIGHT_ENABLE = no
 RGBLIGHT_ENABLE = no
 BACKLIGHT_ENABLE = no
 BACKLIGHT_ENABLE = no
 UNICODE_ENABLE = yes
 UNICODE_ENABLE = yes

+ 0 - 1
keyboards/planck/keymaps/sascha/rules.mk

@@ -1,5 +1,4 @@
 AUTO_SHIFT_ENABLE = no
 AUTO_SHIFT_ENABLE = no
-AUTO_SHIFT_MODIFIERS = no
 UNICODE_ENABLE = yes
 UNICODE_ENABLE = yes
 LTO_ENABLE = yes
 LTO_ENABLE = yes
 
 

+ 0 - 1
keyboards/splitkb/aurora/sweep/keymaps/flinguenheld/rules.mk

@@ -10,7 +10,6 @@ OLED_ENABLE = yes
 
 
 MOUSEKEY_ENABLE = yes
 MOUSEKEY_ENABLE = yes
 AUTO_SHIFT_ENABLE = yes
 AUTO_SHIFT_ENABLE = yes
-AUTO_SHIFT_MODIFIERS = no
 COMBO_ENABLE = yes
 COMBO_ENABLE = yes
 LEADER_ENABLE = yes
 LEADER_ENABLE = yes
 
 

+ 2 - 2
quantum/quantum.c

@@ -40,7 +40,7 @@
 #    include "process_leader.h"
 #    include "process_leader.h"
 #endif
 #endif
 
 
-#ifdef MAGIC_KEYCODE_ENABLE
+#ifdef MAGIC_ENABLE
 #    include "process_magic.h"
 #    include "process_magic.h"
 #endif
 #endif
 
 
@@ -366,7 +366,7 @@ bool process_record_quantum(keyrecord_t *record) {
 #ifdef SPACE_CADET_ENABLE
 #ifdef SPACE_CADET_ENABLE
             process_space_cadet(keycode, record) &&
             process_space_cadet(keycode, record) &&
 #endif
 #endif
-#ifdef MAGIC_KEYCODE_ENABLE
+#ifdef MAGIC_ENABLE
             process_magic(keycode, record) &&
             process_magic(keycode, record) &&
 #endif
 #endif
 #ifdef GRAVE_ESC_ENABLE
 #ifdef GRAVE_ESC_ENABLE