From d0ee924c9d1689845ca067ca1175521824870ba7 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Thu, 17 Oct 2019 17:48:58 +0100 Subject: [PATCH] Move tmk_core/common/backlight to quantum/backlight (#6710) * Move tmk_core/common/backlight to quantum/backlight * Add guards to backlight inclusion * Add guards to backlight inclusion * Update backlight guards on clueboard/60 * Use full paths to avoid vpath issues --- common_features.mk | 8 +++++++- {tmk_core/common => quantum/backlight}/backlight.c | 0 {tmk_core/common => quantum/backlight}/backlight.h | 0 quantum/keymap_common.c | 5 ++++- quantum/quantum.c | 6 ++++-- tmk_core/common.mk | 5 ----- tmk_core/common/action.c | 5 ++++- tmk_core/common/avr/suspend.c | 5 ++++- tmk_core/common/chibios/suspend.c | 5 ++++- tmk_core/common/command.c | 5 ++++- tmk_core/common/keyboard.c | 4 +++- 11 files changed, 34 insertions(+), 14 deletions(-) rename {tmk_core/common => quantum/backlight}/backlight.c (100%) rename {tmk_core/common => quantum/backlight}/backlight.h (100%) diff --git a/common_features.mk b/common_features.mk index 3bc6f1c73bfe..a4af319fc652 100644 --- a/common_features.mk +++ b/common_features.mk @@ -233,7 +233,13 @@ ifeq ($(strip $(BACKLIGHT_ENABLE)), yes) ifeq ($(strip $(VISUALIZER_ENABLE)), yes) CIE1931_CURVE = yes endif - ifeq ($(strip $(BACKLIGHT_CUSTOM_DRIVER)), yes) + + + COMMON_VPATH += $(QUANTUM_DIR)/backlight + SRC += $(QUANTUM_DIR)/backlight/backlight.c + OPT_DEFS += -DBACKLIGHT_ENABLE + + ifeq ($(strip $(BACKLIGHT_ENABLE)), custom) OPT_DEFS += -DBACKLIGHT_CUSTOM_DRIVER endif endif diff --git a/tmk_core/common/backlight.c b/quantum/backlight/backlight.c similarity index 100% rename from tmk_core/common/backlight.c rename to quantum/backlight/backlight.c diff --git a/tmk_core/common/backlight.h b/quantum/backlight/backlight.h similarity index 100% rename from tmk_core/common/backlight.h rename to quantum/backlight/backlight.h diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index 9af9510081e2..4fa45ac37b26 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c @@ -26,9 +26,12 @@ along with this program. If not, see . #include "action.h" #include "action_macro.h" #include "debug.h" -#include "backlight.h" #include "quantum.h" +#ifdef BACKLIGHT_ENABLE +# include "backlight.h" +#endif + #ifdef MIDI_ENABLE # include "process_midi.h" #endif diff --git a/quantum/quantum.c b/quantum/quantum.c index 70b10084021c..4c4cb8d054ed 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -28,8 +28,10 @@ # define BREATHING_PERIOD 6 #endif -#include "backlight.h" -extern backlight_config_t backlight_config; +#ifdef BACKLIGHT_ENABLE +# include "backlight.h" + extern backlight_config_t backlight_config; +#endif #ifdef FAUXCLICKY_ENABLE # include "fauxclicky.h" diff --git a/tmk_core/common.mk b/tmk_core/common.mk index 221688755518..db553534652b 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk @@ -153,11 +153,6 @@ ifeq ($(strip $(NO_SUSPEND_POWER_DOWN)), yes) TMK_COMMON_DEFS += -DNO_SUSPEND_POWER_DOWN endif -ifeq ($(strip $(BACKLIGHT_ENABLE)), yes) - TMK_COMMON_SRC += $(COMMON_DIR)/backlight.c - TMK_COMMON_DEFS += -DBACKLIGHT_ENABLE -endif - ifeq ($(strip $(BLUETOOTH_ENABLE)), yes) TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE TMK_COMMON_DEFS += -DNO_USB_STARTUP_CHECK diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index 44b19d368e8b..bd6aeba4f84e 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c @@ -20,7 +20,6 @@ along with this program. If not, see . #include "mousekey.h" #include "command.h" #include "led.h" -#include "backlight.h" #include "action_layer.h" #include "action_tapping.h" #include "action_macro.h" @@ -28,6 +27,10 @@ along with this program. If not, see . #include "action.h" #include "wait.h" +#ifdef BACKLIGHT_ENABLE +# include "backlight.h" +#endif + #ifdef DEBUG_ACTION # include "debug.h" #else diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c index 574000fcd8f9..c59c19688005 100644 --- a/tmk_core/common/avr/suspend.c +++ b/tmk_core/common/avr/suspend.c @@ -4,7 +4,6 @@ #include #include "matrix.h" #include "action.h" -#include "backlight.h" #include "suspend_avr.h" #include "suspend.h" #include "timer.h" @@ -16,6 +15,10 @@ # include "lufa.h" #endif +#ifdef BACKLIGHT_ENABLE +# include "backlight.h" +#endif + #ifdef AUDIO_ENABLE # include "audio.h" #endif /* AUDIO_ENABLE */ diff --git a/tmk_core/common/chibios/suspend.c b/tmk_core/common/chibios/suspend.c index ae1c6f53e2ec..c0f9c28d443d 100644 --- a/tmk_core/common/chibios/suspend.c +++ b/tmk_core/common/chibios/suspend.c @@ -8,10 +8,13 @@ #include "action_util.h" #include "mousekey.h" #include "host.h" -#include "backlight.h" #include "suspend.h" #include "wait.h" +#ifdef BACKLIGHT_ENABLE +# include "backlight.h" +#endif + /** \brief suspend idle * * FIXME: needs doc diff --git a/tmk_core/common/command.c b/tmk_core/common/command.c index 8bf72ef25820..82cd80609134 100644 --- a/tmk_core/common/command.c +++ b/tmk_core/common/command.c @@ -32,10 +32,13 @@ along with this program. If not, see . #include "sleep_led.h" #include "led.h" #include "command.h" -#include "backlight.h" #include "quantum.h" #include "version.h" +#ifdef BACKLIGHT_ENABLE +# include "backlight.h" +#endif + #ifdef MOUSEKEY_ENABLE # include "mousekey.h" #endif diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index 0e8ba826e6ba..8746b2c12439 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c @@ -29,8 +29,10 @@ along with this program. If not, see . #include "util.h" #include "sendchar.h" #include "eeconfig.h" -#include "backlight.h" #include "action_layer.h" +#ifdef BACKLIGHT_ENABLE +# include "backlight.h" +#endif #ifdef BOOTMAGIC_ENABLE # include "bootmagic.h" #else