diff options
| author | Balz Guenat <balz.guenat@gmail.com> | 2017-08-12 18:24:15 +0200 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2017-08-15 23:14:41 -0400 |
| commit | 2aa5e4464010a9292b50571243d8ef6e749a5ca4 (patch) | |
| tree | 81a485c561b87fbc5e4a43b7273fa631a6c8af99 /tmk_core/protocol | |
| parent | 42f895a4bc232515d95d1fb93396ecd2c0032c0e (diff) | |
| download | qmk_firmware-2aa5e4464010a9292b50571243d8ef6e749a5ca4.tar.gz qmk_firmware-2aa5e4464010a9292b50571243d8ef6e749a5ca4.zip | |
some major steps toward making the usb-usb converter work
Diffstat (limited to 'tmk_core/protocol')
| -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.cpp | 24 | ||||
| -rw-r--r-- | tmk_core/protocol/usb_hid/parser.h | 5 | ||||
| -rw-r--r-- | tmk_core/protocol/usb_hid/test/Makefile | 40 |
5 files changed, 47 insertions, 22 deletions
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 | ||
| 7 | report_keyboard_t usb_hid_keyboard_report; | ||
| 8 | uint16_t usb_hid_time_stamp; | ||
| 9 | |||
| 10 | |||
| 11 | void KBDReportParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) | 7 | void 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 | ||
| 6 | class KBDReportParser : public HIDReportParser | 7 | class KBDReportParser : public HIDReportParser |
| 7 | { | 8 | { |
| 8 | public: | 9 | public: |
| 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). |
| 4 | TARGET = usb_hid_test | 42 | TARGET = usb_hid_test |
