From a5081b1b38984e27e1a6c8231741cc6847363bbe Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Thu, 25 Jun 2020 22:18:09 -0700 Subject: [PATCH 1/2] Remove KEYSCANNER_PROPS_BOILERPLATE macro, which was only used in one place right now --- src/kaleidoscope/driver/keyscanner/ATmega.h | 3 ++- src/kaleidoscope/driver/keyscanner/Base.h | 5 ----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/kaleidoscope/driver/keyscanner/ATmega.h b/src/kaleidoscope/driver/keyscanner/ATmega.h index 75d4a1d7..9b0b3897 100644 --- a/src/kaleidoscope/driver/keyscanner/ATmega.h +++ b/src/kaleidoscope/driver/keyscanner/ATmega.h @@ -43,7 +43,8 @@ #endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD #define ATMEGA_KEYSCANNER_BOILERPLATE \ - KEYSCANNER_PROPS_BOILERPLATE(kaleidoscope::Device::KeyScannerProps); \ + const uint8_t kaleidoscope::Device::KeyScannerProps::matrix_rows; \ + const uint8_t kaleidoscope::Device::KeyScannerProps::matrix_columns; \ constexpr uint8_t kaleidoscope::Device::KeyScannerProps::matrix_row_pins[matrix_rows]; \ constexpr uint8_t kaleidoscope::Device::KeyScannerProps::matrix_col_pins[matrix_columns]; \ template<> \ diff --git a/src/kaleidoscope/driver/keyscanner/Base.h b/src/kaleidoscope/driver/keyscanner/Base.h index f9094ffb..08acce17 100644 --- a/src/kaleidoscope/driver/keyscanner/Base.h +++ b/src/kaleidoscope/driver/keyscanner/Base.h @@ -27,10 +27,6 @@ static constexpr uint8_t matrix_columns = COLS_; \ typedef MatrixAddr KeyAddr; -#define KEYSCANNER_PROPS_BOILERPLATE(BOARD) \ - const uint8_t BOARD::matrix_rows; \ - const uint8_t BOARD::matrix_columns; - namespace kaleidoscope { namespace driver { namespace keyscanner { @@ -38,7 +34,6 @@ namespace keyscanner { struct BaseProps { static constexpr uint8_t matrix_rows = 0; static constexpr uint8_t matrix_columns = 0; - typedef MatrixAddr KeyAddr; }; From ba9913e029b3f63adc451d90560139968c5892e0 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Thu, 25 Jun 2020 22:28:11 -0700 Subject: [PATCH 2/2] remove KEYSCANNER_PROPS macro --- src/kaleidoscope/device/dygma/Raise.h | 5 ++++- src/kaleidoscope/device/ez/ErgoDox.h | 5 ++++- src/kaleidoscope/device/keyboardio/Model01.h | 4 +++- src/kaleidoscope/driver/keyscanner/ATmega.h | 9 +++++++-- src/kaleidoscope/driver/keyscanner/Base.h | 5 ----- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/kaleidoscope/device/dygma/Raise.h b/src/kaleidoscope/device/dygma/Raise.h index 921da20e..1240ecaf 100644 --- a/src/kaleidoscope/device/dygma/Raise.h +++ b/src/kaleidoscope/device/dygma/Raise.h @@ -111,7 +111,10 @@ class RaiseLEDDriver : public kaleidoscope::driver::led::Base KeyAddr; + static constexpr uint8_t left_columns = 8; static constexpr uint8_t right_columns = matrix_columns - left_columns; }; diff --git a/src/kaleidoscope/device/ez/ErgoDox.h b/src/kaleidoscope/device/ez/ErgoDox.h index c3cd1da6..cb9e34c7 100644 --- a/src/kaleidoscope/device/ez/ErgoDox.h +++ b/src/kaleidoscope/device/ez/ErgoDox.h @@ -48,7 +48,10 @@ namespace ez { struct ErgoDoxProps : public kaleidoscope::device::ATmega32U4KeyboardProps { struct KeyScannerProps : kaleidoscope::driver::keyscanner::BaseProps { - KEYSCANNER_PROPS(14, 6); + static constexpr uint8_t matrix_rows = 14; + static constexpr uint8_t matrix_columns = 6; + typedef MatrixAddr KeyAddr; + }; typedef kaleidoscope::driver::bootloader::avr::HalfKay Bootloader; static constexpr const char *short_name = "ErgoDox-EZ"; diff --git a/src/kaleidoscope/device/keyboardio/Model01.h b/src/kaleidoscope/device/keyboardio/Model01.h index ab267273..0fcf0739 100644 --- a/src/kaleidoscope/device/keyboardio/Model01.h +++ b/src/kaleidoscope/device/keyboardio/Model01.h @@ -73,7 +73,9 @@ class Model01LEDDriver; #endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD struct Model01KeyScannerProps : public kaleidoscope::driver::keyscanner::BaseProps { - KEYSCANNER_PROPS(4, 16); + static constexpr uint8_t matrix_rows = 4; + static constexpr uint8_t matrix_columns = 16; + typedef MatrixAddr KeyAddr; }; #ifndef KALEIDOSCOPE_VIRTUAL_BUILD diff --git a/src/kaleidoscope/driver/keyscanner/ATmega.h b/src/kaleidoscope/driver/keyscanner/ATmega.h index 9b0b3897..b2b7b69b 100644 --- a/src/kaleidoscope/driver/keyscanner/ATmega.h +++ b/src/kaleidoscope/driver/keyscanner/ATmega.h @@ -34,12 +34,17 @@ #ifndef KALEIDOSCOPE_VIRTUAL_BUILD #define ATMEGA_KEYSCANNER_PROPS(ROW_PINS_, COL_PINS_) \ - KEYSCANNER_PROPS(NUM_ARGS(ROW_PINS_), NUM_ARGS(COL_PINS_)); \ + static constexpr uint8_t matrix_rows = NUM_ARGS(ROW_PINS_); \ + static constexpr uint8_t matrix_columns = NUM_ARGS(COL_PINS_); \ + typedef MatrixAddr KeyAddr; \ + \ static constexpr uint8_t matrix_row_pins[matrix_rows] = ROW_PINS_; \ static constexpr uint8_t matrix_col_pins[matrix_columns] = COL_PINS_; #else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD #define ATMEGA_KEYSCANNER_PROPS(ROW_PINS_, COL_PINS_) \ - KEYSCANNER_PROPS(NUM_ARGS(ROW_PINS_), NUM_ARGS(COL_PINS_)); + static constexpr uint8_t matrix_rows = NUM_ARGS(ROW_PINS_); \ + static constexpr uint8_t matrix_columns = NUM_ARGS(COL_PINS_); \ + typedef MatrixAddr KeyAddr; #endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD #define ATMEGA_KEYSCANNER_BOILERPLATE \ diff --git a/src/kaleidoscope/driver/keyscanner/Base.h b/src/kaleidoscope/driver/keyscanner/Base.h index 08acce17..19db148c 100644 --- a/src/kaleidoscope/driver/keyscanner/Base.h +++ b/src/kaleidoscope/driver/keyscanner/Base.h @@ -22,11 +22,6 @@ #include "kaleidoscope/key_defs.h" #include "kaleidoscope/MatrixAddr.h" -#define KEYSCANNER_PROPS(ROWS_, COLS_) \ - static constexpr uint8_t matrix_rows = ROWS_; \ - static constexpr uint8_t matrix_columns = COLS_; \ - typedef MatrixAddr KeyAddr; - namespace kaleidoscope { namespace driver { namespace keyscanner {