From b565dab6444a509bb78e974748d56f1d3330783f Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Tue, 1 May 2018 23:44:32 -0700 Subject: [PATCH] pass by value to save some flash --- src/Kaleidoscope-Model01-TestMode.cpp | 10 +++++----- src/Kaleidoscope-Model01-TestMode.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Kaleidoscope-Model01-TestMode.cpp b/src/Kaleidoscope-Model01-TestMode.cpp index d04425d2..7846fa39 100644 --- a/src/Kaleidoscope-Model01-TestMode.cpp +++ b/src/Kaleidoscope-Model01-TestMode.cpp @@ -75,7 +75,7 @@ void TestMode_::test_leds(void) { -void TestMode_::handleKeyEvent(side_data_t *side, keydata_t oldState, keydata_t newState, uint8_t row, uint8_t col, uint8_t col_offset) { +void TestMode_::handleKeyEvent(side_data_t *side, keydata_t *oldState, keydata_t *newState, uint8_t row, uint8_t col, uint8_t col_offset) { cRGB red = { b: 0, g: 0, r: 201 } ; cRGB blue = { b: 201, g: 0, r: 0 } ; @@ -83,8 +83,8 @@ void TestMode_::handleKeyEvent(side_data_t *side, keydata_t oldState, keydata_t uint8_t keynum = (row * 8) + (col); - uint8_t keyState = ((bitRead(oldState.all, keynum) << 1) | - (bitRead(newState.all, keynum) << 0)); + uint8_t keyState = ((bitRead(oldState->all, keynum) << 1) | + (bitRead(newState->all, keynum) << 0)); if (keyState == TOGGLED_ON) { if (side->cyclesSinceStateChange[keynum] < CHATTER_CYCLE_LIMIT) { bitSet(side->badKeys, keynum); @@ -128,8 +128,8 @@ void TestMode_::testMatrix() { } for (byte row = 0; row < 4; row++) { for (byte col = 0; col < 8; col++) { - handleKeyEvent(&left, KeyboardHardware.previousLeftHandState, KeyboardHardware.leftHandState, row, col, 7); - handleKeyEvent(&right, KeyboardHardware.previousRightHandState, KeyboardHardware.rightHandState, row, col, 15); + handleKeyEvent(&left, &(KeyboardHardware.previousLeftHandState), &(KeyboardHardware.leftHandState), row, col, 7); + handleKeyEvent(&right, &(KeyboardHardware.previousRightHandState), &(KeyboardHardware.rightHandState), row, col, 15); } } LEDControl.syncLeds(); diff --git a/src/Kaleidoscope-Model01-TestMode.h b/src/Kaleidoscope-Model01-TestMode.h index fd95d017..1fa7a1ff 100644 --- a/src/Kaleidoscope-Model01-TestMode.h +++ b/src/Kaleidoscope-Model01-TestMode.h @@ -22,7 +22,7 @@ class TestMode_ : public KaleidoscopePlugin { static void test_leds(); static void testMatrix(); static void toggle_programming_leds_on(); - static void handleKeyEvent(side_data_t *side, keydata_t oldState, keydata_t newState, uint8_t row, uint8_t col, uint8_t col_offset); + static void handleKeyEvent(side_data_t *side, keydata_t *oldState, keydata_t *newState, uint8_t row, uint8_t col, uint8_t col_offset); static void waitForKeypress(); static void loopHook(bool postClear); static void set_leds(cRGB color);