From b33f4b5fc4ca7a6e363cec50af5e35631d97ca7f Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Wed, 21 Nov 2018 07:14:24 +0100 Subject: [PATCH] hardware/ErgoDox: Hint at GCC that some functions are critical path Based on a similar change to `ATMegaKeyboard`. Signed-off-by: Gergely Nagy --- src/kaleidoscope/hardware/ez/ErgoDox.cpp | 6 +++--- src/kaleidoscope/hardware/ez/ErgoDox/ErgoDoxScanner.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/kaleidoscope/hardware/ez/ErgoDox.cpp b/src/kaleidoscope/hardware/ez/ErgoDox.cpp index 088be547..7150ef29 100644 --- a/src/kaleidoscope/hardware/ez/ErgoDox.cpp +++ b/src/kaleidoscope/hardware/ez/ErgoDox.cpp @@ -82,7 +82,7 @@ ISR(TIMER1_OVF_vect) { do_scan_ = true; } -void ErgoDox::readMatrixRow(uint8_t row) { +void __attribute__((optimize(3))) ErgoDox::readMatrixRow(uint8_t row) { uint8_t mask, cols; mask = debounceMaskForRow(row); @@ -91,7 +91,7 @@ void ErgoDox::readMatrixRow(uint8_t row) { keyState_[row] = cols; } -void ErgoDox::readMatrix() { +void __attribute__((optimize(3))) ErgoDox::readMatrix() { do_scan_ = false; scanner_.reattachExpanderOnError(); @@ -107,7 +107,7 @@ void ErgoDox::readMatrix() { } } -void ErgoDox::actOnMatrixScan() { +void __attribute__((optimize(3))) ErgoDox::actOnMatrixScan() { for (byte row = 0; row < ROWS; row++) { for (byte col = 0; col < COLS; col++) { uint8_t keyState = (bitRead(previousKeyState_[row], col) << 0) | diff --git a/src/kaleidoscope/hardware/ez/ErgoDox/ErgoDoxScanner.cpp b/src/kaleidoscope/hardware/ez/ErgoDox/ErgoDoxScanner.cpp index aed1c342..c2042c8f 100644 --- a/src/kaleidoscope/hardware/ez/ErgoDox/ErgoDoxScanner.cpp +++ b/src/kaleidoscope/hardware/ez/ErgoDox/ErgoDoxScanner.cpp @@ -99,7 +99,7 @@ ErgoDoxScanner::begin() { initCols(); } -void +void __attribute__((optimize(3))) ErgoDoxScanner::selectRow(int row) { if (row < 7) { if (!expander_error_) { @@ -149,7 +149,7 @@ out: } } -void +void __attribute__((optimize(3))) ErgoDoxScanner::unselectRows() { DDRB &= ~(1 << 0 | 1 << 1 | 1 << 2 | 1 << 3); PORTB &= ~(1 << 0 | 1 << 1 | 1 << 2 | 1 << 3); @@ -159,7 +159,7 @@ ErgoDoxScanner::unselectRows() { PORTC &= ~(1 << 6); } -uint8_t +uint8_t __attribute__((optimize(3))) ErgoDoxScanner::readCols(int row) { if (row < 7) { if (expander_error_) {