summaryrefslogtreecommitdiffstats
path: root/common_features.mk
diff options
context:
space:
mode:
Diffstat (limited to 'common_features.mk')
-rw-r--r--common_features.mk104
1 files changed, 89 insertions, 15 deletions
diff --git a/common_features.mk b/common_features.mk
index 11065dfa96..d238b28124 100644
--- a/common_features.mk
+++ b/common_features.mk
@@ -42,12 +42,31 @@ ifeq ($(strip $(COMMAND_ENABLE)), yes)
OPT_DEFS += -DCOMMAND_ENABLE
endif
+AUDIO_ENABLE ?= no
ifeq ($(strip $(AUDIO_ENABLE)), yes)
+ ifeq ($(PLATFORM),CHIBIOS)
+ AUDIO_DRIVER ?= dac_basic
+ ifeq ($(strip $(AUDIO_DRIVER)), dac_basic)
+ OPT_DEFS += -DAUDIO_DRIVER_DAC
+ else ifeq ($(strip $(AUDIO_DRIVER)), dac_additive)
+ OPT_DEFS += -DAUDIO_DRIVER_DAC
+ ## stm32f2 and above have a usable DAC unit, f1 do not, and need to use pwm instead
+ else ifeq ($(strip $(AUDIO_DRIVER)), pwm_software)
+ OPT_DEFS += -DAUDIO_DRIVER_PWM
+ else ifeq ($(strip $(AUDIO_DRIVER)), pwm_hardware)
+ OPT_DEFS += -DAUDIO_DRIVER_PWM
+ endif
+ else
+ # fallback for all other platforms is pwm
+ AUDIO_DRIVER ?= pwm_hardware
+ OPT_DEFS += -DAUDIO_DRIVER_PWM
+ endif
OPT_DEFS += -DAUDIO_ENABLE
MUSIC_ENABLE = yes
SRC += $(QUANTUM_DIR)/process_keycode/process_audio.c
SRC += $(QUANTUM_DIR)/process_keycode/process_clicky.c
- SRC += $(QUANTUM_DIR)/audio/audio_$(PLATFORM_KEY).c
+ SRC += $(QUANTUM_DIR)/audio/audio.c ## common audio code, hardware agnostic
+ SRC += $(QUANTUM_DIR)/audio/driver_$(PLATFORM_KEY)_$(strip $(AUDIO_DRIVER)).c
SRC += $(QUANTUM_DIR)/audio/voices.c
SRC += $(QUANTUM_DIR)/audio/luts.c
endif
@@ -80,9 +99,10 @@ ifeq ($(strip $(VIRTSER_ENABLE)), yes)
OPT_DEFS += -DVIRTSER_ENABLE
endif
-ifeq ($(strip $(FAUXCLICKY_ENABLE)), yes)
- OPT_DEFS += -DFAUXCLICKY_ENABLE
- SRC += $(QUANTUM_DIR)/fauxclicky.c
+ifeq ($(strip $(MOUSEKEY_ENABLE)), yes)
+ OPT_DEFS += -DMOUSEKEY_ENABLE
+ OPT_DEFS += -DMOUSE_ENABLE
+ SRC += $(QUANTUM_DIR)/mousekey.c
endif
ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes)
@@ -141,7 +161,7 @@ else
# This ensures that the EEPROM page buffer fits into RAM
USE_PROCESS_STACKSIZE = 0x600
USE_EXCEPTIONS_STACKSIZE = 0x300
-
+
SRC += $(PLATFORM_COMMON_DIR)/eeprom_stm32.c
SRC += $(PLATFORM_COMMON_DIR)/flash_stm32.c
OPT_DEFS += -DEEPROM_EMU_STM32F042x6
@@ -162,18 +182,38 @@ else
endif
endif
+RGBLIGHT_ENABLE ?= no
+VALID_RGBLIGHT_TYPES := WS2812 APA102 custom
+
+ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes)
+ RGBLIGHT_DRIVER ?= custom
+endif
+
ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
- POST_CONFIG_H += $(QUANTUM_DIR)/rgblight_post_config.h
- OPT_DEFS += -DRGBLIGHT_ENABLE
- SRC += $(QUANTUM_DIR)/color.c
- SRC += $(QUANTUM_DIR)/rgblight.c
- CIE1931_CURVE := yes
- RGB_KEYCODES_ENABLE := yes
- ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes)
- OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER
+ RGBLIGHT_DRIVER ?= WS2812
+
+ ifeq ($(filter $(RGBLIGHT_DRIVER),$(VALID_RGBLIGHT_TYPES)),)
+ $(error RGBLIGHT_DRIVER="$(RGBLIGHT_DRIVER)" is not a valid RGB type)
else
+ POST_CONFIG_H += $(QUANTUM_DIR)/rgblight_post_config.h
+ OPT_DEFS += -DRGBLIGHT_ENABLE
+ SRC += $(QUANTUM_DIR)/color.c
+ SRC += $(QUANTUM_DIR)/rgblight.c
+ CIE1931_CURVE := yes
+ RGB_KEYCODES_ENABLE := yes
+ endif
+
+ ifeq ($(strip $(RGBLIGHT_DRIVER)), WS2812)
WS2812_DRIVER_REQUIRED := yes
endif
+
+ ifeq ($(strip $(RGBLIGHT_DRIVER)), APA102)
+ APA102_DRIVER_REQUIRED := yes
+ endif
+
+ ifeq ($(strip $(RGBLIGHT_DRIVER)), custom)
+ OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER
+ endif
endif
LED_MATRIX_ENABLE ?= no
@@ -207,7 +247,7 @@ ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
$(error "$(RGB_MATRIX_DRIVER)" is not a valid matrix type)
endif
OPT_DEFS += -DRGB_MATRIX_ENABLE
-ifneq (,$(filter $(MCU), atmega16u2 atmega32u2))
+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
@@ -250,6 +290,11 @@ endif
WS2812_DRIVER_REQUIRED := yes
endif
+ ifeq ($(strip $(RGB_MATRIX_DRIVER)), APA102)
+ OPT_DEFS += -DAPA102
+ APA102_DRIVER_REQUIRED := yes
+ endif
+
ifeq ($(strip $(RGB_MATRIX_CUSTOM_KB)), yes)
OPT_DEFS += -DRGB_MATRIX_CUSTOM_KB
endif
@@ -352,6 +397,11 @@ ifeq ($(strip $(WS2812_DRIVER_REQUIRED)), yes)
endif
endif
+ifeq ($(strip $(APA102_DRIVER_REQUIRED)), yes)
+ COMMON_VPATH += $(DRIVER_PATH)/apa102
+ SRC += apa102.c
+endif
+
ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
CIE1931_CURVE := yes
endif
@@ -458,7 +508,7 @@ ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
# Determine which (if any) transport files are required
ifneq ($(strip $(SPLIT_TRANSPORT)), custom)
- QUANTUM_SRC += $(QUANTUM_DIR)/split_common/transport.c
+ QUANTUM_LIB_SRC += $(QUANTUM_DIR)/split_common/transport.c
# Functions added via QUANTUM_LIB_SRC are only included in the final binary if they're called.
# Unused functions are pruned away, which is why we can add multiple drivers here without bloat.
ifeq ($(PLATFORM),AVR)
@@ -599,3 +649,27 @@ endif
ifeq ($(strip $(JOYSTICK_ENABLE)), digital)
OPT_DEFS += -DDIGITAL_JOYSTICK_ENABLE
endif
+
+USBPD_ENABLE ?= no
+VALID_USBPD_DRIVER_TYPES = custom vendor
+USBPD_DRIVER ?= vendor
+ifeq ($(strip $(USBPD_ENABLE)), yes)
+ ifeq ($(filter $(strip $(USBPD_DRIVER)),$(VALID_USBPD_DRIVER_TYPES)),)
+ $(error USBPD_DRIVER="$(USBPD_DRIVER)" is not a valid USBPD driver)
+ else
+ OPT_DEFS += -DUSBPD_ENABLE
+ ifeq ($(strip $(USBPD_DRIVER)), vendor)
+ # Vendor-specific implementations
+ OPT_DEFS += -DUSBPD_VENDOR
+ ifeq ($(strip $(MCU_SERIES)), STM32G4xx)
+ OPT_DEFS += -DUSBPD_STM32G4
+ SRC += usbpd_stm32g4.c
+ else
+ $(error There is no vendor-provided USBPD driver available)
+ endif
+ else ifeq ($(strip $(USBPD_DRIVER)), custom)
+ OPT_DEFS += -DUSBPD_CUSTOM
+ # Board designers can add their own driver to $(SRC)
+ endif
+ endif
+endif \ No newline at end of file