remove report id from plover hid endpoint

This commit is contained in:
dnaq 2021-09-25 11:44:02 +02:00
parent 7103b01bc7
commit 957d30f398
4 changed files with 5 additions and 13 deletions

View file

@ -1,5 +1,4 @@
#pragma once
#define PLOVER_HID_SIMPLE_REPORT_SIZE 9
void plover_hid_update(uint8_t button, bool pressed);
void plover_hid_task(void);

View file

@ -215,12 +215,12 @@ static void raw_hid_task(void) {
#ifdef PLOVER_HID_ENABLE
static bool plover_hid_report_updated = false;
static uint8_t plover_hid_current_report[PLOVER_HID_SIMPLE_REPORT_SIZE] = {1, 0};
static uint8_t plover_hid_current_report[PLOVER_HID_EPSIZE] = {0};
void plover_hid_update(uint8_t button, bool pressed) {
if (pressed) {
plover_hid_current_report[1 + button/8] |= (1 << (7 - (button % 8)));
plover_hid_current_report[button/8] |= (1 << (7 - (button % 8)));
} else {
plover_hid_current_report[1 + button/8] &= ~(1 << (7 - (button % 8)));
plover_hid_current_report[button/8] &= ~(1 << (7 - (button % 8)));
}
plover_hid_report_updated = true;
}
@ -239,7 +239,7 @@ void plover_hid_task(void) {
if (Endpoint_IsINReady()) {
// Write data
Endpoint_Write_Stream_LE(plover_hid_current_report, PLOVER_HID_SIMPLE_REPORT_SIZE, NULL);
Endpoint_Write_Stream_LE(plover_hid_current_report, PLOVER_HID_EPSIZE, NULL);
// Finalize The stream transfer to send the last packet
Endpoint_ClearIN();
plover_hid_report_updated = false;

View file

@ -327,7 +327,6 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM PloverReport[] = {
0x06, 0x50, 0xff, // UsagePage (65360)
0x0a, 0x56, 0x4c, // Usage (19542)
0xa1, 0x02, // Collection (Logical)
0x85, 0x01, // ReportID (1)
0x25, 0x01, // LogicalMaximum (1)
0x75, 0x01, // ReportSize (1)
0x95, 0x40, // ReportCount (64)
@ -335,12 +334,6 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM PloverReport[] = {
0x19, 0x00, // UsageMinimum (Button(0))
0x29, 0x3f, // UsageMaximum (Button(63))
0x81, 0x02, // Input (Variable)
0x85, 0x02, // ReportID (2)
0x26, 0xff, 0x00, // LogicalMaximum (255)
0x75, 0x08, // ReportSize (8)
0x19, 0x00, // UsageMinimum (Button(0))
0x29, 0x3f, // UsageMaximum (Button(63))
0x81, 0x02, // Input (Variable)
0xc0, // EndCollection
};
#endif

View file

@ -318,7 +318,7 @@ enum usb_endpoints {
#define SHARED_EPSIZE 32
#define MOUSE_EPSIZE 8
#define RAW_EPSIZE 32
#define PLOVER_HID_EPSIZE 9
#define PLOVER_HID_EPSIZE 8
#define CONSOLE_EPSIZE 32
#define MIDI_STREAM_EPSIZE 64
#define CDC_NOTIFICATION_EPSIZE 8