Position of fuction in file and remove sem_take
This commit is contained in:
parent
866c9dd96e
commit
9ecacd47e2
1 changed files with 14 additions and 16 deletions
|
@ -38,22 +38,6 @@ static const struct hid_ops ops = {
|
||||||
.int_in_ready = in_ready_cb,
|
.int_in_ready = in_ready_cb,
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_ZMK_USB_REPORT_LEDS
|
|
||||||
|
|
||||||
int zmk_usb_hid_receive_report(uint8_t *report, size_t len) {
|
|
||||||
k_sem_take(&hid_sem, K_MSEC(30));
|
|
||||||
int err = hid_int_ep_read(hid_dev, report, len, NULL);
|
|
||||||
|
|
||||||
if (err) {
|
|
||||||
k_sem_give(&hid_sem);
|
|
||||||
LOG_ERR("Error receive report %d", err);
|
|
||||||
}
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* CONFIG_ZMK_USB_REPORT_LEDS */
|
|
||||||
|
|
||||||
int zmk_usb_hid_send_report(const uint8_t *report, size_t len) {
|
int zmk_usb_hid_send_report(const uint8_t *report, size_t len) {
|
||||||
switch (usb_status) {
|
switch (usb_status) {
|
||||||
case USB_DC_SUSPEND:
|
case USB_DC_SUSPEND:
|
||||||
|
@ -75,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 */
|
#endif /* CONFIG_ZMK_USB */
|
||||||
|
|
||||||
enum usb_dc_status_code zmk_usb_get_status() { return usb_status; }
|
enum usb_dc_status_code zmk_usb_get_status() { return usb_status; }
|
||||||
|
|
Loading…
Add table
Reference in a new issue