summaryrefslogtreecommitdiffstats
path: root/tmk_core/protocol
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/protocol
parent42f895a4bc232515d95d1fb93396ecd2c0032c0e (diff)
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.cpp24
-rw-r--r--tmk_core/protocol/usb_hid/parser.h5
-rw-r--r--tmk_core/protocol/usb_hid/test/Makefile40
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 49cd83e0af..49cd83e0af 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 d8b4296b1a..d8b4296b1a 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 1a152ff3f2..94e747ca4b 100644
--- a/tmk_core/protocol/usb_hid/parser.cpp
+++ b/tmk_core/protocol/usb_hid/parser.cpp
@@ -4,30 +4,14 @@
#include "debug.h"
-report_keyboard_t usb_hid_keyboard_report;
-uint16_t usb_hid_time_stamp;
-
-
void KBDReportParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
{
- bool is_error = false;
- report_keyboard_t *report = (report_keyboard_t *)buf;
+ ::memcpy(&report, buf, sizeof(report_keyboard_t));
+ time_stamp = millis();
- dprintf("KBDReport: %02X %02X", report->mods, report->reserved);
+ dprintf("input %d: %02X %02X", hid->GetAddress(), report.mods, report.reserved);
for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
- if (IS_ERROR(report->keys[i])) {
- is_error = true;
- }
- dprintf(" %02X", report->keys[i]);
+ dprintf(" %02X", report.keys[i]);
}
dprint("\r\n");
-
- // ignore error and not send report to computer
- if (is_error) {
- dprint("Error usage! \r\n");
- return;
- }
-
- ::memcpy(&usb_hid_keyboard_report, buf, sizeof(report_keyboard_t));
- usb_hid_time_stamp = millis();
}
diff --git a/tmk_core/protocol/usb_hid/parser.h b/tmk_core/protocol/usb_hid/parser.h
index 703eb1ed4c..036281fa66 100644
--- a/tmk_core/protocol/usb_hid/parser.h
+++ b/tmk_core/protocol/usb_hid/parser.h
@@ -2,11 +2,14 @@
#define PARSER_H
#include "hid.h"
+#include "report.h"
class KBDReportParser : public HIDReportParser
{
public:
- virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf);
+ report_keyboard_t report;
+ uint16_t time_stamp;
+ virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf);
};
#endif
diff --git a/tmk_core/protocol/usb_hid/test/Makefile b/tmk_core/protocol/usb_hid/test/Makefile
index c093bbd4c1..83bf2aed67 100644
--- a/tmk_core/protocol/usb_hid/test/Makefile
+++ b/tmk_core/protocol/usb_hid/test/Makefile
@@ -1,4 +1,42 @@
-
+#----------------------------------------------------------------------------
+# On command line:
+#
+# make all = Make software.
+#
+# make clean = Clean out built project files.
+#
+# make coff = Convert ELF to AVR COFF.
+#
+# make extcoff = Convert ELF to AVR Extended COFF.
+#
+# make program = Download the hex file to the device.
+# Please customize your programmer settings(PROGRAM_CMD)
+#
+# make teensy = Download the hex file to the device, using teensy_loader_cli.
+# (must have teensy_loader_cli installed).
+#
+# make dfu = Download the hex file to the device, using dfu-programmer (must
+# have dfu-programmer installed).
+#
+# make flip = Download the hex file to the device, using Atmel FLIP (must
+# have Atmel FLIP installed).
+#
+# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
+# (must have dfu-programmer installed).
+#
+# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
+# (must have Atmel FLIP installed).
+#
+# make debug = Start either simulavr or avarice as specified for debugging,
+# with avr-gdb or avr-insight as the front end for debugging.
+#
+# make filename.s = Just compile filename.c into the assembler code only.
+#
+# make filename.i = Create a preprocessed source file for use in submitting
+# bug reports to the GCC project.
+#
+# To rebuild project do "make clean" then "make all".
+#----------------------------------------------------------------------------
# Target file name (without extension).
TARGET = usb_hid_test