Skip to content

Commit

Permalink
adjusted nkro report size, it now works
Browse files Browse the repository at this point in the history
  • Loading branch information
carlossless committed Dec 30, 2024
1 parent 90aeb6c commit edb498d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
2 changes: 0 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ void main()
{
init();

delay_ms(1000); // perhaps clocks are unstable at this point? influences UART

dprintf("SMK v" TOSTRING(SMK_VERSION) "\r\n");
dprintf("DEVICE vId:" TOSTRING(USB_VID) " pId:" TOSTRING(USB_PID) "\n\r");

Expand Down
18 changes: 14 additions & 4 deletions src/platform/sh68f90a/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,16 @@ const uint8_t hid_report_desc_extra[] = {
HID_RI_COLLECTION(8, 0x01), // Application
HID_RI_REPORT_ID(8, REPORT_ID_NKRO),
// Modifiers (8 bits)
HID_RI_USAGE_PAGE(8, 0x07), // Keyboard/Keypad
HID_RI_USAGE_MINIMUM(8, 0xe0), // Keyboard Left Control
HID_RI_USAGE_MAXIMUM(8, 0xe7), // Keyboard Right Gui
HID_RI_LOGICAL_MINIMUM(8, 0x00),
HID_RI_LOGICAL_MAXIMUM(8, 0x01),
HID_RI_REPORT_SIZE(8, 0x01),
HID_RI_REPORT_COUNT(8, 0x08),
HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE),

// NKRO
HID_RI_USAGE_PAGE(8, 0x07), // Keyboard/Keypad
HID_RI_USAGE_MINIMUM(8, 0x00), // was 0x04
HID_RI_USAGE_MAXIMUM(8, NKRO_REPORT_BITS * 8 - 1), // was 0x70
Expand Down Expand Up @@ -369,9 +379,9 @@ void usb_send_nkro(report_nkro_t *report)
timeout++;
}

set_ep2_in_buffer(report->raw, sizeof(report_nkro_t));
set_ep2_in_buffer(report->raw, NKRO_REPORT_SIZE);

SET_EP2_CNT(sizeof(report_nkro_t));
SET_EP2_CNT(NKRO_REPORT_SIZE);
SET_EP2_IN_RDY;
}

Expand All @@ -383,9 +393,9 @@ void usb_send_extra(report_extra_t *report)
timeout++;
}

set_ep2_in_buffer(report->raw, sizeof(report_extra_t));
set_ep2_in_buffer(report->raw, EXTRA_REPORT_SIZE);

SET_EP2_CNT(sizeof(report_extra_t));
SET_EP2_CNT(EXTRA_REPORT_SIZE);
SET_EP2_IN_RDY;
}

Expand Down
2 changes: 1 addition & 1 deletion src/smk/report.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void send_6kro_report()
#ifdef NKRO_ENABLE
void send_nkro_report()
{
nkro_report.report_id = REPORT_ID_NKRO; // TODO: set this once
nkro_report.report_id = REPORT_ID_NKRO; // TODO: set this more permanently
nkro_report.mods = real_mods;
nkro_report.mods |= weak_mods;

Expand Down
2 changes: 1 addition & 1 deletion src/smk/report.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#define KEYBOARD_REPORT_SIZE 8
#define KEYBOARD_REPORT_KEYS 6

#define NKRO_REPORT_BITS 13
#define NKRO_REPORT_SIZE 2 + NKRO_REPORT_BITS
#define NKRO_REPORT_BITS 30

#define EXTRA_REPORT_SIZE 3

Expand Down

0 comments on commit edb498d

Please sign in to comment.