From 838e93b0f752a123168f123641cb1069119c970e Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Tue, 5 Nov 2019 12:37:08 +0100 Subject: [PATCH] Simplify how key indexes are declared Instead of having to include `device/key_indexes.h` from every single hardware plugin, include it from `Kaleidoscope.h` instead. This also allows us to get rid of the redundant `KeyAddr` typedef, by including `kaleidoscope/KeyAddr.h` from `key_indexes.h` instead. Signed-off-by: Gergely Nagy --- src/kaleidoscope/Kaleidoscope.h | 1 + src/kaleidoscope/device/ez/ErgoDox.h | 2 -- src/kaleidoscope/device/kbdfans/KBD4x.h | 2 -- src/kaleidoscope/device/key_indexes.h | 2 +- src/kaleidoscope/device/keyboardio/Model01.h | 2 -- src/kaleidoscope/device/olkb/Planck.h | 2 -- src/kaleidoscope/device/softhruf/Splitography.h | 2 -- src/kaleidoscope/device/technomancy/Atreus.h | 2 -- src/kaleidoscope/device/technomancy/Atreus2.h | 2 -- 9 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/kaleidoscope/Kaleidoscope.h b/src/kaleidoscope/Kaleidoscope.h index a43eb4fe..f383f158 100644 --- a/src/kaleidoscope/Kaleidoscope.h +++ b/src/kaleidoscope/Kaleidoscope.h @@ -37,6 +37,7 @@ void setup(); #include #include KALEIDOSCOPE_HARDWARE_H +#include "kaleidoscope/device/key_indexes.h" extern HARDWARE_IMPLEMENTATION KeyboardHardware; diff --git a/src/kaleidoscope/device/ez/ErgoDox.h b/src/kaleidoscope/device/ez/ErgoDox.h index e6ebf3e5..7994cee3 100644 --- a/src/kaleidoscope/device/ez/ErgoDox.h +++ b/src/kaleidoscope/device/ez/ErgoDox.h @@ -156,8 +156,6 @@ class ErgoDox : public kaleidoscope::Hardware { } } -#include "kaleidoscope/device/key_indexes.h" - extern kaleidoscope::device::ez::ErgoDox &ErgoDox; #endif diff --git a/src/kaleidoscope/device/kbdfans/KBD4x.h b/src/kaleidoscope/device/kbdfans/KBD4x.h index 722e13a7..569d1107 100644 --- a/src/kaleidoscope/device/kbdfans/KBD4x.h +++ b/src/kaleidoscope/device/kbdfans/KBD4x.h @@ -67,8 +67,6 @@ class KBD4x: public kaleidoscope::device::ATMegaKeyboard { } } -#include "kaleidoscope/device/key_indexes.h" - extern kaleidoscope::device::kbdfans::KBD4x &KBD4x; #endif diff --git a/src/kaleidoscope/device/key_indexes.h b/src/kaleidoscope/device/key_indexes.h index e000c44c..d13f2d32 100644 --- a/src/kaleidoscope/device/key_indexes.h +++ b/src/kaleidoscope/device/key_indexes.h @@ -17,7 +17,7 @@ #pragma once -typedef HARDWARE_IMPLEMENTATION::KeyAddr KeyAddr; +#include "kaleidoscope/KeyAddr.h" /* To be used by the hardware implementations, `keyIndex` tells us the index of * a key, from which we can figure out the row and column as needed. The index diff --git a/src/kaleidoscope/device/keyboardio/Model01.h b/src/kaleidoscope/device/keyboardio/Model01.h index 47654935..d55ed79b 100644 --- a/src/kaleidoscope/device/keyboardio/Model01.h +++ b/src/kaleidoscope/device/keyboardio/Model01.h @@ -125,8 +125,6 @@ class Model01 : public kaleidoscope::Hardware { } } -#include "kaleidoscope/device/key_indexes.h" - #define PER_KEY_DATA_STACKED(dflt, \ r0c0, r0c1, r0c2, r0c3, r0c4, r0c5, r0c6, \ r1c0, r1c1, r1c2, r1c3, r1c4, r1c5, r1c6, \ diff --git a/src/kaleidoscope/device/olkb/Planck.h b/src/kaleidoscope/device/olkb/Planck.h index ea9693fe..4a051de8 100644 --- a/src/kaleidoscope/device/olkb/Planck.h +++ b/src/kaleidoscope/device/olkb/Planck.h @@ -63,8 +63,6 @@ class Planck: public kaleidoscope::device::ATMegaKeyboard { } } -#include "kaleidoscope/device/key_indexes.h" - extern kaleidoscope::device::olkb::Planck &Planck; #endif diff --git a/src/kaleidoscope/device/softhruf/Splitography.h b/src/kaleidoscope/device/softhruf/Splitography.h index 02bd05e0..d31de004 100644 --- a/src/kaleidoscope/device/softhruf/Splitography.h +++ b/src/kaleidoscope/device/softhruf/Splitography.h @@ -88,8 +88,6 @@ class Splitography: public kaleidoscope::device::ATMegaKeyboard { } } -#include "kaleidoscope/device/key_indexes.h" - extern kaleidoscope::device::softhruf::Splitography &Splitography; #endif diff --git a/src/kaleidoscope/device/technomancy/Atreus.h b/src/kaleidoscope/device/technomancy/Atreus.h index 7b3be9ec..b97f5f4b 100644 --- a/src/kaleidoscope/device/technomancy/Atreus.h +++ b/src/kaleidoscope/device/technomancy/Atreus.h @@ -105,8 +105,6 @@ class Atreus: public kaleidoscope::device::ATMegaKeyboard { } } -#include "kaleidoscope/device/key_indexes.h" - extern kaleidoscope::device::technomancy::Atreus &Atreus; #endif diff --git a/src/kaleidoscope/device/technomancy/Atreus2.h b/src/kaleidoscope/device/technomancy/Atreus2.h index 8c23fc37..d3fbc072 100644 --- a/src/kaleidoscope/device/technomancy/Atreus2.h +++ b/src/kaleidoscope/device/technomancy/Atreus2.h @@ -82,8 +82,6 @@ class Atreus2: public kaleidoscope::device::ATMegaKeyboard { } } -#include "kaleidoscope/device/key_indexes.h" - extern kaleidoscope::device::technomancy::Atreus2 &Atreus2; #endif