Merge pull request #688 from keyboardio/atmega-fixes

A couple small changes to fix issues with the ATMegaKeyboard abstraction
pull/689/head
Jesse Vincent 5 years ago committed by GitHub
commit f8fa47610b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -80,7 +80,7 @@ bool ATMegaKeyboard::isKeyswitchPressed(KeyAddr key_addr) {
bool ATMegaKeyboard::isKeyswitchPressed(uint8_t keyIndex) { bool ATMegaKeyboard::isKeyswitchPressed(uint8_t keyIndex) {
keyIndex--; keyIndex--;
return isKeyswitchPressed(KeyAddr(keyIndex)); return isKeyswitchPressed(::KeyAddr(keyIndex));
} }
@ -100,7 +100,7 @@ bool ATMegaKeyboard::wasKeyswitchPressed(KeyAddr key_addr) {
bool ATMegaKeyboard::wasKeyswitchPressed(uint8_t keyIndex) { bool ATMegaKeyboard::wasKeyswitchPressed(uint8_t keyIndex) {
keyIndex--; keyIndex--;
return wasKeyswitchPressed(KeyAddr(keyIndex)); return wasKeyswitchPressed(::KeyAddr(keyIndex));
} }
@ -110,8 +110,7 @@ void __attribute__((optimize(3))) ATMegaKeyboard::actOnMatrixScan() {
uint8_t keyState = (bitRead(KeyboardHardware.previousKeyState_[row], col) << 0) | uint8_t keyState = (bitRead(KeyboardHardware.previousKeyState_[row], col) << 0) |
(bitRead(KeyboardHardware.keyState_[row], col) << 1); (bitRead(KeyboardHardware.keyState_[row], col) << 1);
if (keyState) { if (keyState) {
//handleKeyswitchEvent(Key_NoKey, KeyAddr(row, col), keyState); handleKeyswitchEvent(Key_NoKey, ::KeyAddr(row, col), keyState);
handleKeyswitchEvent(Key_NoKey, row, col, keyState);
} }
} }
KeyboardHardware.previousKeyState_[row] = KeyboardHardware.keyState_[row]; KeyboardHardware.previousKeyState_[row] = KeyboardHardware.keyState_[row];

@ -50,6 +50,7 @@ struct cRGB {
static const int8_t matrix_columns = NUM_ARGS(COL_PINS_); \ static const int8_t matrix_columns = NUM_ARGS(COL_PINS_); \
static constexpr uint8_t matrix_row_pins[matrix_rows] = ROW_PINS_; \ static constexpr uint8_t matrix_row_pins[matrix_rows] = ROW_PINS_; \
static constexpr uint8_t matrix_col_pins[matrix_columns] = COL_PINS_; \ static constexpr uint8_t matrix_col_pins[matrix_columns] = COL_PINS_; \
typedef MatrixAddr<NUM_ARGS(ROW_PINS_), NUM_ARGS(COL_PINS_)> KeyAddr; \
\ \
static uint16_t previousKeyState_[matrix_rows]; \ static uint16_t previousKeyState_[matrix_rows]; \
static uint16_t keyState_[matrix_rows]; \ static uint16_t keyState_[matrix_rows]; \

@ -45,7 +45,6 @@ class KBD4x: public kaleidoscope::hardware::ATMegaKeyboard {
static constexpr int8_t led_count = 0; static constexpr int8_t led_count = 0;
typedef MatrixAddr<matrix_rows, matrix_columns> KeyAddr;
static constexpr int8_t numKeys() { static constexpr int8_t numKeys() {
return matrix_columns * matrix_rows; return matrix_columns * matrix_rows;
} }

@ -42,7 +42,6 @@ class Planck: public kaleidoscope::hardware::ATMegaKeyboard {
static constexpr int8_t led_count = 0; static constexpr int8_t led_count = 0;
typedef MatrixAddr<matrix_rows, matrix_columns> KeyAddr;
static constexpr int8_t numKeys() { static constexpr int8_t numKeys() {
return matrix_columns * matrix_rows; return matrix_columns * matrix_rows;
} }

@ -51,7 +51,6 @@ class Splitography: public kaleidoscope::hardware::ATMegaKeyboard {
static constexpr int8_t led_count = 0; static constexpr int8_t led_count = 0;
typedef MatrixAddr<matrix_rows, matrix_columns> KeyAddr;
static constexpr int8_t numKeys() { static constexpr int8_t numKeys() {
return matrix_columns * matrix_rows; return matrix_columns * matrix_rows;
} }

@ -65,7 +65,6 @@ class Atreus: public kaleidoscope::hardware::ATMegaKeyboard {
static constexpr int8_t led_count = 0; static constexpr int8_t led_count = 0;
typedef MatrixAddr<matrix_rows, matrix_columns> KeyAddr;
static constexpr int8_t numKeys() { static constexpr int8_t numKeys() {
return matrix_columns * matrix_rows; return matrix_columns * matrix_rows;
} }

@ -43,7 +43,6 @@ class Atreus2: public kaleidoscope::hardware::ATMegaKeyboard {
) )
static constexpr int8_t led_count = 0; static constexpr int8_t led_count = 0;
typedef MatrixAddr<matrix_rows, matrix_columns> KeyAddr;
static constexpr int8_t numKeys() { static constexpr int8_t numKeys() {
return matrix_columns * matrix_rows; return matrix_columns * matrix_rows;
} }

Loading…
Cancel
Save