summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfauxpark <fauxpark@gmail.com>2019-11-13 19:38:37 +1100
committerJames Young <18669334+noroadsleft@users.noreply.github.com>2019-11-13 00:38:37 -0800
commit9dc5432a3e16ca4ee42d84cacbcfa7aeee97d2f9 (patch)
tree9097e9b37c73b5f95f452d3e5886ab2b101ae047
parent7e8f239c2e15091bca82f69c3982e585814c0f70 (diff)
downloadqmk_firmware-9dc5432a3e16ca4ee42d84cacbcfa7aeee97d2f9.tar.gz
qmk_firmware-9dc5432a3e16ca4ee42d84cacbcfa7aeee97d2f9.zip
[Keyboard] XT converter: add config_common.h include and fix E0 collision (#7341)
-rw-r--r--keyboards/converter/xt_usb/config.h2
-rw-r--r--keyboards/converter/xt_usb/matrix.c42
2 files changed, 23 insertions, 21 deletions
diff --git a/keyboards/converter/xt_usb/config.h b/keyboards/converter/xt_usb/config.h
index ecebc123fa..fe79953873 100644
--- a/keyboards/converter/xt_usb/config.h
+++ b/keyboards/converter/xt_usb/config.h
@@ -17,6 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
+#include "config_common.h"
+
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6512
#define DEVICE_VER 0x0001
diff --git a/keyboards/converter/xt_usb/matrix.c b/keyboards/converter/xt_usb/matrix.c
index e2d7117b13..d48f1a887f 100644
--- a/keyboards/converter/xt_usb/matrix.c
+++ b/keyboards/converter/xt_usb/matrix.c
@@ -99,25 +99,25 @@ static uint8_t move_e0code(uint8_t code) {
uint8_t matrix_scan(void)
{
static enum {
- INIT,
- E0,
+ XT_STATE_INIT,
+ XT_STATE_E0,
// Pause: E1 1D 45, E1 9D C5
- E1,
- E1_1D,
- E1_9D,
- } state = INIT;
+ XT_STATE_E1,
+ XT_STATE_E1_1D,
+ XT_STATE_E1_9D,
+ } state = XT_STATE_INIT;
uint8_t code = xt_host_recv();
if (!code) return 0;
xprintf("%02X ", code);
switch (state) {
- case INIT:
+ case XT_STATE_INIT:
switch (code) {
case 0xE0:
- state = E0;
+ state = XT_STATE_E0;
break;
case 0xE1:
- state = E1;
+ state = XT_STATE_E1;
break;
default:
if (code < 0x80)
@@ -127,59 +127,59 @@ uint8_t matrix_scan(void)
break;
}
break;
- case E0:
+ case XT_STATE_E0:
switch (code) {
case 0x2A:
case 0xAA:
case 0x36:
case 0xB6:
//ignore fake shift
- state = INIT;
+ state = XT_STATE_INIT;
break;
default:
if (code < 0x80)
matrix_make(move_e0code(code));
else
matrix_break(move_e0code(code & 0x7F));
- state = INIT;
+ state = XT_STATE_INIT;
break;
}
break;
- case E1:
+ case XT_STATE_E1:
switch (code) {
case 0x1D:
- state = E1_1D;
+ state = XT_STATE_E1_1D;
break;
case 0x9D:
- state = E1_9D;
+ state = XT_STATE_E1_9D;
break;
default:
- state = INIT;
+ state = XT_STATE_INIT;
break;
}
break;
- case E1_1D:
+ case XT_STATE_E1_1D:
switch (code) {
case 0x45:
matrix_make(0x55);
break;
default:
- state = INIT;
+ state = XT_STATE_INIT;
break;
}
break;
- case E1_9D:
+ case XT_STATE_E1_9D:
switch (code) {
case 0x45:
matrix_break(0x55);
break;
default:
- state = INIT;
+ state = XT_STATE_INIT;
break;
}
break;
default:
- state = INIT;
+ state = XT_STATE_INIT;
}
matrix_scan_quantum();
return 1;