diff options
author | Nick Brassel <nick@tzarc.org> | 2024-02-18 21:17:15 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-18 21:17:15 +1100 |
commit | 9d9cdaaa2d035787b0b50c26f2975695fdbc16f4 (patch) | |
tree | 1a9f5d16ffc0e3bd27bc14791c25405a79ccd069 /builddefs | |
parent | 2eb9ff8efd1df2c98724481c71c8ab8a5b62e31e (diff) |
Add encoder abstraction. (#21548)
Diffstat (limited to 'builddefs')
-rw-r--r-- | builddefs/common_features.mk | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk index 90e0ff827d..58e41f5230 100644 --- a/builddefs/common_features.mk +++ b/builddefs/common_features.mk @@ -886,9 +886,24 @@ ifeq ($(strip $(BLUETOOTH_ENABLE)), yes) endif endif +ENCODER_ENABLE ?= no +ENCODER_DRIVER ?= quadrature +VALID_ENCODER_DRIVER_TYPES := quadrature custom ifeq ($(strip $(ENCODER_ENABLE)), yes) + ifeq ($(filter $(ENCODER_DRIVER),$(VALID_ENCODER_DRIVER_TYPES)),) + $(call CATASTROPHIC_ERROR,Invalid ENCODER_DRIVER,ENCODER_DRIVER="$(ENCODER_DRIVER)" is not a valid encoder driver) + endif SRC += $(QUANTUM_DIR)/encoder.c OPT_DEFS += -DENCODER_ENABLE + OPT_DEFS += -DENCODER_DRIVER_$(strip $(shell echo $(ENCODER_DRIVER) | tr '[:lower:]' '[:upper:]')) + + COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/encoder + COMMON_VPATH += $(DRIVER_PATH)/encoder + + ifneq ($(strip $(ENCODER_DRIVER)), custom) + SRC += encoder_$(strip $(ENCODER_DRIVER)).c + endif + ifeq ($(strip $(ENCODER_MAP_ENABLE)), yes) OPT_DEFS += -DENCODER_MAP_ENABLE endif |