summaryrefslogtreecommitdiffstats
path: root/builddefs
diff options
context:
space:
mode:
authorMarek Kraus <gamelaster@users.noreply.github.com>2022-08-31 09:16:07 +0200
committerGitHub <noreply@github.com>2022-08-31 09:16:07 +0200
commit0237ff0c62d4278df3c0c93f5f85f84c1a0ed519 (patch)
treedceb6fc12c8d73de4e7e20160ceb9617387ac62b /builddefs
parentba7030d216c677538093043d357d819a81549ff7 (diff)
[Core] Rework PS/2 driver selection (#17892)
* [Core] Rework PS/2 driver selection Enabling and selecting PS/2 driver was using old approach, so it was reworked to current approach, inspired by Serial and WS2812 driver selections. * [Keyboard] Update keyboards using PS/2 to use new PS/2 driver selection * [Docs] Update PS/2 documentation to use new PS/2 driver selection * Fix indentation * [Core] Add PS2 to data driver * Fix oversight in property name Co-authored-by: Drashna Jaelre <drashna@live.com> * Add PS/2 pins to data driven mappings Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'builddefs')
-rw-r--r--builddefs/common_features.mk32
-rw-r--r--builddefs/show_options.mk2
2 files changed, 15 insertions, 19 deletions
diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk
index a23b5e82b9..9fa9e18814 100644
--- a/builddefs/common_features.mk
+++ b/builddefs/common_features.mk
@@ -805,31 +805,25 @@ ifeq ($(strip $(PS2_MOUSE_ENABLE)), yes)
OPT_DEFS += -DMOUSE_ENABLE
endif
-ifeq ($(strip $(PS2_USE_BUSYWAIT)), yes)
- PS2_ENABLE := yes
- SRC += ps2_busywait.c
- SRC += ps2_io.c
- OPT_DEFS += -DPS2_USE_BUSYWAIT
-endif
+VALID_PS2_DRIVER_TYPES := busywait interrupt usart vendor
-ifeq ($(strip $(PS2_USE_INT)), yes)
- PS2_ENABLE := yes
- SRC += ps2_interrupt.c
- SRC += ps2_io.c
- OPT_DEFS += -DPS2_USE_INT
-endif
+PS2_DRIVER ?= busywait
+ifeq ($(strip $(PS2_ENABLE)), yes)
+ ifeq ($(filter $(PS2_DRIVER),$(VALID_PS2_DRIVER_TYPES)),)
+ $(call CATASTROPHIC_ERROR,Invalid PS2_DRIVER,PS2_DRIVER="$(PS2_DRIVER)" is not a valid PS/2 driver)
+ endif
-ifeq ($(strip $(PS2_USE_USART)), yes)
- PS2_ENABLE := yes
- SRC += ps2_usart.c
- SRC += ps2_io.c
- OPT_DEFS += -DPS2_USE_USART
-endif
+ OPT_DEFS += -DPS2_DRIVER_$(strip $(shell echo $(PS2_DRIVER) | tr '[:lower:]' '[:upper:]'))
-ifeq ($(strip $(PS2_ENABLE)), yes)
COMMON_VPATH += $(DRIVER_PATH)/ps2
COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/ps2
OPT_DEFS += -DPS2_ENABLE
+
+ ifneq ($(strip $(PS2_DRIVER)), vendor)
+ SRC += ps2_io.c
+ endif
+
+ SRC += ps2_$(strip $(PS2_DRIVER)).c
endif
JOYSTICK_ENABLE ?= no
diff --git a/builddefs/show_options.mk b/builddefs/show_options.mk
index 98537e6da2..8d992c080c 100644
--- a/builddefs/show_options.mk
+++ b/builddefs/show_options.mk
@@ -66,7 +66,9 @@ OTHER_OPTION_NAMES = \
KEYLOGGER_ENABLE \
LCD_BACKLIGHT_ENABLE \
MACROS_ENABLED \
+ PS2_ENABLE \
PS2_MOUSE_ENABLE \
+ PS2_DRIVER \
RAW_ENABLE \
SWAP_HANDS_ENABLE \
RING_BUFFERED_6KRO_REPORT_ENABLE \