Skip to content

Commit

Permalink
customizable report size
Browse files Browse the repository at this point in the history
  • Loading branch information
zzeneg committed Dec 25, 2024
1 parent 3b76595 commit df890e3
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
8 changes: 6 additions & 2 deletions Kconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
config RAW_HID
bool "Enable Raw HID"
depends on !ZMK_SPLIT || ZMK_SPLIT_ROLE_CENTRAL
default n
imply USB_DEVICE_HID

config RAW_HID_USAGE_PAGE
hex "Raw HID Usage Page"
Expand All @@ -11,6 +11,10 @@ config RAW_HID_USAGE
hex "Raw HID Usage"
default 0x61

config RAW_HID_REPORT_SIZE
int "Raw HID Report Size"
default 32

config RAW_HID_DEVICE
string "Raw HID Device"
default HID_1
default HID_1
3 changes: 0 additions & 3 deletions boards/shields/raw_hid_adapter/raw_hid_adapter.conf
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# enable Raw HID module
CONFIG_RAW_HID=y

# enable USB HID device
CONFIG_USB_DEVICE_HID=y

# add additional USB HID device
CONFIG_USB_HID_DEVICE_COUNT=2
4 changes: 2 additions & 2 deletions include/raw_hid/raw_hid.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ static const uint8_t raw_hid_report_desc[] = {
HID_LOGICAL_MIN8(0x00),
HID_LOGICAL_MAX16(0xFF, 0x00),
HID_REPORT_SIZE(0x08),
HID_REPORT_COUNT(32),
HID_REPORT_COUNT(CONFIG_RAW_HID_REPORT_SIZE),

HID_USAGE(0x01),
HID_INPUT(ZMK_HID_MAIN_VAL_DATA | ZMK_HID_MAIN_VAL_VAR | ZMK_HID_MAIN_VAL_ABS),
Expand All @@ -30,4 +30,4 @@ static const uint8_t raw_hid_report_desc[] = {
HID_END_COLLECTION,
};

void process_raw_hid_data(uint8_t *data, uint8_t length);
void process_raw_hid_data(uint8_t *data);
2 changes: 1 addition & 1 deletion src/hog.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static ssize_t write_hids_raw_hid_report(struct bt_conn *conn, const struct bt_g
}

uint8_t *data = (uint8_t *)buf;
process_raw_hid_data(data, len);
process_raw_hid_data(data);

return len;
}
Expand Down
4 changes: 2 additions & 2 deletions src/raw_hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include <zephyr/logging/log.h>
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);

__attribute__((weak)) void process_raw_hid_data(uint8_t *data, uint8_t length) {
LOG_WRN("display_process_raw_hid_data is not overriden");
__attribute__((weak)) void process_raw_hid_data(uint8_t *data) {
LOG_WRN("process_raw_hid_data is not overriden");

return;
}
2 changes: 1 addition & 1 deletion src/usb_hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static int set_report_cb(const struct device *dev, struct usb_setup_packet *setu
return -ENOTSUP;
}

process_raw_hid_data(*data, *len);
process_raw_hid_data(*data);

return 0;
}
Expand Down

0 comments on commit df890e3

Please sign in to comment.