aboutsummaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
authorBalz Guenat <balz.guenat@gmail.com>2017-08-12 18:24:15 +0200
committerJack Humbert <jack.humb@gmail.com>2017-08-15 23:14:41 -0400
commit2aa5e4464010a9292b50571243d8ef6e749a5ca4 (patch)
tree81a485c561b87fbc5e4a43b7273fa631a6c8af99 /tmk_core
parent42f895a4bc232515d95d1fb93396ecd2c0032c0e (diff)
downloadqmk_firmware-2aa5e4464010a9292b50571243d8ef6e749a5ca4.tar.gz
qmk_firmware-2aa5e4464010a9292b50571243d8ef6e749a5ca4.zip
some major steps toward making the usb-usb converter work
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/common/keycode.h8
-rw-r--r--tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/README.md (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/readme.md)0
-rw-r--r--tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/README.md (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/readme.md)0
-rw-r--r--tmk_core/protocol/usb_hid/parser.cpp24
-rw-r--r--tmk_core/protocol/usb_hid/parser.h5
-rw-r--r--tmk_core/protocol/usb_hid/test/Makefile40
6 files changed, 55 insertions, 22 deletions
diff --git a/tmk_core/common/keycode.h b/tmk_core/common/keycode.h
index 54e9c322c..a1e0bc9a4 100644
--- a/tmk_core/common/keycode.h
+++ b/tmk_core/common/keycode.h
@@ -94,6 +94,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
94#define KC_JYEN KC_INT3 94#define KC_JYEN KC_INT3
95#define KC_HENK KC_INT4 95#define KC_HENK KC_INT4
96#define KC_MHEN KC_INT5 96#define KC_MHEN KC_INT5
97/* Korean specific */
98#define KC_HAEN KC_LANG1
99#define KC_HANJ KC_LANG2
97/* Keypad */ 100/* Keypad */
98#define KC_P1 KC_KP_1 101#define KC_P1 KC_KP_1
99#define KC_P2 KC_KP_2 102#define KC_P2 KC_KP_2
@@ -113,6 +116,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
113#define KC_PPLS KC_KP_PLUS 116#define KC_PPLS KC_KP_PLUS
114#define KC_PEQL KC_KP_EQUAL 117#define KC_PEQL KC_KP_EQUAL
115#define KC_PENT KC_KP_ENTER 118#define KC_PENT KC_KP_ENTER
119/* Unix function key */
120#define KC_EXEC KC_EXECUTE
121#define KC_SLCT KC_SELECT
122#define KC_AGIN KC_AGAIN
123#define KC_PSTE KC_PASTE
116/* Mousekey */ 124/* Mousekey */
117#define KC_MS_U KC_MS_UP 125#define KC_MS_U KC_MS_UP
118#define KC_MS_D KC_MS_DOWN 126#define KC_MS_D KC_MS_DOWN
diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/readme.md b/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/README.md
index 49cd83e0a..49cd83e0a 100644
--- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/readme.md
+++ b/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/README.md
diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/readme.md b/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/README.md
index d8b4296b1..d8b4296b1 100644
--- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/readme.md
+++ b/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/README.md
diff --git a/tmk_core/protocol/usb_hid/parser.cpp b/tmk_core/protocol/usb_hid/parser.cpp
index 1a152ff3f..94e747ca4 100644
--- a/tmk_core/protocol/usb_hid/parser.cpp
+++ b/tmk_core/protocol/usb_hid/parser.cpp
@@ -4,30 +4,14 @@
4#include "debug.h" 4#include "debug.h"
5 5
6 6
7report_keyboard_t usb_hid_keyboard_report;
8uint16_t usb_hid_time_stamp;
9
10
11void KBDReportParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) 7void KBDReportParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
12{ 8{
13 bool is_error = false; 9 ::memcpy(&report, buf, sizeof(report_keyboard_t));
14 report_keyboard_t *report = (report_keyboard_t *)buf; 10 time_stamp = millis();
15 11
16 dprintf("KBDReport: %02X %02X", report->mods, report->reserved); 12 dprintf("input %d: %02X %02X", hid->GetAddress(), report.mods, report.reserved);
17 for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { 13 for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
18 if (IS_ERROR(report->keys[i])) { 14 dprintf(" %02X", report.keys[i]);
19 is_error = true;
20 }
21 dprintf(" %02X", report->keys[i]);
22 } 15 }
23 dprint("\r\n"); 16 dprint("\r\n");
24
25 // ignore error and not send report to computer
26 if (is_error) {
27 dprint("Error usage! \r\n");
28 return;
29 }
30
31 ::memcpy(&usb_hid_keyboard_report, buf, sizeof(report_keyboard_t));
32 usb_hid_time_stamp = millis();
33} 17}
diff --git a/tmk_core/protocol/usb_hid/parser.h b/tmk_core/protocol/usb_hid/parser.h
index 703eb1ed4..036281fa6 100644
--- a/tmk_core/protocol/usb_hid/parser.h
+++ b/tmk_core/protocol/usb_hid/parser.h
@@ -2,11 +2,14 @@
2#define PARSER_H 2#define PARSER_H
3 3
4#include "hid.h" 4#include "hid.h"
5#include "report.h"
5 6
6class KBDReportParser : public HIDReportParser 7class KBDReportParser : public HIDReportParser
7{ 8{
8public: 9public:
9 virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf); 10 report_keyboard_t report;
11 uint16_t time_stamp;
12 virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf);
10}; 13};
11 14
12#endif 15#endif
diff --git a/tmk_core/protocol/usb_hid/test/Makefile b/tmk_core/protocol/usb_hid/test/Makefile
index c093bbd4c..83bf2aed6 100644
--- a/tmk_core/protocol/usb_hid/test/Makefile
+++ b/tmk_core/protocol/usb_hid/test/Makefile
@@ -1,4 +1,42 @@
1 1#----------------------------------------------------------------------------
2# On command line:
3#
4# make all = Make software.
5#
6# make clean = Clean out built project files.
7#
8# make coff = Convert ELF to AVR COFF.
9#
10# make extcoff = Convert ELF to AVR Extended COFF.
11#
12# make program = Download the hex file to the device.
13# Please customize your programmer settings(PROGRAM_CMD)
14#
15# make teensy = Download the hex file to the device, using teensy_loader_cli.
16# (must have teensy_loader_cli installed).
17#
18# make dfu = Download the hex file to the device, using dfu-programmer (must
19# have dfu-programmer installed).
20#
21# make flip = Download the hex file to the device, using Atmel FLIP (must
22# have Atmel FLIP installed).
23#
24# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
25# (must have dfu-programmer installed).
26#
27# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
28# (must have Atmel FLIP installed).
29#
30# make debug = Start either simulavr or avarice as specified for debugging,
31# with avr-gdb or avr-insight as the front end for debugging.
32#
33# make filename.s = Just compile filename.c into the assembler code only.
34#
35# make filename.i = Create a preprocessed source file for use in submitting
36# bug reports to the GCC project.
37#
38# To rebuild project do "make clean" then "make all".
39#----------------------------------------------------------------------------
2 40
3# Target file name (without extension). 41# Target file name (without extension).
4TARGET = usb_hid_test 42TARGET = usb_hid_test