diff options
| author | Louis Burda <quent.burda@gmail.com> | 2022-12-16 20:31:06 +0100 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2022-12-16 20:31:06 +0100 |
| commit | 8e8c972cbec56d8de31847981149cde4a8fc16cd (patch) | |
| tree | 3f81fbb17a9e8338bf9b70f3e2059da50aebceca /src/split.c | |
| parent | cbb0ac4dac395ea287cf5e7cc211f81aef16e78f (diff) | |
| download | sxkbd-8e8c972cbec56d8de31847981149cde4a8fc16cd.tar.gz sxkbd-8e8c972cbec56d8de31847981149cde4a8fc16cd.zip | |
Add stdio command interface, matrix syncing and basic evaluation
Diffstat (limited to 'src/split.c')
| -rw-r--r-- | src/split.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/split.c b/src/split.c index c275cc9..c9daf7c 100644 --- a/src/split.c +++ b/src/split.c @@ -26,12 +26,6 @@ #define UART_TIMEOUT 20 #define UART_BAUD 9600 -#define LEFT 0 -#define RIGHT 1 - -#define SLAVE 0 -#define MASTER 1 - #if SPLIT_SIDE == LEFT #define UART_TX_PIN 0 #define UART_RX_PIN 1 @@ -68,6 +62,7 @@ static uint uart_tx_sm_offset; static uint uart_rx_sm; static uint uart_rx_sm_offset; +static uint32_t halfmat; static bool scan_pending = false; void @@ -237,6 +232,8 @@ handle_cmd(uint8_t cmd) WARN("Got SCAN_MATRIX_RESP as slave"); break; } + if (uart_recv((uint8_t *) &halfmat, 4) != 4) + WARN("Incomplete matrix received"); scan_pending = false; return; case CMD_STDIO_PUTS: @@ -295,6 +292,7 @@ split_task(void) WARN("Slave matrix scan timeout"); } else { DEBUG("Slave matrix scan success"); + matrix_decode_half(SPLIT_OPP(SPLIT_SIDE), halfmat); } scan_pending = false; } else { @@ -309,6 +307,8 @@ split_task(void) cmd = CMD_SCAN_MATRIX_RESP; DEBUG("Sending SCAN_MATRIX_RESP %i", cmd); ASSERT(uart_send(&cmd, 1) == 1); + halfmat = matrix_encode_half(SPLIT_SIDE); + ASSERT(uart_send((uint8_t *) &halfmat, 4) == 4); scan_pending = false; } } |
