From 0cce6ed0a82f18bfd145b752b0f4c51fa5415fca Mon Sep 17 00:00:00 2001 From: Florian Fleissner Date: Wed, 20 Nov 2019 15:35:09 +0100 Subject: [PATCH] Introduced a build type selection header Up to now, the device header was included by several files via the command This commit introduces a build type selection header kaleidoscope/device/device.h that enables to either directly include the device header or to first include the 'physical' device header and then the 'virtual' device header. This is meant for the virtual device to be able to be defined depending on the properties of the physical device. Signed-off-by: Florian Fleissner --- src/kaleidoscope/Kaleidoscope.h | 2 +- src/kaleidoscope/KeyAddr.h | 2 +- src/kaleidoscope/device/device.h | 23 +++++++++++++++++++++++ src/kaleidoscope/key_events.h | 2 +- src/kaleidoscope/layers.h | 2 +- 5 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 src/kaleidoscope/device/device.h diff --git a/src/kaleidoscope/Kaleidoscope.h b/src/kaleidoscope/Kaleidoscope.h index 4237c65e..b588cdd5 100644 --- a/src/kaleidoscope/Kaleidoscope.h +++ b/src/kaleidoscope/Kaleidoscope.h @@ -36,7 +36,7 @@ void setup(); #include #include -#include KALEIDOSCOPE_HARDWARE_H +#include "kaleidoscope/device/device.h" #include "kaleidoscope/device/key_indexes.h" #include "kaleidoscope_internal/device.h" #include "kaleidoscope_internal/deprecations.h" diff --git a/src/kaleidoscope/KeyAddr.h b/src/kaleidoscope/KeyAddr.h index 3762b0b5..c27c930c 100644 --- a/src/kaleidoscope/KeyAddr.h +++ b/src/kaleidoscope/KeyAddr.h @@ -16,6 +16,6 @@ #pragma once -#include KALEIDOSCOPE_HARDWARE_H +#include "kaleidoscope/device/device.h" typedef kaleidoscope::Device::KeyAddr KeyAddr; diff --git a/src/kaleidoscope/device/device.h b/src/kaleidoscope/device/device.h new file mode 100644 index 00000000..ed16ea93 --- /dev/null +++ b/src/kaleidoscope/device/device.h @@ -0,0 +1,23 @@ +/* Kaleidoscope - Firmware for computer input devices + * Copyright (C) 2013-2019 Keyboard.io, Inc. + * + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#pragma once + +#ifdef KALEIDOSCOPE_VIRTUAL_BUILD +#include "kaleidoscope/device/virtual/Virtual.h" +#else +#include KALEIDOSCOPE_HARDWARE_H +#endif diff --git a/src/kaleidoscope/key_events.h b/src/kaleidoscope/key_events.h index 84945703..6de6becd 100644 --- a/src/kaleidoscope/key_events.h +++ b/src/kaleidoscope/key_events.h @@ -17,7 +17,7 @@ #pragma once #include -#include KALEIDOSCOPE_HARDWARE_H +#include "kaleidoscope/device/device.h" #include "kaleidoscope/key_defs.h" #include "kaleidoscope/keyswitch_state.h" diff --git a/src/kaleidoscope/layers.h b/src/kaleidoscope/layers.h index 5a94d7c6..0cf7d196 100644 --- a/src/kaleidoscope/layers.h +++ b/src/kaleidoscope/layers.h @@ -19,7 +19,7 @@ #include #include "kaleidoscope/key_defs.h" #include "kaleidoscope/keymaps.h" -#include KALEIDOSCOPE_HARDWARE_H +#include "kaleidoscope/device/device.h" #include "kaleidoscope_internal/device.h" // Macro for defining the keymap. This should be used in the sketch