From b5e73204e85ae656ae7b1d2ef4b2d196c61a7713 Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Sun, 5 Jun 2022 05:56:45 +0000 Subject: [PATCH] fix(drivers): Avoid build failures for GPIO driver * Avoid defining the ZMK GPIO drivers lib if none of the drivers are selected. --- app/drivers/CMakeLists.txt | 2 +- app/drivers/gpio/Kconfig | 3 +++ app/drivers/gpio/Kconfig.595 | 1 + app/drivers/gpio/Kconfig.mcp23017 | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/drivers/CMakeLists.txt b/app/drivers/CMakeLists.txt index c58ada48..44d69ac3 100644 --- a/app/drivers/CMakeLists.txt +++ b/app/drivers/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) 2020 The ZMK Contributors # SPDX-License-Identifier: MIT -add_subdirectory(gpio) +add_subdirectory_ifdef(CONFIG_ZMK_DRIVERS_GPIO gpio) add_subdirectory(kscan) add_subdirectory(sensor) add_subdirectory(display) diff --git a/app/drivers/gpio/Kconfig b/app/drivers/gpio/Kconfig index 336d60b9..e6f8bfb8 100644 --- a/app/drivers/gpio/Kconfig +++ b/app/drivers/gpio/Kconfig @@ -1,2 +1,5 @@ +menuconfig ZMK_DRIVERS_GPIO + bool "GPIO" + rsource "Kconfig.mcp23017" rsource "Kconfig.595" \ No newline at end of file diff --git a/app/drivers/gpio/Kconfig.595 b/app/drivers/gpio/Kconfig.595 index b863adcb..f43e807b 100644 --- a/app/drivers/gpio/Kconfig.595 +++ b/app/drivers/gpio/Kconfig.595 @@ -10,6 +10,7 @@ menuconfig GPIO_595 default $(dt_compat_enabled,$(DT_COMPAT_ZMK_GPIO_595)) depends on SPI select HAS_DTS_GPIO + select ZMK_DRIVERS_GPIO help Enable driver for 595 shift register chip using SPI. diff --git a/app/drivers/gpio/Kconfig.mcp23017 b/app/drivers/gpio/Kconfig.mcp23017 index 4953b924..049ca82e 100644 --- a/app/drivers/gpio/Kconfig.mcp23017 +++ b/app/drivers/gpio/Kconfig.mcp23017 @@ -7,6 +7,7 @@ menuconfig GPIO_MCP23017 bool "MCP23017 I2C-based GPIO chip" depends on I2C select HAS_DTS_GPIO + select ZMK_DRIVERS_GPIO help Enable driver for MCP23017 I2C-based GPIO chip.