Adapt Kaleidoscope-Hardware-EZ-ErgoDox to KeyEvent handlers

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
pull/1024/head
Michael Richters 4 years ago
parent 3ddd12ea04
commit 352fa3fb70
No known key found for this signature in database
GPG Key ID: 1288FD13E4EEF0C0

@ -27,10 +27,12 @@
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#ifdef ARDUINO_AVR_ERGODOX
#include "kaleidoscope/Runtime.h"
#include <avr/wdt.h>
#include "kaleidoscope/device/ez/ErgoDox/ErgoDoxScanner.h"
#include "kaleidoscope/key_events.h"
#include "kaleidoscope/keyswitch_state.h"
#include "kaleidoscope/KeyEvent.h"
#include "kaleidoscope/Runtime.h"
namespace kaleidoscope {
namespace device {
@ -112,10 +114,12 @@ void __attribute__((optimize(3))) ErgoDox::readMatrix() {
void __attribute__((optimize(3))) ErgoDox::actOnMatrixScan() {
for (byte row = 0; row < matrix_rows; row++) {
for (byte col = 0; col < matrix_columns; col++) {
uint8_t keyState = (bitRead(previousKeyState_[row], col) << 0) |
uint8_t key_state = (bitRead(previousKeyState_[row], col) << 0) |
(bitRead(keyState_[row], col) << 1);
if (keyState)
handleKeyswitchEvent(Key_NoKey, KeyAddr(row, col), keyState);
if (keyToggledOn(key_state) || keyToggledOff(key_state)) {
auto event = KeyEvent::next(KeyAddr(row, col), key_state);
kaleidoscope::Runtime.handleKeyswitchEvent(event);
}
}
previousKeyState_[row] = keyState_[row];
}

Loading…
Cancel
Save