Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/1086/head
Gergely Nagy 3 years ago committed by Jesse Vincent
parent 801ebee116
commit 7fcad59ed5
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -18,6 +18,7 @@
#ifdef ARDUINO_GD32F303ZE_EVAL #ifdef ARDUINO_GD32F303ZE_EVAL
#include "Arduino.h" #include "Arduino.h"
#include "HardwareTimer.h"
#include "kaleidoscope/Runtime.h" #include "kaleidoscope/Runtime.h"
#include "kaleidoscope/device/gd32/eval/KeyScanner.h" #include "kaleidoscope/device/gd32/eval/KeyScanner.h"
@ -36,7 +37,7 @@ const uint8_t KeyScannerProps::matrix_columns;
constexpr uint8_t KeyScannerProps::matrix_row_pins[matrix_rows]; constexpr uint8_t KeyScannerProps::matrix_row_pins[matrix_rows];
constexpr uint8_t KeyScannerProps::matrix_col_pins[matrix_columns]; constexpr uint8_t KeyScannerProps::matrix_col_pins[matrix_columns];
static scan_irq() { static void scan_irq() {
KeyScanner::do_scan = true; KeyScanner::do_scan = true;
} }
@ -139,8 +140,8 @@ bool KeyScanner::isKeyswitchPressed(KeyAddr key_addr) {
uint8_t KeyScanner::pressedKeyswitchCount() { uint8_t KeyScanner::pressedKeyswitchCount() {
uint8_t count = 0; uint8_t count = 0;
for (int8_t c = 0; c < _KeyScannerProps::matrix_columns; c++) { for (int8_t c = 0; c < Props_::matrix_columns; c++) {
count += __builtin_popcount(matrix_state_[r].current); count += __builtin_popcount(matrix_state_[c].current);
} }
return count; return count;
} }
@ -152,8 +153,8 @@ bool KeyScanner::wasKeyswitchPressed(KeyAddr key_addr) {
uint8_t KeyScanner::previousPressedKeyswitchCount() { uint8_t KeyScanner::previousPressedKeyswitchCount() {
uint8_t count = 0; uint8_t count = 0;
for (int8_t c = 0; c < _KeyScannerProps::matrix_columns; c++) { for (int8_t c = 0; c < Props_::matrix_columns; c++) {
count += __builtin_popcount(matrix_state_[r].previous); count += __builtin_popcount(matrix_state_[c].previous);
} }
return count; return count;
} }

Loading…
Cancel
Save