summaryrefslogtreecommitdiff
path: root/tmk_core/protocol/vusb/vusb.c
diff options
context:
space:
mode:
authorDrashna Jael're <drashna@live.com>2021-10-11 20:36:47 -0700
committerDrashna Jael're <drashna@live.com>2021-10-11 20:36:47 -0700
commitb34675555cbd9a71a797a7ebc2148cbf2e8f0efc (patch)
tree2d701310ccd3fc2c603d63536ab4a3c1d9b9381b /tmk_core/protocol/vusb/vusb.c
parentbcddde8738dbba48c548f1e3f12a10bbf60a65d8 (diff)
parentd9e077468ab3446cbd7306a453a73dad2c1403e8 (diff)
Merge commit 'd9e077468ab3446cbd7306a453a73dad2c1403e8' into firmware_21
Diffstat (limited to 'tmk_core/protocol/vusb/vusb.c')
-rw-r--r--tmk_core/protocol/vusb/vusb.c55
1 files changed, 51 insertions, 4 deletions
diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c
index 9362fbde78..485b20c900 100644
--- a/tmk_core/protocol/vusb/vusb.c
+++ b/tmk_core/protocol/vusb/vusb.c
@@ -272,7 +272,8 @@ static void send_extra(uint8_t report_id, uint16_t data) {
last_id = report_id;
last_data = data;
- report_extra_t report = {.report_id = report_id, .usage = data};
+ static report_extra_t report;
+ report = (report_extra_t){.report_id = report_id, .usage = data};
if (usbInterruptIsReadyShared()) {
usbSetInterruptShared((void *)&report, sizeof(report_extra_t));
}
@@ -291,6 +292,14 @@ static void send_consumer(uint16_t data) {
#endif
}
+void send_digitizer(report_digitizer_t *report) {
+#ifdef DIGITIZER_ENABLE
+ if (usbInterruptIsReadyShared()) {
+ usbSetInterruptShared((void *)report, sizeof(report_digitizer_t));
+ }
+#endif
+}
+
/*------------------------------------------------------------------*
* Request from host *
*------------------------------------------------------------------*/
@@ -509,8 +518,46 @@ const PROGMEM uchar shared_hid_report[] = {
0x95, 0x01, // Report Count (1)
0x75, 0x10, // Report Size (16)
0x81, 0x00, // Input (Data, Array, Absolute)
- 0xC0 // End Collection
+ 0xC0, // End Collection
+#endif
+
+#ifdef DIGITIZER_ENABLE
+ // Digitizer report descriptor
+ 0x05, 0x0D, // Usage Page (Digitizers)
+ 0x09, 0x01, // Usage (Digitizer)
+ 0xA1, 0x01, // Collection (Application)
+ 0x85, REPORT_ID_DIGITIZER, // Report ID
+ 0x09, 0x22, // Usage (Finger)
+ 0xA1, 0x00, // Collection (Physical)
+ // Tip Switch (1 bit)
+ 0x09, 0x42, // Usage (Tip Switch)
+ 0x15, 0x00, // Logical Minimum
+ 0x25, 0x01, // Logical Maximum
+ 0x95, 0x01, // Report Count (1)
+ 0x75, 0x01, // Report Size (16)
+ 0x81, 0x02, // Input (Data, Variable, Absolute)
+ // In Range (1 bit)
+ 0x09, 0x32, // Usage (In Range)
+ 0x81, 0x02, // Input (Data, Variable, Absolute)
+ // Padding (6 bits)
+ 0x95, 0x06, // Report Count (6)
+ 0x81, 0x03, // Input (Constant)
+
+ // X/Y Position (4 bytes)
+ 0x05, 0x01, // Usage Page (Generic Desktop)
+ 0x26, 0xFF, 0x7F, // Logical Maximum (32767)
+ 0x95, 0x01, // Report Count (1)
+ 0x75, 0x10, // Report Size (16)
+ 0x65, 0x33, // Unit (Inch, English Linear)
+ 0x55, 0x0E, // Unit Exponent (-2)
+ 0x09, 0x30, // Usage (X)
+ 0x81, 0x02, // Input (Data, Variable, Absolute)
+ 0x09, 0x31, // Usage (Y)
+ 0x81, 0x02, // Input (Data, Variable, Absolute)
+ 0xC0, // End Collection
+ 0xC0 // End Collection
#endif
+
#ifdef SHARED_EP_ENABLE
};
#endif
@@ -598,10 +645,10 @@ const PROGMEM usbStringDescriptor_t usbStringDescriptorProduct = {
#if defined(SERIAL_NUMBER)
const PROGMEM usbStringDescriptor_t usbStringDescriptorSerial = {
.header = {
- .bLength = USB_STRING_LEN(sizeof(STR(SERIAL_NUMBER)) - 1),
+ .bLength = USB_STRING_LEN(sizeof(SERIAL_NUMBER) - 1),
.bDescriptorType = USBDESCR_STRING
},
- .bString = LSTR(SERIAL_NUMBER)
+ .bString = USBSTR(SERIAL_NUMBER)
};
#endif