|
|
|
@ -30,8 +30,8 @@ const byte RIGHT_SX1509_ADDRESS = 0x71; // SX1509 I2C address (11)
|
|
|
|
|
sx1509Class leftsx1509(LEFT_SX1509_ADDRESS);
|
|
|
|
|
sx1509Class rightsx1509(RIGHT_SX1509_ADDRESS);
|
|
|
|
|
|
|
|
|
|
int right_initted = 0;
|
|
|
|
|
int left_initted =0;
|
|
|
|
|
int right_initted = 0;
|
|
|
|
|
int left_initted = 0;
|
|
|
|
|
|
|
|
|
|
#define TS(X) //Serial.print(micros() );Serial.print("\t");Serial.println(X);
|
|
|
|
|
|
|
|
|
@ -77,8 +77,8 @@ void set_keymap(Key keymapEntry, byte matrixStateEntry) {
|
|
|
|
|
|
|
|
|
|
void scan_matrix()
|
|
|
|
|
{
|
|
|
|
|
x=0;
|
|
|
|
|
y=0;
|
|
|
|
|
x = 0;
|
|
|
|
|
y = 0;
|
|
|
|
|
//scan the Keyboard matrix looking for connections
|
|
|
|
|
for (byte row = 0; row < LEFT_ROWS; row++) {
|
|
|
|
|
TS("Scanning row ")
|
|
|
|
@ -101,7 +101,7 @@ void scan_matrix()
|
|
|
|
|
|
|
|
|
|
matrixState[row][col] <<= 1;
|
|
|
|
|
|
|
|
|
|
matrixState[row][(COLS-1)-col] <<= 1;
|
|
|
|
|
matrixState[row][(COLS - 1) - col] <<= 1;
|
|
|
|
|
|
|
|
|
|
TS("Reading left pin")
|
|
|
|
|
if (left_initted && leftsx1509.readPrefetchedPin(left_colpins[col])) {
|
|
|
|
@ -129,8 +129,8 @@ void scan_matrix()
|
|
|
|
|
set_keymap(keymaps[active_keymap][row][(COLS - 1) - col], matrixState[row][(COLS - 1) - col]);
|
|
|
|
|
TS("calling send_key_event")
|
|
|
|
|
send_key_event(row, col);
|
|
|
|
|
if(right_initted)
|
|
|
|
|
send_key_event(row, (COLS-1)-col);
|
|
|
|
|
if (right_initted)
|
|
|
|
|
send_key_event(row, (COLS - 1) - col);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
TS("clearing output pins")
|
|
|
|
@ -392,8 +392,8 @@ void record_key_being_pressed(byte character)
|
|
|
|
|
|
|
|
|
|
void reset_key_report()
|
|
|
|
|
{
|
|
|
|
|
memcpy( charsReportedLastTime,charsBeingReported, KEYS_HELD_BUFFER);
|
|
|
|
|
memset(charsBeingReported,0,KEYS_HELD_BUFFER);
|
|
|
|
|
memcpy( charsReportedLastTime, charsBeingReported, KEYS_HELD_BUFFER);
|
|
|
|
|
memset(charsBeingReported, 0, KEYS_HELD_BUFFER);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -514,8 +514,8 @@ void make_output(sx1509Class sx1509, int pin) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setup_pins() {
|
|
|
|
|
right_initted= setup_sx1509(rightsx1509, right_colpins, right_rowpins);
|
|
|
|
|
left_initted= setup_sx1509(leftsx1509, left_colpins, left_rowpins);
|
|
|
|
|
right_initted = setup_sx1509(rightsx1509, right_colpins, right_rowpins);
|
|
|
|
|
left_initted = setup_sx1509(leftsx1509, left_colpins, left_rowpins);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -523,7 +523,7 @@ void setup_pins() {
|
|
|
|
|
int setup_sx1509 (sx1509Class sx1509, int colpins[], int rowpins[]) {
|
|
|
|
|
byte initted;
|
|
|
|
|
|
|
|
|
|
for(int counter = 0; counter< 10;counter++) {
|
|
|
|
|
for (int counter = 0; counter < 10; counter++) {
|
|
|
|
|
initted = sx1509.init();
|
|
|
|
|
|
|
|
|
|
if (initted)
|
|
|
|
|