Skip to content

Commit a653cd8

Browse files
keyboard_quantizer/bmp Flush uart(slip) buffer at every loop
1 parent 78ff259 commit a653cd8

File tree

2 files changed

+24
-17
lines changed

2 files changed

+24
-17
lines changed

keyboards/keyboard_quantizer/bmp/bmp.c

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@
2525

2626
#define LEN(x) (sizeof(x) / sizeof(x[0]))
2727

28-
bool bmp_config_overwrite(bmp_api_config_t const *const config_on_storage,
29-
bmp_api_config_t *const keyboard_config) {
30-
// User can overwrite partial settings
31-
keyboard_config->mode = config_on_storage->mode;
32-
keyboard_config->startup = config_on_storage->startup;
33-
keyboard_config->matrix.debounce = config_on_storage->matrix.debounce;
34-
keyboard_config->matrix.is_left_hand =
35-
config_on_storage->matrix.is_left_hand;
36-
keyboard_config->param_central = config_on_storage->param_central;
37-
keyboard_config->param_peripheral = config_on_storage->param_peripheral;
38-
keyboard_config->keymap = config_on_storage->keymap;
39-
keyboard_config->reserved[2] = config_on_storage->reserved[2];
40-
41-
return true;
42-
}
28+
// bool bmp_config_overwrite(bmp_api_config_t const *const config_on_storage,
29+
// bmp_api_config_t *const keyboard_config) {
30+
// // User can overwrite partial settings
31+
// keyboard_config->mode = config_on_storage->mode;
32+
// keyboard_config->startup = config_on_storage->startup;
33+
// keyboard_config->matrix.debounce = config_on_storage->matrix.debounce;
34+
// keyboard_config->matrix.is_left_hand =
35+
// config_on_storage->matrix.is_left_hand;
36+
// keyboard_config->param_central = config_on_storage->param_central;
37+
// keyboard_config->param_peripheral = config_on_storage->param_peripheral;
38+
// keyboard_config->keymap = config_on_storage->keymap;
39+
// keyboard_config->reserved[2] = config_on_storage->reserved[2];
40+
//
41+
// return true;
42+
// }
4343

4444
static void create_status_file() {}
4545

@@ -51,8 +51,8 @@ void keyboard_post_init_kb() {
5151
debug_mouse = false;
5252
}
5353

54-
uint8_t buf[256];
55-
uint8_t widx, ridx, cnt;
54+
static uint8_t buf[256];
55+
static uint8_t widx, ridx, cnt;
5656

5757
void uart_recv_callback(uint8_t dat) {
5858
buf[widx] = dat;
@@ -71,6 +71,8 @@ uint8_t uart_getchar() {
7171
return c;
7272
}
7373

74+
void uart_flush_rx_buffer() { BMPAPI->uart.send(NULL, 0); }
75+
7476
void qt_matrix_init() {
7577
bmp_uart_config_t uart_config;
7678
uart_config.tx_pin = 1;

keyboards/keyboard_quantizer/keyboard_quantizer.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ bool parse_packet(uint8_t* buf, uint32_t cnt, matrix_row_t* current_matrix) {
141141
return matrix_has_changed;
142142
}
143143

144+
// __attribute__((weak)) void uart_flush_rx_buffer(void) {}
145+
void uart_flush_rx_buffer(void);
146+
144147
bool process_packet(matrix_row_t current_matrix[]) {
145148
bool matrix_has_changed = false;
146149
bool receive_complete = false;
@@ -201,5 +204,7 @@ bool process_packet(matrix_row_t current_matrix[]) {
201204
memset(buf, 0, sizeof(buf));
202205
}
203206

207+
uart_flush_rx_buffer();
208+
204209
return matrix_has_changed;
205210
}

0 commit comments

Comments
 (0)