From ba9913e029b3f63adc451d90560139968c5892e0 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Thu, 25 Jun 2020 22:28:11 -0700 Subject: [PATCH] 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 {