|
|
@ -34,55 +34,55 @@ void implementation_led_sync() {
|
|
|
|
LED.sync();
|
|
|
|
LED.sync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void implementation_scan_row(byte row) {
|
|
|
|
void implementation_scan_row(byte row) {
|
|
|
|
if (left_initted) {
|
|
|
|
if (left_initted) {
|
|
|
|
leftsx1509.updatePinState(left_rowpins[row], LOW);
|
|
|
|
leftsx1509.updatePinState(left_rowpins[row], LOW);
|
|
|
|
leftsx1509.sendPinStates();
|
|
|
|
leftsx1509.sendPinStates();
|
|
|
|
leftsx1509.fetchPinStates();
|
|
|
|
leftsx1509.fetchPinStates();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (right_initted) {
|
|
|
|
if (right_initted) {
|
|
|
|
rightsx1509.updatePinState(right_rowpins[row], LOW);
|
|
|
|
rightsx1509.updatePinState(right_rowpins[row], LOW);
|
|
|
|
rightsx1509.sendPinStates();
|
|
|
|
rightsx1509.sendPinStates();
|
|
|
|
rightsx1509.fetchPinStates();
|
|
|
|
rightsx1509.fetchPinStates();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void implementation_finish_scanning_row(byte row) {
|
|
|
|
void implementation_finish_scanning_row(byte row) {
|
|
|
|
if (left_initted)
|
|
|
|
if (left_initted)
|
|
|
|
leftsx1509.updatePinState(left_rowpins[row], HIGH);
|
|
|
|
leftsx1509.updatePinState(left_rowpins[row], HIGH);
|
|
|
|
if (right_initted)
|
|
|
|
if (right_initted)
|
|
|
|
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) {
|
|
|
|
uint8_t 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;
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t implementation_scan_right_col(byte row, byte col, uint8_t state) {
|
|
|
|
uint8_t 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;
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -91,7 +91,7 @@ uint8_t implementation_scan_right_col(byte row, byte col, uint8_t state) {
|
|
|
|
boolean implementation_right_hand_connected(void) {
|
|
|
|
boolean implementation_right_hand_connected(void) {
|
|
|
|
if (right_initted) {
|
|
|
|
if (right_initted) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|