Merge pull request #6 from keyboardio/f/getKeyswitchStateAtPosition

Migrate to hid::getKeyStateAtPosition
pull/365/head
Jesse Vincent 7 years ago committed by GitHub
commit 004d09420c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -27,9 +27,10 @@ void TestMode_::legacyLoopHook(bool is_post_clear) {
#endif #endif
kaleidoscope::EventHandlerResult TestMode_::beforeReportingState() { kaleidoscope::EventHandlerResult TestMode_::beforeReportingState() {
if (KeyboardHardware.leftHandState.all == TEST_MODE_KEY_COMBO if (KeyboardHardware.isKeyswitchPressed(R0C0) &&
// && KeyboardHardware.rightHandState.all == combo.rightHand KeyboardHardware.isKeyswitchPressed(R0C6) &&
) { KeyboardHardware.isKeyswitchPressed(R3C6) &&
KeyboardHardware.pressedKeyswitchCount() == 3) {
run_tests(); run_tests();
} }
return kaleidoscope::EventHandlerResult::OK; return kaleidoscope::EventHandlerResult::OK;
@ -41,7 +42,8 @@ void TestMode_::waitForKeypress() {
} }
while (1) { while (1) {
KeyboardHardware.readMatrix(); KeyboardHardware.readMatrix();
if (KeyboardHardware.leftHandState.all == R3C6 if (KeyboardHardware.isKeyswitchPressed(R3C6)
&& KeyboardHardware.pressedKeyswitchCount() == 1
&& KeyboardHardware.previousLeftHandState.all == 0) { && KeyboardHardware.previousLeftHandState.all == 0) {
break; break;
} }
@ -127,7 +129,10 @@ void TestMode_::testMatrix() {
// taps during LED test mode. // taps during LED test mode.
while (1) { while (1) {
KeyboardHardware.readMatrix(); KeyboardHardware.readMatrix();
if (KeyboardHardware.leftHandState.all == TEST_MODE_KEY_COMBO) { if (KeyboardHardware.isKeyswitchPressed(R0C0) &&
KeyboardHardware.isKeyswitchPressed(R0C6) &&
KeyboardHardware.isKeyswitchPressed(R3C6) &&
KeyboardHardware.pressedKeyswitchCount() == 3) {
break; break;
} }
for (byte row = 0; row < 4; row++) { for (byte row = 0; row < 4; row++) {

@ -3,10 +3,6 @@
#include <Arduino.h> #include <Arduino.h>
#include "Kaleidoscope.h" #include "Kaleidoscope.h"
#define TEST_MODE_KEY_COMBO (R0C0 | R0C6 | R3C6)
typedef struct { typedef struct {
uint8_t cyclesSinceStateChange[32]; uint8_t cyclesSinceStateChange[32];
uint32_t badKeys; uint32_t badKeys;

Loading…
Cancel
Save