From 2cd9d22ee3088a2ab6520a2da1f612f3528c852b Mon Sep 17 00:00:00 2001 From: Florian Fleissner Date: Thu, 4 Apr 2019 12:24:30 +0200 Subject: [PATCH] Added KeyAddr and numKeys() to all hardware classes Signed-off-by: Florian Fleissner --- src/kaleidoscope/Hardware.h | 2 ++ src/kaleidoscope/hardware/ez/ErgoDox.h | 5 +++++ src/kaleidoscope/hardware/kbdfans/KBD4x.h | 5 +++++ src/kaleidoscope/hardware/keyboardio/Model01.h | 5 +++++ src/kaleidoscope/hardware/olkb/Planck.h | 5 +++++ src/kaleidoscope/hardware/softhruf/Splitography.h | 5 +++++ src/kaleidoscope/hardware/technomancy/Atreus.h | 5 +++++ src/kaleidoscope/hardware/technomancy/Atreus2.h | 5 +++++ 8 files changed, 37 insertions(+) diff --git a/src/kaleidoscope/Hardware.h b/src/kaleidoscope/Hardware.h index 0f275f0d..00d45cb0 100644 --- a/src/kaleidoscope/Hardware.h +++ b/src/kaleidoscope/Hardware.h @@ -21,6 +21,8 @@ #pragma once +#include "kaleidoscope/MatrixAddr.h" + #ifndef CRGB #error cRGB and CRGB *must* be defined before including this header! #endif diff --git a/src/kaleidoscope/hardware/ez/ErgoDox.h b/src/kaleidoscope/hardware/ez/ErgoDox.h index 1b148406..b534a8c2 100644 --- a/src/kaleidoscope/hardware/ez/ErgoDox.h +++ b/src/kaleidoscope/hardware/ez/ErgoDox.h @@ -56,6 +56,11 @@ class ErgoDox : public kaleidoscope::Hardware { static constexpr byte matrix_rows = 14; static constexpr int8_t led_count = 0; + typedef MatrixAddr KeyAddr; + static constexpr int8_t numKeys() { + return matrix_columns * matrix_rows; + } + void scanMatrix(void); void readMatrix(void); void actOnMatrixScan(void); diff --git a/src/kaleidoscope/hardware/kbdfans/KBD4x.h b/src/kaleidoscope/hardware/kbdfans/KBD4x.h index dd9d898f..b1c4a13c 100644 --- a/src/kaleidoscope/hardware/kbdfans/KBD4x.h +++ b/src/kaleidoscope/hardware/kbdfans/KBD4x.h @@ -45,6 +45,11 @@ class KBD4x: public kaleidoscope::hardware::ATMegaKeyboard { static constexpr int8_t led_count = 0; + typedef MatrixAddr KeyAddr; + static constexpr int8_t numKeys() { + return matrix_columns * matrix_rows; + } + void resetDevice(); }; diff --git a/src/kaleidoscope/hardware/keyboardio/Model01.h b/src/kaleidoscope/hardware/keyboardio/Model01.h index 17cfe499..cc089b65 100644 --- a/src/kaleidoscope/hardware/keyboardio/Model01.h +++ b/src/kaleidoscope/hardware/keyboardio/Model01.h @@ -43,6 +43,11 @@ class Model01 : public kaleidoscope::Hardware { static constexpr byte matrix_columns = 16; static constexpr int8_t led_count = 64; + typedef MatrixAddr KeyAddr; + static constexpr int8_t numKeys() { + return matrix_columns * matrix_rows; + } + void syncLeds(void); void setCrgbAt(byte row, byte col, cRGB color); void setCrgbAt(int8_t i, cRGB crgb); diff --git a/src/kaleidoscope/hardware/olkb/Planck.h b/src/kaleidoscope/hardware/olkb/Planck.h index d1d38d72..47540244 100644 --- a/src/kaleidoscope/hardware/olkb/Planck.h +++ b/src/kaleidoscope/hardware/olkb/Planck.h @@ -41,6 +41,11 @@ class Planck: public kaleidoscope::hardware::ATMegaKeyboard { ); static constexpr int8_t led_count = 0; + + typedef MatrixAddr KeyAddr; + static constexpr int8_t numKeys() { + return matrix_columns * matrix_rows; + } }; #define PER_KEY_DATA(dflt, \ diff --git a/src/kaleidoscope/hardware/softhruf/Splitography.h b/src/kaleidoscope/hardware/softhruf/Splitography.h index 3eb313c9..1078a8a3 100644 --- a/src/kaleidoscope/hardware/softhruf/Splitography.h +++ b/src/kaleidoscope/hardware/softhruf/Splitography.h @@ -50,6 +50,11 @@ class Splitography: public kaleidoscope::hardware::ATMegaKeyboard { ); static constexpr int8_t led_count = 0; + + typedef MatrixAddr KeyAddr; + static constexpr int8_t numKeys() { + return matrix_columns * matrix_rows; + } }; #define PER_KEY_DATA(dflt, \ diff --git a/src/kaleidoscope/hardware/technomancy/Atreus.h b/src/kaleidoscope/hardware/technomancy/Atreus.h index 8ecd21c7..4e5fb477 100644 --- a/src/kaleidoscope/hardware/technomancy/Atreus.h +++ b/src/kaleidoscope/hardware/technomancy/Atreus.h @@ -65,6 +65,11 @@ class Atreus: public kaleidoscope::hardware::ATMegaKeyboard { static constexpr int8_t led_count = 0; + typedef MatrixAddr KeyAddr; + static constexpr int8_t numKeys() { + return matrix_columns * matrix_rows; + } + void resetDevice(); protected: diff --git a/src/kaleidoscope/hardware/technomancy/Atreus2.h b/src/kaleidoscope/hardware/technomancy/Atreus2.h index 524bef82..170a7d61 100644 --- a/src/kaleidoscope/hardware/technomancy/Atreus2.h +++ b/src/kaleidoscope/hardware/technomancy/Atreus2.h @@ -43,6 +43,11 @@ class Atreus2: public kaleidoscope::hardware::ATMegaKeyboard { ) static constexpr int8_t led_count = 0; + typedef MatrixAddr KeyAddr; + static constexpr int8_t numKeys() { + return matrix_columns * matrix_rows; + } + void resetDevice(); protected: