summaryrefslogtreecommitdiffstats
path: root/tmk_core/protocol
diff options
context:
space:
mode:
authorIBNobody <IBNobody@users.noreply.github.com>2016-09-06 23:19:01 -0500
committerGitHub <noreply@github.com>2016-09-06 23:19:01 -0500
commit558f3ec1eb325caf706efc15e2fab26121aba442 (patch)
treea14b00c189492426beadc69c2094055f833b811f /tmk_core/protocol
parentf0388a5b1334ce0b8c8a359a0a8a1460e456b8c5 (diff)
Use keyboard config for nkro (#7)
* removing nkro references - wip * changed NKRO to be defined by keymap_config
Diffstat (limited to 'tmk_core/protocol')
-rw-r--r--tmk_core/protocol/chibios/usb_main.c19
-rw-r--r--tmk_core/protocol/lufa/lufa.c9
-rw-r--r--tmk_core/protocol/pjrc/usb.c18
-rw-r--r--tmk_core/protocol/pjrc/usb_keyboard.c8
4 files changed, 38 insertions, 16 deletions
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c
index e2c9d9bf14..d0c72c46c7 100644
--- a/tmk_core/protocol/chibios/usb_main.c
+++ b/tmk_core/protocol/chibios/usb_main.c
@@ -28,6 +28,12 @@
#include "led.h"
#endif
+#ifdef NKRO_ENABLE
+ #include "keycode_config.h"
+
+ extern keymap_config_t keymap_config;
+#endif
+
/* ---------------------------------------------------------
* Global interface variables and declarations
* ---------------------------------------------------------
@@ -39,9 +45,6 @@ uint16_t keyboard_led_stats __attribute__((aligned(2))) = 0;
volatile uint16_t keyboard_idle_count = 0;
static virtual_timer_t keyboard_idle_timer;
static void keyboard_idle_timer_cb(void *arg);
-#ifdef NKRO_ENABLE
-extern bool keyboard_nkro;
-#endif /* NKRO_ENABLE */
report_keyboard_t keyboard_report_sent = {{0}};
#ifdef MOUSE_ENABLE
@@ -943,8 +946,8 @@ static bool usb_request_hook_cb(USBDriver *usbp) {
if((usbp->setup[4] == KBD_INTERFACE) && (usbp->setup[5] == 0)) { /* wIndex */
keyboard_protocol = ((usbp->setup[2]) != 0x00); /* LSB(wValue) */
#ifdef NKRO_ENABLE
- keyboard_nkro = !!keyboard_protocol;
- if(!keyboard_nkro && keyboard_idle) {
+ keymap_config.nkro = !!keyboard_protocol;
+ if(!keymap_config.nkro && keyboard_idle) {
#else /* NKRO_ENABLE */
if(keyboard_idle) {
#endif /* NKRO_ENABLE */
@@ -962,7 +965,7 @@ static bool usb_request_hook_cb(USBDriver *usbp) {
keyboard_idle = usbp->setup[3]; /* MSB(wValue) */
/* arm the timer */
#ifdef NKRO_ENABLE
- if(!keyboard_nkro && keyboard_idle) {
+ if(!keymap_config.nkro && keyboard_idle) {
#else /* NKRO_ENABLE */
if(keyboard_idle) {
#endif /* NKRO_ENABLE */
@@ -1089,7 +1092,7 @@ static void keyboard_idle_timer_cb(void *arg) {
}
#ifdef NKRO_ENABLE
- if(!keyboard_nkro && keyboard_idle) {
+ if(!keymap_config.nkro && keyboard_idle) {
#else /* NKRO_ENABLE */
if(keyboard_idle) {
#endif /* NKRO_ENABLE */
@@ -1122,7 +1125,7 @@ void send_keyboard(report_keyboard_t *report) {
osalSysUnlock();
#ifdef NKRO_ENABLE
- if(keyboard_nkro) { /* NKRO protocol */
+ if(keymap_config.nkro) { /* NKRO protocol */
/* need to wait until the previous packet has made it through */
/* can rewrite this using the synchronous API, then would wait
* until *after* the packet has been transmitted. I think
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c
index 9b201374a2..01c0e45b0b 100644
--- a/tmk_core/protocol/lufa/lufa.c
+++ b/tmk_core/protocol/lufa/lufa.c
@@ -52,6 +52,13 @@
#include "descriptor.h"
#include "lufa.h"
+#ifdef NKRO_ENABLE
+ #include "keycode_config.h"
+
+ extern keymap_config_t keymap_config;
+#endif
+
+
#ifdef AUDIO_ENABLE
#include <audio.h>
#endif
@@ -502,7 +509,7 @@ static void send_keyboard(report_keyboard_t *report)
/* Select the Keyboard Report Endpoint */
#ifdef NKRO_ENABLE
- if (keyboard_protocol && keyboard_nkro) {
+ if (keyboard_protocol && keymap_config.nkro) {
/* Report protocol - NKRO */
Endpoint_SelectEndpoint(NKRO_IN_EPNUM);
diff --git a/tmk_core/protocol/pjrc/usb.c b/tmk_core/protocol/pjrc/usb.c
index 1e6ba8719a..09efbe0762 100644
--- a/tmk_core/protocol/pjrc/usb.c
+++ b/tmk_core/protocol/pjrc/usb.c
@@ -1,17 +1,17 @@
/* USB Keyboard Plus Debug Channel Example for Teensy USB Development Board
* http://www.pjrc.com/teensy/usb_keyboard.html
* Copyright (c) 2009 PJRC.COM, LLC
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -41,6 +41,12 @@
#include "action.h"
#include "action_util.h"
+#ifdef NKRO_ENABLE
+ #include "keycode_config.h"
+
+ extern keymap_config_t keymap_config;
+#endif
+
/**************************************************************************
*
@@ -694,7 +700,7 @@ ISR(USB_GEN_vect)
}
/* TODO: should keep IDLE rate on each keyboard interface */
#ifdef NKRO_ENABLE
- if (!keyboard_nkro && keyboard_idle && (++div4 & 3) == 0) {
+ if (!keymap_config.nkro && keyboard_idle && (++div4 & 3) == 0) {
#else
if (keyboard_idle && (++div4 & 3) == 0) {
#endif
@@ -881,7 +887,7 @@ ISR(USB_COM_vect)
#endif
if (bmRequestType == 0x00 && wValue == DEVICE_REMOTE_WAKEUP) {
if (bRequest == SET_FEATURE) {
- remote_wakeup = true;
+ remote_wakeup = true;
} else {
remote_wakeup = false;
}
@@ -932,7 +938,7 @@ ISR(USB_COM_vect)
if (bRequest == HID_SET_PROTOCOL) {
keyboard_protocol = wValue;
#ifdef NKRO_ENABLE
- keyboard_nkro = !!keyboard_protocol;
+ keymap_config.nkro = !!keyboard_protocol;
#endif
clear_keyboard();
//usb_wait_in_ready();
diff --git a/tmk_core/protocol/pjrc/usb_keyboard.c b/tmk_core/protocol/pjrc/usb_keyboard.c
index 4b87b5d7b5..05f4797340 100644
--- a/tmk_core/protocol/pjrc/usb_keyboard.c
+++ b/tmk_core/protocol/pjrc/usb_keyboard.c
@@ -30,6 +30,12 @@
#include "util.h"
#include "host.h"
+#ifdef NKRO_ENABLE
+ #include "keycode_config.h"
+
+ extern keymap_config_t keymap_config;
+#endif
+
// protocol setting from the host. We use exactly the same report
// either way, so this variable only stores the setting since we
@@ -56,7 +62,7 @@ int8_t usb_keyboard_send_report(report_keyboard_t *report)
int8_t result = 0;
#ifdef NKRO_ENABLE
- if (keyboard_nkro)
+ if (keymap_config.nkro)
result = send_report(report, KBD2_ENDPOINT, 0, KBD2_SIZE);
else
#endif