Migrate some common features to generic (#22403)

This commit is contained in:
Joel Challis 2023-11-09 02:01:44 +00:00 committed by GitHub
parent 4e577cbbea
commit 147865cf57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 36 additions and 72 deletions

View File

@ -75,10 +75,7 @@ ifeq ($(strip $(AUDIO_ENABLE)), yes)
endif
ifeq ($(strip $(SEQUENCER_ENABLE)), yes)
OPT_DEFS += -DSEQUENCER_ENABLE
MUSIC_ENABLE = yes
SRC += $(QUANTUM_DIR)/sequencer/sequencer.c
SRC += $(QUANTUM_DIR)/process_keycode/process_sequencer.c
endif
ifeq ($(strip $(MIDI_ENABLE)), yes)
@ -94,11 +91,6 @@ ifeq ($(strip $(MIDI_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/process_keycode/process_midi.c
endif
MUSIC_ENABLE ?= no
ifeq ($(MUSIC_ENABLE), yes)
SRC += $(QUANTUM_DIR)/process_keycode/process_music.c
endif
VALID_STENO_PROTOCOL_TYPES := geminipr txbolt all
STENO_PROTOCOL ?= all
ifeq ($(strip $(STENO_ENABLE)), yes)
@ -124,14 +116,8 @@ ifeq ($(strip $(STENO_ENABLE)), yes)
endif
endif
ifeq ($(strip $(VIRTSER_ENABLE)), yes)
OPT_DEFS += -DVIRTSER_ENABLE
endif
ifeq ($(strip $(MOUSEKEY_ENABLE)), yes)
OPT_DEFS += -DMOUSEKEY_ENABLE
MOUSE_ENABLE := yes
SRC += $(QUANTUM_DIR)/mousekey.c
endif
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
OPT_DEFS += -DLED_MATRIX_ENABLE
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/animations
COMMON_VPATH += $(QUANTUM_DIR)/led_matrix/animations/runners
@ -371,7 +354,7 @@ endif
SRC += $(QUANTUM_DIR)/process_keycode/process_backlight.c
SRC += $(QUANTUM_DIR)/led_matrix/led_matrix.c
SRC += $(QUANTUM_DIR)/led_matrix/led_matrix_drivers.c
SRC += $(LIB_PATH)/lib8tion/lib8tion.c
LIB8TION_ENABLE := yes
CIE1931_CURVE := yes
ifeq ($(strip $(LED_MATRIX_DRIVER)), is31fl3218)
@ -463,10 +446,7 @@ ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
endif
OPT_DEFS += -DRGB_MATRIX_ENABLE
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/animations
COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix/animations/runners
@ -474,7 +454,7 @@ endif
SRC += $(QUANTUM_DIR)/color.c
SRC += $(QUANTUM_DIR)/rgb_matrix/rgb_matrix.c
SRC += $(QUANTUM_DIR)/rgb_matrix/rgb_matrix_drivers.c
SRC += $(LIB_PATH)/lib8tion/lib8tion.c
LIB8TION_ENABLE := yes
CIE1931_CURVE := yes
RGB_KEYCODES_ENABLE := yes
@ -632,8 +612,6 @@ ifeq ($(strip $(VIA_ENABLE)), yes)
RAW_ENABLE := yes
BOOTMAGIC_ENABLE := yes
TRI_LAYER_ENABLE := yes
SRC += $(QUANTUM_DIR)/via.c
OPT_DEFS += -DVIA_ENABLE
endif
VALID_MAGIC_TYPES := yes
@ -718,17 +696,20 @@ ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
COMMON_VPATH += $(QUANTUM_PATH)/split_common
endif
ifeq ($(strip $(CRC_ENABLE)), yes)
OPT_DEFS += -DCRC_ENABLE
SRC += crc.c
endif
ifeq ($(strip $(FNV_ENABLE)), yes)
OPT_DEFS += -DFNV_ENABLE
VPATH += $(LIB_PATH)/fnv
SRC += qmk_fnv_type_validation.c hash_32a.c hash_64a.c
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
ifeq ($(strip $(HAPTIC_ENABLE)),yes)
ifeq ($(filter $(HAPTIC_DRIVER),$(VALID_HAPTIC_DRIVER_TYPES)),)
@ -819,27 +800,6 @@ ifeq ($(strip $(UNICODE_COMMON)), yes)
$(QUANTUM_DIR)/unicode/utf8.c
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)
PS2_ENABLE := yes
MOUSE_ENABLE := yes
@ -946,14 +906,6 @@ ifeq ($(strip $(ENCODER_ENABLE)), yes)
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
WS2812_DRIVER ?= bitbang

View File

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

View File

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

View File

@ -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.
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
OS_DETECTION_DEBUG_ENABLE = yes
CONSOLE_ENABLE = yes
```

View File

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

View File

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

View File

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

View File

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

View File

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