Broken initial implementation of passing the previous key matrix state by reference

pull/18/head
Jesse Vincent 9 years ago
parent 73caeff437
commit 52b8d216cc

@ -54,35 +54,33 @@ void implementation_finish_scanning_row(byte row) {
rightsx1509.updatePinState(right_rowpins[row], HIGH); rightsx1509.updatePinState(right_rowpins[row], HIGH);
} }
uint8_t implementation_scan_left_col(byte row, byte col,uint8_t state) { void implementation_scan_left_col(byte row, byte col,uint8_t *state) {
//If we see an electrical connection on I->J, //If we see an electrical connection on I->J,
state <<= 1; *state <<= 1;
if (left_initted && leftsx1509.readPrefetchedPin(left_colpins[col])) { if (left_initted && leftsx1509.readPrefetchedPin(left_colpins[col])) {
state |= 0; *state |= 0;
} else { } else {
state |= 1; *state |= 1;
} }
return state;
} }
uint8_t implementation_scan_right_col(byte row, byte col, uint8_t state) { void implementation_scan_right_col(byte row, byte col, uint8_t *state) {
//If we see an electrical connection on I->J, //If we see an electrical connection on I->J,
state <<= 1; *state <<= 1;
if (right_initted && rightsx1509.readPrefetchedPin(right_colpins[col])) { if (right_initted && rightsx1509.readPrefetchedPin(right_colpins[col])) {
state |= 0; *state |= 0;
} else { } else {
state |= 1; *state |= 1;
} }
return state;
} }

@ -29,8 +29,8 @@ static uint8_t right_rowpins[]= {8,9,10,11};
void implementation_scan_row(byte row); void implementation_scan_row(byte row);
void implementation_finish_scanning_row(byte row); void implementation_finish_scanning_row(byte row);
uint8_t implementation_scan_right_col(byte row, byte col, uint8_t state); void implementation_scan_right_col(byte row, byte col, uint8_t *state);
uint8_t implementation_scan_left_col(byte row, byte col, uint8_t state); void implementation_scan_left_col(byte row, byte col, uint8_t *state);
void implementation_pins_setup(); void implementation_pins_setup();
void make_input(sx1509Class sx1509, uint8_t pin) ; void make_input(sx1509Class sx1509, uint8_t pin) ;
void make_output(sx1509Class sx1509, uint8_t pin) ; void make_output(sx1509Class sx1509, uint8_t pin) ;

@ -17,8 +17,8 @@ void scan_matrix() {
implementation_scan_row(row); implementation_scan_row(row);
for (byte col = 0; col < LEFT_COLS; col++) { for (byte col = 0; col < LEFT_COLS; col++) {
matrixState[row][col] = implementation_scan_left_col(row,col,matrixState[row][col]); implementation_scan_left_col(row,col,&matrixState[row][col]);
matrixState[row][(COLS - 1) - col] = implementation_scan_right_col(row,col,matrixState[row][(COLS - 1) - col]); implementation_scan_right_col(row,col,&matrixState[row][(COLS - 1) - col]);
handle_key_event(row, col); handle_key_event(row, col);

Loading…
Cancel
Save