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 | |
parent | 728f7308afd388a7724d2160da88eb0937abb94b (diff) | |
parent | 6567b2168881ce8c47e38debcdc89eba1ac80c5a (diff) |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'keyboards')
-rw-r--r-- | keyboards/centromere/matrix.c | 11 | ||||
-rwxr-xr-x | keyboards/dichotomy/matrix.c | 16 | ||||
-rw-r--r-- | keyboards/glenpickle/chimera_ergo/matrix.c | 11 | ||||
-rw-r--r-- | keyboards/glenpickle/chimera_ls/matrix.c | 11 | ||||
-rw-r--r-- | keyboards/glenpickle/chimera_ortho/matrix.c | 11 | ||||
-rw-r--r-- | keyboards/glenpickle/chimera_ortho_plus/matrix.c | 11 | ||||
-rwxr-xr-x | keyboards/keyhive/honeycomb/matrix.c | 12 | ||||
-rw-r--r-- | keyboards/mitosis/matrix.c | 13 | ||||
-rw-r--r-- | keyboards/redox_w/matrix.c | 2 | ||||
-rw-r--r-- | keyboards/satt/comet46/matrix.c | 11 | ||||
-rw-r--r-- | keyboards/sirius/uni660/rev1/matrix.c | 11 | ||||
-rw-r--r-- | keyboards/sirius/uni660/rev2/matrix.c | 11 | ||||
-rw-r--r-- | keyboards/telophase/matrix.c | 11 |
13 files changed, 111 insertions, 31 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 diff --git a/keyboards/dichotomy/matrix.c b/keyboards/dichotomy/matrix.c index dc90e7501e..0799554f0a 100755 --- a/keyboards/dichotomy/matrix.c +++ b/keyboards/dichotomy/matrix.c @@ -48,6 +48,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define MAIN_ROWMASK 0xFFF0; #define LOWER_ROWMASK 0x3FC0; +#define UART_MATRIX_RESPONSE_TIMEOUT 10000 + /* matrix state(1:on, 0:off) */ static matrix_row_t matrix[MATRIX_ROWS]; @@ -96,8 +98,6 @@ void matrix_init(void) { uint8_t matrix_scan(void) { - //xprintf("\r\nTRYING TO SCAN"); - uint32_t timeout = 0; //the s character requests the RF slave to send the matrix @@ -113,18 +113,22 @@ uint8_t matrix_scan(void) //harm to leave it in here while(!uart_available()){ timeout++; - if (timeout > 10000){ - xprintf("\r\nTime out in keyboard."); + 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 //will only show up here if the correct bytes were recieved uint8_t checksum = 0x00; - for (uint8_t z=0; z<10; z++){ + for (uint8_t z = 0; z < 10; z++){ checksum = checksum^uart_data[z]; } checksum = checksum ^ (uart_data[10] & 0xF0); diff --git a/keyboards/glenpickle/chimera_ergo/matrix.c b/keyboards/glenpickle/chimera_ergo/matrix.c index 603ad0f386..32d7b09310 100644 --- a/keyboards/glenpickle/chimera_ergo/matrix.c +++ b/keyboards/glenpickle/chimera_ergo/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(1000000); } @@ -41,11 +43,16 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { //harm to leave it in here 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 diff --git a/keyboards/glenpickle/chimera_ls/matrix.c b/keyboards/glenpickle/chimera_ls/matrix.c index a92c3e8431..9a69724eb7 100644 --- a/keyboards/glenpickle/chimera_ls/matrix.c +++ b/keyboards/glenpickle/chimera_ls/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(1000000); } @@ -41,11 +43,16 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { //harm to leave it in here 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 diff --git a/keyboards/glenpickle/chimera_ortho/matrix.c b/keyboards/glenpickle/chimera_ortho/matrix.c index a92c3e8431..9a69724eb7 100644 --- a/keyboards/glenpickle/chimera_ortho/matrix.c +++ b/keyboards/glenpickle/chimera_ortho/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(1000000); } @@ -41,11 +43,16 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { //harm to leave it in here 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 diff --git a/keyboards/glenpickle/chimera_ortho_plus/matrix.c b/keyboards/glenpickle/chimera_ortho_plus/matrix.c index 603ad0f386..32d7b09310 100644 --- a/keyboards/glenpickle/chimera_ortho_plus/matrix.c +++ b/keyboards/glenpickle/chimera_ortho_plus/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(1000000); } @@ -41,11 +43,16 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { //harm to leave it in here 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 diff --git a/keyboards/keyhive/honeycomb/matrix.c b/keyboards/keyhive/honeycomb/matrix.c index 9a87ca9a2e..c8a7992ec5 100755 --- a/keyboards/keyhive/honeycomb/matrix.c +++ b/keyboards/keyhive/honeycomb/matrix.c @@ -46,6 +46,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. # define ROW_SHIFTER ((uint32_t)1) #endif +#define UART_MATRIX_RESPONSE_TIMEOUT 10000 + /* matrix state(1:on, 0:off) */ static matrix_row_t matrix[MATRIX_ROWS]; //extern int8_t encoderValue; @@ -112,12 +114,16 @@ uint8_t matrix_scan(void) // harm to leave it in here while(!uart_available()){ timeout++; - if (timeout > 10000){ - xprintf("\r\nTime out in keyboard."); + 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, it's our checksum. diff --git a/keyboards/mitosis/matrix.c b/keyboards/mitosis/matrix.c index a92c3e8431..e5389bb113 100644 --- a/keyboards/mitosis/matrix.c +++ b/keyboards/mitosis/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(1000000); } @@ -34,18 +36,23 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { //trust the external keystates entirely, erase the last data uint8_t uart_data[11] = {0}; - //there are 10 bytes corresponding to 10 columns, and an end byte + //there are 10 bytes corresponding to 10 columns, and then an end byte for (uint8_t i = 0; i < 11; i++) { //wait for the serial data, timeout if it's been too long //this only happened in testing with a loose wire, but does no //harm to leave it in here 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 diff --git a/keyboards/redox_w/matrix.c b/keyboards/redox_w/matrix.c index 6a33e89976..9c50c9cece 100644 --- a/keyboards/redox_w/matrix.c +++ b/keyboards/redox_w/matrix.c @@ -34,7 +34,7 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { //trust the external keystates entirely, erase the last data uint8_t uart_data[11] = {0}; - //there are 14 bytes corresponding to 14 columns, and an end byte + //there are 10 bytes corresponding to 10 columns, and then an end byte for (uint8_t i = 0; i < 11; i++) { //wait for the serial data, timeout if it's been too long //this only happened in testing with a loose wire, but does no diff --git a/keyboards/satt/comet46/matrix.c b/keyboards/satt/comet46/matrix.c index a92c3e8431..9a69724eb7 100644 --- a/keyboards/satt/comet46/matrix.c +++ b/keyboards/satt/comet46/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(1000000); } @@ -41,11 +43,16 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { //harm to leave it in here 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 diff --git a/keyboards/sirius/uni660/rev1/matrix.c b/keyboards/sirius/uni660/rev1/matrix.c index 919db5c80d..f65bf0f26a 100644 --- a/keyboards/sirius/uni660/rev1/matrix.c +++ b/keyboards/sirius/uni660/rev1/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(1000000); } @@ -41,11 +43,16 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { //harm to leave it in here 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 diff --git a/keyboards/sirius/uni660/rev2/matrix.c b/keyboards/sirius/uni660/rev2/matrix.c index 919db5c80d..f65bf0f26a 100644 --- a/keyboards/sirius/uni660/rev2/matrix.c +++ b/keyboards/sirius/uni660/rev2/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(1000000); } @@ -41,11 +43,16 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { //harm to leave it in here 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 diff --git a/keyboards/telophase/matrix.c b/keyboards/telophase/matrix.c index 44b7e4c9e9..a18a2b20ed 100644 --- a/keyboards/telophase/matrix.c +++ b/keyboards/telophase/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(1000000); } @@ -41,11 +43,16 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) { //harm to leave it in here 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 |