diff options
Diffstat (limited to 'common_features.mk')
| -rw-r--r-- | common_features.mk | 104 |
1 files changed, 89 insertions, 15 deletions
diff --git a/common_features.mk b/common_features.mk index 11065dfa9..d238b2812 100644 --- a/common_features.mk +++ b/common_features.mk | |||
| @@ -42,12 +42,31 @@ ifeq ($(strip $(COMMAND_ENABLE)), yes) | |||
| 42 | OPT_DEFS += -DCOMMAND_ENABLE | 42 | OPT_DEFS += -DCOMMAND_ENABLE |
| 43 | endif | 43 | endif |
| 44 | 44 | ||
| 45 | AUDIO_ENABLE ?= no | ||
| 45 | ifeq ($(strip $(AUDIO_ENABLE)), yes) | 46 | ifeq ($(strip $(AUDIO_ENABLE)), yes) |
| 47 | ifeq ($(PLATFORM),CHIBIOS) | ||
| 48 | AUDIO_DRIVER ?= dac_basic | ||
| 49 | ifeq ($(strip $(AUDIO_DRIVER)), dac_basic) | ||
| 50 | OPT_DEFS += -DAUDIO_DRIVER_DAC | ||
| 51 | else ifeq ($(strip $(AUDIO_DRIVER)), dac_additive) | ||
| 52 | OPT_DEFS += -DAUDIO_DRIVER_DAC | ||
| 53 | ## stm32f2 and above have a usable DAC unit, f1 do not, and need to use pwm instead | ||
| 54 | else ifeq ($(strip $(AUDIO_DRIVER)), pwm_software) | ||
| 55 | OPT_DEFS += -DAUDIO_DRIVER_PWM | ||
| 56 | else ifeq ($(strip $(AUDIO_DRIVER)), pwm_hardware) | ||
| 57 | OPT_DEFS += -DAUDIO_DRIVER_PWM | ||
| 58 | endif | ||
| 59 | else | ||
| 60 | # fallback for all other platforms is pwm | ||
| 61 | AUDIO_DRIVER ?= pwm_hardware | ||
| 62 | OPT_DEFS += -DAUDIO_DRIVER_PWM | ||
| 63 | endif | ||
| 46 | OPT_DEFS += -DAUDIO_ENABLE | 64 | OPT_DEFS += -DAUDIO_ENABLE |
| 47 | MUSIC_ENABLE = yes | 65 | MUSIC_ENABLE = yes |
| 48 | SRC += $(QUANTUM_DIR)/process_keycode/process_audio.c | 66 | SRC += $(QUANTUM_DIR)/process_keycode/process_audio.c |
| 49 | SRC += $(QUANTUM_DIR)/process_keycode/process_clicky.c | 67 | SRC += $(QUANTUM_DIR)/process_keycode/process_clicky.c |
| 50 | SRC += $(QUANTUM_DIR)/audio/audio_$(PLATFORM_KEY).c | 68 | SRC += $(QUANTUM_DIR)/audio/audio.c ## common audio code, hardware agnostic |
| 69 | SRC += $(QUANTUM_DIR)/audio/driver_$(PLATFORM_KEY)_$(strip $(AUDIO_DRIVER)).c | ||
| 51 | SRC += $(QUANTUM_DIR)/audio/voices.c | 70 | SRC += $(QUANTUM_DIR)/audio/voices.c |
| 52 | SRC += $(QUANTUM_DIR)/audio/luts.c | 71 | SRC += $(QUANTUM_DIR)/audio/luts.c |
| 53 | endif | 72 | endif |
| @@ -80,9 +99,10 @@ ifeq ($(strip $(VIRTSER_ENABLE)), yes) | |||
| 80 | OPT_DEFS += -DVIRTSER_ENABLE | 99 | OPT_DEFS += -DVIRTSER_ENABLE |
| 81 | endif | 100 | endif |
| 82 | 101 | ||
| 83 | ifeq ($(strip $(FAUXCLICKY_ENABLE)), yes) | 102 | ifeq ($(strip $(MOUSEKEY_ENABLE)), yes) |
| 84 | OPT_DEFS += -DFAUXCLICKY_ENABLE | 103 | OPT_DEFS += -DMOUSEKEY_ENABLE |
| 85 | SRC += $(QUANTUM_DIR)/fauxclicky.c | 104 | OPT_DEFS += -DMOUSE_ENABLE |
| 105 | SRC += $(QUANTUM_DIR)/mousekey.c | ||
| 86 | endif | 106 | endif |
| 87 | 107 | ||
| 88 | ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes) | 108 | ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes) |
| @@ -141,7 +161,7 @@ else | |||
| 141 | # This ensures that the EEPROM page buffer fits into RAM | 161 | # This ensures that the EEPROM page buffer fits into RAM |
| 142 | USE_PROCESS_STACKSIZE = 0x600 | 162 | USE_PROCESS_STACKSIZE = 0x600 |
| 143 | USE_EXCEPTIONS_STACKSIZE = 0x300 | 163 | USE_EXCEPTIONS_STACKSIZE = 0x300 |
| 144 | 164 | ||
| 145 | SRC += $(PLATFORM_COMMON_DIR)/eeprom_stm32.c | 165 | SRC += $(PLATFORM_COMMON_DIR)/eeprom_stm32.c |
| 146 | SRC += $(PLATFORM_COMMON_DIR)/flash_stm32.c | 166 | SRC += $(PLATFORM_COMMON_DIR)/flash_stm32.c |
| 147 | OPT_DEFS += -DEEPROM_EMU_STM32F042x6 | 167 | OPT_DEFS += -DEEPROM_EMU_STM32F042x6 |
| @@ -162,18 +182,38 @@ else | |||
| 162 | endif | 182 | endif |
| 163 | endif | 183 | endif |
| 164 | 184 | ||
| 185 | RGBLIGHT_ENABLE ?= no | ||
| 186 | VALID_RGBLIGHT_TYPES := WS2812 APA102 custom | ||
| 187 | |||
| 188 | ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes) | ||
| 189 | RGBLIGHT_DRIVER ?= custom | ||
| 190 | endif | ||
| 191 | |||
| 165 | ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) | 192 | ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) |
| 166 | POST_CONFIG_H += $(QUANTUM_DIR)/rgblight_post_config.h | 193 | RGBLIGHT_DRIVER ?= WS2812 |
| 167 | OPT_DEFS += -DRGBLIGHT_ENABLE | 194 | |
| 168 | SRC += $(QUANTUM_DIR)/color.c | 195 | ifeq ($(filter $(RGBLIGHT_DRIVER),$(VALID_RGBLIGHT_TYPES)),) |
| 169 | SRC += $(QUANTUM_DIR)/rgblight.c | 196 | $(error RGBLIGHT_DRIVER="$(RGBLIGHT_DRIVER)" is not a valid RGB type) |
| 170 | CIE1931_CURVE := yes | ||
| 171 | RGB_KEYCODES_ENABLE := yes | ||
| 172 | ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes) | ||
| 173 | OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER | ||
| 174 | else | 197 | else |
| 198 | POST_CONFIG_H += $(QUANTUM_DIR)/rgblight_post_config.h | ||
| 199 | OPT_DEFS += -DRGBLIGHT_ENABLE | ||
| 200 | SRC += $(QUANTUM_DIR)/color.c | ||
| 201 | SRC += $(QUANTUM_DIR)/rgblight.c | ||
| 202 | CIE1931_CURVE := yes | ||
| 203 | RGB_KEYCODES_ENABLE := yes | ||
| 204 | endif | ||
| 205 | |||
| 206 | ifeq ($(strip $(RGBLIGHT_DRIVER)), WS2812) | ||
| 175 | WS2812_DRIVER_REQUIRED := yes | 207 | WS2812_DRIVER_REQUIRED := yes |
| 176 | endif | 208 | endif |
| 209 | |||
| 210 | ifeq ($(strip $(RGBLIGHT_DRIVER)), APA102) | ||
| 211 | APA102_DRIVER_REQUIRED := yes | ||
| 212 | endif | ||
| 213 | |||
| 214 | ifeq ($(strip $(RGBLIGHT_DRIVER)), custom) | ||
| 215 | OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER | ||
| 216 | endif | ||
| 177 | endif | 217 | endif |
| 178 | 218 | ||
| 179 | LED_MATRIX_ENABLE ?= no | 219 | LED_MATRIX_ENABLE ?= no |
| @@ -207,7 +247,7 @@ ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) | |||
| 207 | $(error "$(RGB_MATRIX_DRIVER)" is not a valid matrix type) | 247 | $(error "$(RGB_MATRIX_DRIVER)" is not a valid matrix type) |
| 208 | endif | 248 | endif |
| 209 | OPT_DEFS += -DRGB_MATRIX_ENABLE | 249 | OPT_DEFS += -DRGB_MATRIX_ENABLE |
| 210 | ifneq (,$(filter $(MCU), atmega16u2 atmega32u2)) | 250 | ifneq (,$(filter $(MCU), atmega16u2 atmega32u2 at90usb162)) |
| 211 | # ATmegaxxU2 does not have hardware MUL instruction - lib8tion must be told to use software multiplication routines | 251 | # ATmegaxxU2 does not have hardware MUL instruction - lib8tion must be told to use software multiplication routines |
| 212 | OPT_DEFS += -DLIB8_ATTINY | 252 | OPT_DEFS += -DLIB8_ATTINY |
| 213 | endif | 253 | endif |
| @@ -250,6 +290,11 @@ endif | |||
| 250 | WS2812_DRIVER_REQUIRED := yes | 290 | WS2812_DRIVER_REQUIRED := yes |
| 251 | endif | 291 | endif |
| 252 | 292 | ||
| 293 | ifeq ($(strip $(RGB_MATRIX_DRIVER)), APA102) | ||
| 294 | OPT_DEFS += -DAPA102 | ||
| 295 | APA102_DRIVER_REQUIRED := yes | ||
| 296 | endif | ||
| 297 | |||
| 253 | ifeq ($(strip $(RGB_MATRIX_CUSTOM_KB)), yes) | 298 | ifeq ($(strip $(RGB_MATRIX_CUSTOM_KB)), yes) |
| 254 | OPT_DEFS += -DRGB_MATRIX_CUSTOM_KB | 299 | OPT_DEFS += -DRGB_MATRIX_CUSTOM_KB |
| 255 | endif | 300 | endif |
| @@ -352,6 +397,11 @@ ifeq ($(strip $(WS2812_DRIVER_REQUIRED)), yes) | |||
| 352 | endif | 397 | endif |
| 353 | endif | 398 | endif |
| 354 | 399 | ||
| 400 | ifeq ($(strip $(APA102_DRIVER_REQUIRED)), yes) | ||
| 401 | COMMON_VPATH += $(DRIVER_PATH)/apa102 | ||
| 402 | SRC += apa102.c | ||
| 403 | endif | ||
| 404 | |||
| 355 | ifeq ($(strip $(VISUALIZER_ENABLE)), yes) | 405 | ifeq ($(strip $(VISUALIZER_ENABLE)), yes) |
| 356 | CIE1931_CURVE := yes | 406 | CIE1931_CURVE := yes |
| 357 | endif | 407 | endif |
| @@ -458,7 +508,7 @@ ifeq ($(strip $(SPLIT_KEYBOARD)), yes) | |||
| 458 | 508 | ||
| 459 | # Determine which (if any) transport files are required | 509 | # Determine which (if any) transport files are required |
| 460 | ifneq ($(strip $(SPLIT_TRANSPORT)), custom) | 510 | ifneq ($(strip $(SPLIT_TRANSPORT)), custom) |
| 461 | QUANTUM_SRC += $(QUANTUM_DIR)/split_common/transport.c | 511 | QUANTUM_LIB_SRC += $(QUANTUM_DIR)/split_common/transport.c |
| 462 | # Functions added via QUANTUM_LIB_SRC are only included in the final binary if they're called. | 512 | # Functions added via QUANTUM_LIB_SRC are only included in the final binary if they're called. |
| 463 | # Unused functions are pruned away, which is why we can add multiple drivers here without bloat. | 513 | # Unused functions are pruned away, which is why we can add multiple drivers here without bloat. |
| 464 | ifeq ($(PLATFORM),AVR) | 514 | ifeq ($(PLATFORM),AVR) |
| @@ -599,3 +649,27 @@ endif | |||
| 599 | ifeq ($(strip $(JOYSTICK_ENABLE)), digital) | 649 | ifeq ($(strip $(JOYSTICK_ENABLE)), digital) |
| 600 | OPT_DEFS += -DDIGITAL_JOYSTICK_ENABLE | 650 | OPT_DEFS += -DDIGITAL_JOYSTICK_ENABLE |
| 601 | endif | 651 | endif |
| 652 | |||
| 653 | USBPD_ENABLE ?= no | ||
| 654 | VALID_USBPD_DRIVER_TYPES = custom vendor | ||
| 655 | USBPD_DRIVER ?= vendor | ||
| 656 | ifeq ($(strip $(USBPD_ENABLE)), yes) | ||
| 657 | ifeq ($(filter $(strip $(USBPD_DRIVER)),$(VALID_USBPD_DRIVER_TYPES)),) | ||
| 658 | $(error USBPD_DRIVER="$(USBPD_DRIVER)" is not a valid USBPD driver) | ||
| 659 | else | ||
| 660 | OPT_DEFS += -DUSBPD_ENABLE | ||
| 661 | ifeq ($(strip $(USBPD_DRIVER)), vendor) | ||
| 662 | # Vendor-specific implementations | ||
| 663 | OPT_DEFS += -DUSBPD_VENDOR | ||
| 664 | ifeq ($(strip $(MCU_SERIES)), STM32G4xx) | ||
| 665 | OPT_DEFS += -DUSBPD_STM32G4 | ||
| 666 | SRC += usbpd_stm32g4.c | ||
| 667 | else | ||
| 668 | $(error There is no vendor-provided USBPD driver available) | ||
| 669 | endif | ||
| 670 | else ifeq ($(strip $(USBPD_DRIVER)), custom) | ||
| 671 | OPT_DEFS += -DUSBPD_CUSTOM | ||
| 672 | # Board designers can add their own driver to $(SRC) | ||
| 673 | endif | ||
| 674 | endif | ||
| 675 | endif \ No newline at end of file | ||
