summaryrefslogtreecommitdiffstats
path: root/common_features.mk
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2021-11-14 22:03:24 -0800
committerGitHub <noreply@github.com>2021-11-14 22:03:24 -0800
commit56e3f06a26851976e559aacf7a096c61403304be (patch)
tree1e9ec98ad239fdd241e77ac4c4822fc2721a9cea /common_features.mk
parent462c3a615113e84ac3ca837a5caeb928c0ec8505 (diff)
Rework and expand Pointing Device support (#14343)
Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com>
Diffstat (limited to 'common_features.mk')
-rw-r--r--common_features.mk39
1 files changed, 36 insertions, 3 deletions
diff --git a/common_features.mk b/common_features.mk
index 7abdce302c..896fbb0129 100644
--- a/common_features.mk
+++ b/common_features.mk
@@ -107,10 +107,43 @@ ifeq ($(strip $(MOUSEKEY_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/mousekey.c
endif
+VALID_POINTING_DEVICE_DRIVER_TYPES := adns5050 adns9800 analog_joystick cirque_pinnacle_i2c cirque_pinnacle_spi pmw3360 pimoroni_trackball custom
+POINTING_DEVICE_DRIVER ?= custom
ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes)
- OPT_DEFS += -DPOINTING_DEVICE_ENABLE
- MOUSE_ENABLE := yes
- SRC += $(QUANTUM_DIR)/pointing_device.c
+ ifeq ($(filter $(POINTING_DEVICE_DRIVER),$(VALID_POINTING_DEVICE_DRIVER_TYPES)),)
+ $(error POINTING_DEVICE_DRIVER="$(POINTING_DEVICE_DRIVER)" is not a valid pointing device type)
+ else
+ OPT_DEFS += -DPOINTING_DEVICE_ENABLE
+ MOUSE_ENABLE := yes
+ SRC += $(QUANTUM_DIR)/pointing_device.c
+ SRC += $(QUANTUM_DIR)/pointing_device_drivers.c
+ ifneq ($(strip $(POINTING_DEVICE_DRIVER)), custom)
+ SRC += drivers/sensors/$(strip $(POINTING_DEVICE_DRIVER)).c
+ OPT_DEFS += -DPOINTING_DEVICE_DRIVER_$(strip $(shell echo $(POINTING_DEVICE_DRIVER) | tr '[:lower:]' '[:upper:]'))
+ endif
+ OPT_DEFS += -DPOINTING_DEVICE_DRIVER_$(strip $(POINTING_DEVICE_DRIVER))
+ ifeq ($(strip $(POINTING_DEVICE_DRIVER)), adns9800)
+ OPT_DEFS += -DSTM32_SPI -DHAL_USE_SPI=TRUE
+ QUANTUM_LIB_SRC += spi_master.c
+ else ifeq ($(strip $(POINTING_DEVICE_DRIVER)), analog_joystick)
+ OPT_DEFS += -DSTM32_ADC -DHAL_USE_ADC=TRUE
+ LIB_SRC += analog.c
+ else ifeq ($(strip $(POINTING_DEVICE_DRIVER)), cirque_pinnacle_i2c)
+ OPT_DEFS += -DSTM32_I2C -DHAL_USE_I2C=TRUE
+ SRC += drivers/sensors/cirque_pinnacle.c
+ QUANTUM_LIB_SRC += i2c_master.c
+ else ifeq ($(strip $(POINTING_DEVICE_DRIVER)), cirque_pinnacle_spi)
+ OPT_DEFS += -DSTM32_SPI -DHAL_USE_SPI=TRUE
+ SRC += drivers/sensors/cirque_pinnacle.c
+ QUANTUM_LIB_SRC += spi_master.c
+ else ifeq ($(strip $(POINTING_DEVICE_DRIVER)), pimoroni_trackball)
+ OPT_DEFS += -DSTM32_SPI -DHAL_USE_I2C=TRUE
+ QUANTUM_LIB_SRC += i2c_master.c
+ else ifeq ($(strip $(POINTING_DEVICE_DRIVER)), pmw3360)
+ OPT_DEFS += -DSTM32_SPI -DHAL_USE_SPI=TRUE
+ QUANTUM_LIB_SRC += spi_master.c
+ endif
+ endif
endif
VALID_EEPROM_DRIVER_TYPES := vendor custom transient i2c spi