diff options
author | QMK Bot <hello@qmk.fm> | 2022-06-08 21:52:12 +0000 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2022-06-08 21:52:12 +0000 |
commit | 84944df6a635da6502117e5b245113296babb39e (patch) | |
tree | 30876f20542b989162bd42c02c397ec96ffc202b /keyboards/centromere/matrix.c | |
parent | 728f7308afd388a7724d2160da88eb0937abb94b (diff) | |
parent | 6567b2168881ce8c47e38debcdc89eba1ac80c5a (diff) |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'keyboards/centromere/matrix.c')
-rw-r--r-- | keyboards/centromere/matrix.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/keyboards/centromere/matrix.c b/keyboards/centromere/matrix.c index bbd771f41b..0218adf39b 100644 --- a/keyboards/centromere/matrix.c +++ b/keyboards/centromere/matrix.c @@ -20,6 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "matrix.h" #include "uart.h" +#define UART_MATRIX_RESPONSE_TIMEOUT 10000 + void matrix_init_custom(void) { uart_init(500000); } @@ -39,11 +41,16 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { //wait for the serial data, timeout if it's been too long while (!uart_available()) { timeout++; - if (timeout > 10000) { + if (timeout > UART_MATRIX_RESPONSE_TIMEOUT) { break; } } - uart_data[i] = uart_read(); + + if (timeout < UART_MATRIX_RESPONSE_TIMEOUT) { + uart_data[i] = uart_read(); + } else { + uart_data[i] = 0x00; + } } //check for the end packet, the key state bytes use the LSBs, so 0xE0 |