keyboard pin swap

This commit is contained in:
flowenol 2019-10-16 22:26:42 +02:00
parent 278ca3f36d
commit 110465f960
2 changed files with 6 additions and 4 deletions

View File

@ -61,7 +61,7 @@ void read_data_from_kbd(kbd_state next_state) {
if (keyboard_state == READ_MODEL_NUMBER) { if (keyboard_state == READ_MODEL_NUMBER) {
model_number = kbd_data_read; model_number = kbd_data_read;
} else if (kbd_data_read != TEST_ACK && kbd_data_read != TEST_NAK) { } else if (kbd_data_read != TEST_ACK && kbd_data_read != TEST_NAK) {
kbd_last_data_read_index = (kbd_last_data_read_index + 1) % 4; kbd_last_data_read_index = (kbd_last_data_read_index + 1) % KBD_BUFFER_SIZE;
kbd_last_data_read[kbd_last_data_read_index] = kbd_data_read; kbd_last_data_read[kbd_last_data_read_index] = kbd_data_read;
} }

View File

@ -1,8 +1,8 @@
#define CLK_MAC 5 #define CLK_MAC 5
#define DATA_MAC 6 #define DATA_MAC 6
#define CLK_KBD 7 #define CLK_KBD 8
#define DATA_KBD 8 #define DATA_KBD 7
#define CLOCK_START_MSEC 500 #define CLOCK_START_MSEC 500
#define CLOCK_TRANSITION_USEC 300 #define CLOCK_TRANSITION_USEC 300
@ -13,6 +13,8 @@
#define MAC_RESP_DELAY_MSEC 240 #define MAC_RESP_DELAY_MSEC 240
#define MAC_DETECT_READY_USEC 300 #define MAC_DETECT_READY_USEC 300
#define KBD_BUFFER_SIZE 4
// command constants // command constants
const byte MODEL_NUMBER_CMD = 0x16; const byte MODEL_NUMBER_CMD = 0x16;
const byte TEST_CMD = 0x36; const byte TEST_CMD = 0x36;
@ -53,7 +55,7 @@ unsigned long kbd_clock_transition_start;
unsigned long kbd_delay_start; unsigned long kbd_delay_start;
byte kbd_data_read; byte kbd_data_read;
byte kbd_last_data_read[4]; byte kbd_last_data_read[KBD_BUFFER_SIZE];
short kbd_last_data_read_index = -1; short kbd_last_data_read_index = -1;
byte model_number; byte model_number;