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) | |||
| 886 | endif | 886 | endif |
| 887 | endif | 887 | endif |
| 888 | 888 | ||
| 889 | ENCODER_ENABLE ?= no | ||
| 890 | ENCODER_DRIVER ?= quadrature | ||
| 891 | VALID_ENCODER_DRIVER_TYPES := quadrature custom | ||
| 889 | ifeq ($(strip $(ENCODER_ENABLE)), yes) | 892 | ifeq ($(strip $(ENCODER_ENABLE)), yes) |
| 893 | ifeq ($(filter $(ENCODER_DRIVER),$(VALID_ENCODER_DRIVER_TYPES)),) | ||
| 894 | $(call CATASTROPHIC_ERROR,Invalid ENCODER_DRIVER,ENCODER_DRIVER="$(ENCODER_DRIVER)" is not a valid encoder driver) | ||
| 895 | endif | ||
| 890 | SRC += $(QUANTUM_DIR)/encoder.c | 896 | SRC += $(QUANTUM_DIR)/encoder.c |
| 891 | OPT_DEFS += -DENCODER_ENABLE | 897 | OPT_DEFS += -DENCODER_ENABLE |
| 898 | OPT_DEFS += -DENCODER_DRIVER_$(strip $(shell echo $(ENCODER_DRIVER) | tr '[:lower:]' '[:upper:]')) | ||
| 899 | |||
| 900 | COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/encoder | ||
| 901 | COMMON_VPATH += $(DRIVER_PATH)/encoder | ||
| 902 | |||
| 903 | ifneq ($(strip $(ENCODER_DRIVER)), custom) | ||
| 904 | SRC += encoder_$(strip $(ENCODER_DRIVER)).c | ||
| 905 | endif | ||
| 906 | |||
| 892 | ifeq ($(strip $(ENCODER_MAP_ENABLE)), yes) | 907 | ifeq ($(strip $(ENCODER_MAP_ENABLE)), yes) |
| 893 | OPT_DEFS += -DENCODER_MAP_ENABLE | 908 | OPT_DEFS += -DENCODER_MAP_ENABLE |
| 894 | endif | 909 | endif |
