diff options
| author | hathach <[email protected]> | 2023-04-06 11:16:28 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2023-04-06 11:16:28 +0700 |
| commit | 6db24e0dbae248c865ec3ed0e5febcf341b489d4 (patch) | |
| tree | 1cd601cf1ea662c30ed31f2301e21d4e59f12622 /src/class/hid/hid_host.c | |
| parent | 106084289dec0146c117fad69925696b388509be (diff) | |
implement tuh_hid_receive_ready() and tuh_hid_send_ready()
Diffstat (limited to 'src/class/hid/hid_host.c')
| -rw-r--r-- | src/class/hid/hid_host.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/class/hid/hid_host.c b/src/class/hid/hid_host.c index a0032aeba..d95d3ef35 100644 --- a/src/class/hid/hid_host.c +++ b/src/class/hid/hid_host.c @@ -331,6 +331,15 @@ static bool _hidh_set_idle(uint8_t daddr, uint8_t itf_num, uint16_t idle_rate, t // Interrupt Endpoint API //--------------------------------------------------------------------+ +// Check if HID interface is ready to receive report +bool tuh_hid_receive_ready(uint8_t dev_addr, uint8_t idx) +{ + hidh_interface_t* p_hid = get_hid_itf(dev_addr, idx); + TU_VERIFY(p_hid); + + return !usbh_edpt_busy(dev_addr, p_hid->ep_in); +} + bool tuh_hid_receive_report(uint8_t daddr, uint8_t idx) { hidh_interface_t* p_hid = get_hid_itf(daddr, idx); @@ -348,13 +357,13 @@ bool tuh_hid_receive_report(uint8_t daddr, uint8_t idx) return true; } -//bool tuh_n_hid_n_ready(uint8_t dev_addr, uint8_t instance) -//{ -// TU_VERIFY(tuh_n_hid_n_mounted(dev_addr, instance)); -// -// hidh_interface_t* hid_itf = get_instance(dev_addr, instance); -// return !usbh_edpt_busy(dev_addr, hid_itf->ep_in); -//} +bool tuh_hid_send_ready(uint8_t dev_addr, uint8_t idx) +{ + hidh_interface_t* p_hid = get_hid_itf(dev_addr, idx); + TU_VERIFY(p_hid); + + return !usbh_edpt_busy(dev_addr, p_hid->ep_out); +} bool tuh_hid_send_report(uint8_t daddr, uint8_t idx, uint8_t report_id, const void* report, uint16_t len) { |
