Merge 9ecacd47e2
into 92e7618346
This commit is contained in:
commit
32f537d238
4 changed files with 56 additions and 0 deletions
|
@ -541,6 +541,10 @@ choice CBPRINTF_IMPLEMENTATION
|
|||
|
||||
endchoice
|
||||
|
||||
config ZMK_USB_REPORT_LEDS
|
||||
bool "Enable usb report leds"
|
||||
select ENABLE_HID_INT_OUT_EP
|
||||
|
||||
module = ZMK
|
||||
module-str = zmk
|
||||
source "subsys/logging/Kconfig.template.log_config"
|
||||
|
|
|
@ -183,6 +183,41 @@ static const uint8_t zmk_hid_report_desc[] = {
|
|||
CONFIG_ZMK_HID_CONSUMER_REPORT_SIZE,
|
||||
HID_MI_INPUT,
|
||||
0x00,
|
||||
|
||||
#ifdef CONFIG_ZMK_USB_REPORT_LEDS
|
||||
/* LED */
|
||||
0x85,
|
||||
0x01,
|
||||
/* REPORT_COUNT (5) */
|
||||
HID_GI_REPORT_COUNT,
|
||||
0x05,
|
||||
/* REPORT_SIZE (1) */
|
||||
HID_GI_REPORT_SIZE,
|
||||
0x01,
|
||||
/* USAGE_PAGE (Page# for LEDs) */
|
||||
HID_GI_USAGE_PAGE,
|
||||
0x08,
|
||||
/* USAGE_MINIMUM (1) */
|
||||
0x19,
|
||||
0x01,
|
||||
/* USAGE_MAXIMUM (5) */
|
||||
0x29,
|
||||
0x05,
|
||||
/* OUTPUT (Data, Variable, Absolute), */
|
||||
HID_MI_OUTPUT,
|
||||
0x02,
|
||||
/* LED REPORT */
|
||||
/* REPORT_COUNT (1) */
|
||||
HID_GI_REPORT_COUNT,
|
||||
0x01,
|
||||
/* REPORT_SIZE (3) */
|
||||
HID_GI_REPORT_SIZE,
|
||||
0x03,
|
||||
/* OUTPUT (Data, Variable, Absolute), */
|
||||
HID_MI_OUTPUT,
|
||||
0x01,
|
||||
#endif /* CONFIG_ZMK_USB_REPORT_LEDS */
|
||||
|
||||
/* END COLLECTION */
|
||||
HID_MI_COLLECTION_END,
|
||||
};
|
||||
|
|
|
@ -26,4 +26,7 @@ static inline bool zmk_usb_is_hid_ready() { return zmk_usb_get_conn_state() == Z
|
|||
|
||||
#ifdef CONFIG_ZMK_USB
|
||||
int zmk_usb_hid_send_report(const uint8_t *report, size_t len);
|
||||
#ifdef CONFIG_ZMK_USB_REPORT_LEDS
|
||||
int zmk_usb_hid_receive_report(uint8_t *report, size_t len);
|
||||
#endif /* CONFIG_ZMK_USB_REPORT_LEDS */
|
||||
#endif /* CONFIG_ZMK_USB */
|
|
@ -59,6 +59,20 @@ int zmk_usb_hid_send_report(const uint8_t *report, size_t len) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ZMK_USB_REPORT_LEDS
|
||||
|
||||
int zmk_usb_hid_receive_report(uint8_t *report, size_t len) {
|
||||
int err = hid_int_ep_read(hid_dev, report, len, NULL);
|
||||
|
||||
if (err) {
|
||||
LOG_ERR("Error receive report %d", err);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ZMK_USB_REPORT_LEDS */
|
||||
|
||||
#endif /* CONFIG_ZMK_USB */
|
||||
|
||||
enum usb_dc_status_code zmk_usb_get_status() { return usb_status; }
|
||||
|
|
Loading…
Add table
Reference in a new issue