hardware/ErgoDox: Hint at GCC that some functions are critical path

Based on a similar change to `ATMegaKeyboard`.

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

@ -82,7 +82,7 @@ ISR(TIMER1_OVF_vect) {
do_scan_ = true; do_scan_ = true;
} }
void ErgoDox::readMatrixRow(uint8_t row) { void __attribute__((optimize(3))) ErgoDox::readMatrixRow(uint8_t row) {
uint8_t mask, cols; uint8_t mask, cols;
mask = debounceMaskForRow(row); mask = debounceMaskForRow(row);
@ -91,7 +91,7 @@ void ErgoDox::readMatrixRow(uint8_t row) {
keyState_[row] = cols; keyState_[row] = cols;
} }
void ErgoDox::readMatrix() { void __attribute__((optimize(3))) ErgoDox::readMatrix() {
do_scan_ = false; do_scan_ = false;
scanner_.reattachExpanderOnError(); 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 row = 0; row < ROWS; row++) {
for (byte col = 0; col < COLS; col++) { for (byte col = 0; col < COLS; col++) {
uint8_t keyState = (bitRead(previousKeyState_[row], col) << 0) | uint8_t keyState = (bitRead(previousKeyState_[row], col) << 0) |

@ -99,7 +99,7 @@ ErgoDoxScanner::begin() {
initCols(); initCols();
} }
void void __attribute__((optimize(3)))
ErgoDoxScanner::selectRow(int row) { ErgoDoxScanner::selectRow(int row) {
if (row < 7) { if (row < 7) {
if (!expander_error_) { if (!expander_error_) {
@ -149,7 +149,7 @@ out:
} }
} }
void void __attribute__((optimize(3)))
ErgoDoxScanner::unselectRows() { ErgoDoxScanner::unselectRows() {
DDRB &= ~(1 << 0 | 1 << 1 | 1 << 2 | 1 << 3); DDRB &= ~(1 << 0 | 1 << 1 | 1 << 2 | 1 << 3);
PORTB &= ~(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); PORTC &= ~(1 << 6);
} }
uint8_t uint8_t __attribute__((optimize(3)))
ErgoDoxScanner::readCols(int row) { ErgoDoxScanner::readCols(int row) {
if (row < 7) { if (row < 7) {
if (expander_error_) { if (expander_error_) {

Loading…
Cancel
Save