Merge pull request #22 from keyboardio/f/actOnMatrixScan/further-tweaks

Further actOnMatrixScan optimizations
pull/365/head
Gergely Nagy 7 years ago committed by GitHub
commit 766c61ec96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -164,24 +164,22 @@ void Model01::actOnHalfRow(byte row, byte colState, byte colPrevState, byte star
}
} else {
for (byte col = 0; col < 8; col++) {
uint8_t keyState = (bitRead(colPrevState, col) << 0) |
(bitRead(colState, col) << 1);
// Build up the key state for row, col
uint8_t keyState = ((bitRead(colPrevState, 0) << 0) |
(bitRead(colState, 0) << 1));
handleKeyswitchEvent(Key_NoKey, row, startPos - col, keyState);
// Throw away the data we've just used, so we can read the next column
colState = colState >> 1;
colPrevState = colPrevState >> 1;
}
}
}
void Model01::actOnMatrixScan() {
for (byte row = 0; row < 4; row++) {
uint8_t colState = leftHandState.rows[row];
uint8_t colPrevState = previousLeftHandState.rows[row];
actOnHalfRow(row, colState, colPrevState, 7);
colState = rightHandState.rows[row];
colPrevState = previousRightHandState.rows[row];
actOnHalfRow(row, colState, colPrevState, 15);
actOnHalfRow(row, leftHandState.rows[row], previousLeftHandState.rows[row], 7);
actOnHalfRow(row, rightHandState.rows[row], previousRightHandState.rows[row], 15);
}
}

Loading…
Cancel
Save