diff options
| author | Joel Challis <git@zvecr.com> | 2025-05-14 13:01:08 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-14 22:01:08 +1000 |
| commit | cd95294a25fba190e6b3383200e178ffd0eab8d0 (patch) | |
| tree | ab51848333e3dd6f6ce817675857dbef880de90c /tmk_core/protocol | |
| parent | b4f0314b35b3eb0f690a3d358918638185dc39e4 (diff) | |
Remove more USB only branches from NKRO handling (#25263)
Diffstat (limited to 'tmk_core/protocol')
| -rw-r--r-- | tmk_core/protocol/report.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tmk_core/protocol/report.c b/tmk_core/protocol/report.c index 6203a3116b..f68334adeb 100644 --- a/tmk_core/protocol/report.c +++ b/tmk_core/protocol/report.c | |||
| @@ -32,7 +32,7 @@ uint8_t has_anykey(void) { | |||
| 32 | uint8_t* p = keyboard_report->keys; | 32 | uint8_t* p = keyboard_report->keys; |
| 33 | uint8_t lp = sizeof(keyboard_report->keys); | 33 | uint8_t lp = sizeof(keyboard_report->keys); |
| 34 | #ifdef NKRO_ENABLE | 34 | #ifdef NKRO_ENABLE |
| 35 | if (usb_device_state_get_protocol() == USB_PROTOCOL_REPORT && keymap_config.nkro) { | 35 | if (host_can_send_nkro() && keymap_config.nkro) { |
| 36 | p = nkro_report->bits; | 36 | p = nkro_report->bits; |
| 37 | lp = sizeof(nkro_report->bits); | 37 | lp = sizeof(nkro_report->bits); |
| 38 | } | 38 | } |
| @@ -49,7 +49,7 @@ uint8_t has_anykey(void) { | |||
| 49 | */ | 49 | */ |
| 50 | uint8_t get_first_key(void) { | 50 | uint8_t get_first_key(void) { |
| 51 | #ifdef NKRO_ENABLE | 51 | #ifdef NKRO_ENABLE |
| 52 | if (usb_device_state_get_protocol() == USB_PROTOCOL_REPORT && keymap_config.nkro) { | 52 | if (host_can_send_nkro() && keymap_config.nkro) { |
| 53 | uint8_t i = 0; | 53 | uint8_t i = 0; |
| 54 | for (; i < NKRO_REPORT_BITS && !nkro_report->bits[i]; i++) | 54 | for (; i < NKRO_REPORT_BITS && !nkro_report->bits[i]; i++) |
| 55 | ; | 55 | ; |
| @@ -69,7 +69,7 @@ bool is_key_pressed(uint8_t key) { | |||
| 69 | return false; | 69 | return false; |
| 70 | } | 70 | } |
| 71 | #ifdef NKRO_ENABLE | 71 | #ifdef NKRO_ENABLE |
| 72 | if (usb_device_state_get_protocol() == USB_PROTOCOL_REPORT && keymap_config.nkro) { | 72 | if (host_can_send_nkro() && keymap_config.nkro) { |
| 73 | if ((key >> 3) < NKRO_REPORT_BITS) { | 73 | if ((key >> 3) < NKRO_REPORT_BITS) { |
| 74 | return nkro_report->bits[key >> 3] & 1 << (key & 7); | 74 | return nkro_report->bits[key >> 3] & 1 << (key & 7); |
| 75 | } else { | 75 | } else { |
| @@ -151,7 +151,7 @@ void del_key_bit(report_nkro_t* nkro_report, uint8_t code) { | |||
| 151 | */ | 151 | */ |
| 152 | void add_key_to_report(uint8_t key) { | 152 | void add_key_to_report(uint8_t key) { |
| 153 | #ifdef NKRO_ENABLE | 153 | #ifdef NKRO_ENABLE |
| 154 | if (usb_device_state_get_protocol() == USB_PROTOCOL_REPORT && keymap_config.nkro) { | 154 | if (host_can_send_nkro() && keymap_config.nkro) { |
| 155 | add_key_bit(nkro_report, key); | 155 | add_key_bit(nkro_report, key); |
| 156 | return; | 156 | return; |
| 157 | } | 157 | } |
| @@ -165,7 +165,7 @@ void add_key_to_report(uint8_t key) { | |||
| 165 | */ | 165 | */ |
| 166 | void del_key_from_report(uint8_t key) { | 166 | void del_key_from_report(uint8_t key) { |
| 167 | #ifdef NKRO_ENABLE | 167 | #ifdef NKRO_ENABLE |
| 168 | if (usb_device_state_get_protocol() == USB_PROTOCOL_REPORT && keymap_config.nkro) { | 168 | if (host_can_send_nkro() && keymap_config.nkro) { |
| 169 | del_key_bit(nkro_report, key); | 169 | del_key_bit(nkro_report, key); |
| 170 | return; | 170 | return; |
| 171 | } | 171 | } |
| @@ -180,7 +180,7 @@ void del_key_from_report(uint8_t key) { | |||
| 180 | void clear_keys_from_report(void) { | 180 | void clear_keys_from_report(void) { |
| 181 | // not clear mods | 181 | // not clear mods |
| 182 | #ifdef NKRO_ENABLE | 182 | #ifdef NKRO_ENABLE |
| 183 | if (usb_device_state_get_protocol() == USB_PROTOCOL_REPORT && keymap_config.nkro) { | 183 | if (host_can_send_nkro() && keymap_config.nkro) { |
| 184 | memset(nkro_report->bits, 0, sizeof(nkro_report->bits)); | 184 | memset(nkro_report->bits, 0, sizeof(nkro_report->bits)); |
| 185 | return; | 185 | return; |
| 186 | } | 186 | } |
