hardware::Atreus: Implement a custom readCols()

Manually unrolling the loop results in code that's 0.3ms faster, at the cost of
a bit of PROGMEM.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/461/head
Gergely Nagy 6 years ago
parent 490faa64ea
commit b5b219a956
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -71,6 +71,23 @@ void Atreus::resetDevice() {
asm volatile("jmp 0x7E00"); asm volatile("jmp 0x7E00");
} }
uint16_t Atreus::readCols() {
uint16_t results = 0;
results |= (!READ_PIN(KeyboardHardware.matrix_col_pins[0]) << 0);
results |= (!READ_PIN(KeyboardHardware.matrix_col_pins[1]) << 1);
results |= (!READ_PIN(KeyboardHardware.matrix_col_pins[2]) << 2);
results |= (!READ_PIN(KeyboardHardware.matrix_col_pins[3]) << 3);
results |= (!READ_PIN(KeyboardHardware.matrix_col_pins[4]) << 4);
results |= (!READ_PIN(KeyboardHardware.matrix_col_pins[5]) << 5);
results |= (!READ_PIN(KeyboardHardware.matrix_col_pins[6]) << 6);
results |= (!READ_PIN(KeyboardHardware.matrix_col_pins[7]) << 7);
results |= (!READ_PIN(KeyboardHardware.matrix_col_pins[8]) << 8);
results |= (!READ_PIN(KeyboardHardware.matrix_col_pins[9]) << 9);
results |= (!READ_PIN(KeyboardHardware.matrix_col_pins[10]) << 10);
return results;
}
} }
} }
} }

@ -38,6 +38,7 @@ namespace kaleidoscope {
namespace hardware { namespace hardware {
namespace technomancy { namespace technomancy {
class Atreus: public kaleidoscope::hardware::ATMegaKeyboard { class Atreus: public kaleidoscope::hardware::ATMegaKeyboard {
friend class ATMegaKeyboard;
public: public:
Atreus(void) {} Atreus(void) {}
@ -49,6 +50,9 @@ class Atreus: public kaleidoscope::hardware::ATMegaKeyboard {
static constexpr int8_t led_count = 0; static constexpr int8_t led_count = 0;
void resetDevice(); void resetDevice();
protected:
uint16_t readCols();
}; };
#define KEYMAP( \ #define KEYMAP( \

Loading…
Cancel
Save