gd32: Restore some functionality

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

@ -117,6 +117,32 @@ void KeyScanner::actOnMatrixScan() {
}
}
bool KeyScanner::isKeyswitchPressed(KeyAddr key_addr) {
return (bitRead(matrix_state_[key_addr.col()].current, key_addr.row()) != 0);
}
uint8_t KeyScanner::pressedKeyswitchCount() {
uint8_t count = 0;
for (int8_t c = 0; c < _KeyScannerProps::matrix_columns; c++) {
count += __builtin_popcount(matrix_state_[r].current);
}
return count;
}
bool KeyScanner::wasKeyswitchPressed(KeyAddr key_addr) {
return (bitRead(matrix_state_[key_addr.col()].previous, key_addr.row()) != 0);
}
uint8_t KeyScanner::previousPressedKeyswitchCount() {
uint8_t count = 0;
for (int8_t c = 0; c < _KeyScannerProps::matrix_columns; c++) {
count += __builtin_popcount(matrix_state_[r].previous);
}
return count;
}
} // namespace eval
} // namespace gd32
} // namespace device

@ -48,23 +48,11 @@ class KeyScanner: public kaleidoscope::driver::keyscanner::Base<KeyScannerProps>
static void readMatrix();
static void actOnMatrixScan();
static bool isKeyswitchPressed(KeyAddr key_addr) {
//return bitRead(keyState, key_addr.col());
return false;
}
static uint8_t pressedKeyswitchCount() {
//return __builtin_popcount(keyState);
return 0;
}
static bool wasKeyswitchPressed(KeyAddr key_addr) {
//return bitRead(previousKeyState, key_addr.col());
return false;
}
static uint8_t previousPressedKeyswitchCount() {
//return __builtin_popcount(previousKeyState);
return 0;
}
static bool isKeyswitchPressed(KeyAddr key_addr);
static uint8_t pressedKeyswitchCount();
static bool wasKeyswitchPressed(KeyAddr key_addr);
static uint8_t previousPressedKeyswitchCount();
private:
/*
each of these variables are storing the state for a row of keys

Loading…
Cancel
Save