diff options
Diffstat (limited to 'tmk_core/common/report.c')
-rw-r--r-- | tmk_core/common/report.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/tmk_core/common/report.c b/tmk_core/common/report.c index eb3b44312..6a06b70c6 100644 --- a/tmk_core/common/report.c +++ b/tmk_core/common/report.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "keycode_config.h" | 19 | #include "keycode_config.h" |
20 | #include "debug.h" | 20 | #include "debug.h" |
21 | #include "util.h" | 21 | #include "util.h" |
22 | #include <string.h> | ||
22 | 23 | ||
23 | /** \brief has_anykey | 24 | /** \brief has_anykey |
24 | * | 25 | * |
@@ -27,8 +28,16 @@ | |||
27 | uint8_t has_anykey(report_keyboard_t* keyboard_report) | 28 | uint8_t has_anykey(report_keyboard_t* keyboard_report) |
28 | { | 29 | { |
29 | uint8_t cnt = 0; | 30 | uint8_t cnt = 0; |
30 | for (uint8_t i = 1; i < KEYBOARD_REPORT_SIZE; i++) { | 31 | uint8_t *p = keyboard_report->keys; |
31 | if (keyboard_report->raw[i]) | 32 | uint8_t lp = sizeof(keyboard_report->keys); |
33 | #ifdef NKRO_ENABLE | ||
34 | if (keyboard_protocol && keymap_config.nkro) { | ||
35 | p = keyboard_report->nkro.bits; | ||
36 | lp = sizeof(keyboard_report->nkro.bits); | ||
37 | } | ||
38 | #endif | ||
39 | while (lp--) { | ||
40 | if (*p++) | ||
32 | cnt++; | 41 | cnt++; |
33 | } | 42 | } |
34 | return cnt; | 43 | return cnt; |
@@ -237,7 +246,11 @@ void del_key_from_report(report_keyboard_t* keyboard_report, uint8_t key) | |||
237 | void clear_keys_from_report(report_keyboard_t* keyboard_report) | 246 | void clear_keys_from_report(report_keyboard_t* keyboard_report) |
238 | { | 247 | { |
239 | // not clear mods | 248 | // not clear mods |
240 | for (int8_t i = 1; i < KEYBOARD_REPORT_SIZE; i++) { | 249 | #ifdef NKRO_ENABLE |
241 | keyboard_report->raw[i] = 0; | 250 | if (keyboard_protocol && keymap_config.nkro) { |
251 | memset(keyboard_report->nkro.bits, 0, sizeof(keyboard_report->nkro.bits)); | ||
252 | return; | ||
242 | } | 253 | } |
254 | #endif | ||
255 | memset(keyboard_report->keys, 0, sizeof(keyboard_report->keys)); | ||
243 | } | 256 | } |