From 5e3f2d2b2e5065a04495f2c55fae0849966b5d23 Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 25 Apr 2014 15:32:21 +0900 Subject: Make NKRO deafult when it is available - NKRO is used only when keyboard_protocol = 1(report) --- protocol/pjrc/usb.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'protocol/pjrc/usb.c') diff --git a/protocol/pjrc/usb.c b/protocol/pjrc/usb.c index 393b36f78e..b09ad3f233 100644 --- a/protocol/pjrc/usb.c +++ b/protocol/pjrc/usb.c @@ -38,6 +38,7 @@ #include "sleep_led.h" #endif #include "suspend.h" +#include "action.h" #include "action_util.h" @@ -692,20 +693,20 @@ ISR(USB_GEN_vect) } /* TODO: should keep IDLE rate on each keyboard interface */ #ifdef NKRO_ENABLE - if (!keyboard_nkro && usb_keyboard_idle_config && (++div4 & 3) == 0) { + if (!keyboard_nkro && keyboard_idle && (++div4 & 3) == 0) { #else - if (usb_keyboard_idle_config && (++div4 & 3) == 0) { + if (keyboard_idle && (++div4 & 3) == 0) { #endif UENUM = KBD_ENDPOINT; if (UEINTX & (1<mods; UEDATX = 0; - uint8_t keys = usb_keyboard_protocol ? KBD_REPORT_KEYS : 6; + uint8_t keys = keyboard_protocol ? KBD_REPORT_KEYS : 6; for (uint8_t i=0; ikeys[i]; } @@ -901,13 +902,13 @@ ISR(USB_COM_vect) } if (bRequest == HID_GET_IDLE) { usb_wait_in_ready(); - UEDATX = usb_keyboard_idle_config; + UEDATX = keyboard_idle; usb_send_in(); return; } if (bRequest == HID_GET_PROTOCOL) { usb_wait_in_ready(); - UEDATX = usb_keyboard_protocol; + UEDATX = keyboard_protocol; usb_send_in(); return; } @@ -921,14 +922,15 @@ ISR(USB_COM_vect) return; } if (bRequest == HID_SET_IDLE) { - usb_keyboard_idle_config = (wValue >> 8); + keyboard_idle = (wValue >> 8); usb_keyboard_idle_count = 0; //usb_wait_in_ready(); usb_send_in(); return; } if (bRequest == HID_SET_PROTOCOL) { - usb_keyboard_protocol = wValue; + keyboard_protocol = wValue; + clear_keyboard(); //usb_wait_in_ready(); usb_send_in(); return; -- cgit v1.2.3