M471M/R1/S BSP V3.01.000
The Board Support Package for M4521
hid_core.c
Go to the documentation of this file.
1/**************************************************************************/
9#include <stdio.h>
10#include <string.h>
11#include <stdlib.h>
12
13#include "NuMicro.h"
14
15#include "usb.h"
16#include "usbh_lib.h"
17#include "usbh_hid.h"
18
19
21
22HID_MOUSE_FUNC *_mouse_callback = NULL;
23HID_KEYBOARD_FUNC *_keyboard_callback = NULL;
24
25#include "hid_parser.c"
26
27#define USB_CTRL_TIMEOUT_MS 100
28
29
30static int get_free_utr_slot(HID_DEV_T *hdev)
31{
32 int i;
33
34 for(i = 0; i < CONFIG_HID_DEV_MAX_PIPE; i++)
35 {
36 if(hdev->utr_list[i] == NULL)
37 return i;
38 }
39 return -1;
40}
41
42
44
45
55int32_t usbh_hid_get_report_descriptor(HID_DEV_T *hdev, uint8_t *desc_buf, int buf_max_len)
56{
57 IFACE_T *iface;
58 uint32_t xfer_len;
59 int ret;
60
61 if(buf_max_len < 9)
63
64 if(!hdev || !hdev->iface)
65 return USBH_ERR_NOT_FOUND;
66
67 iface = (IFACE_T *)hdev->iface;
68
69 ret = usbh_ctrl_xfer(iface->udev,
70 REQ_TYPE_IN | REQ_TYPE_STD_DEV | REQ_TYPE_TO_IFACE, /* bmRequestType */
71 USB_REQ_GET_DESCRIPTOR, /* bRequest */
72 (USB_DT_REPORT << 8) + 0, /* wValue */
73 iface->if_num, /* wIndex */
74 buf_max_len, /* wLength */
75 desc_buf, &xfer_len, USB_CTRL_TIMEOUT_MS);
76
77 if((ret < 0) || (xfer_len == 0))
78 {
79 HID_DBGMSG("failed to get HID descriptor.\n");
80 return HID_RET_IO_ERR;
81 }
82 return (int)xfer_len;
83}
84
85
101int32_t usbh_hid_get_report(HID_DEV_T *hdev, int rtp_typ, int rtp_id,
102 uint8_t *data, int len)
103{
104 IFACE_T *iface;
105 uint32_t xfer_len;
106 int ret;
107
108 if(!hdev || !hdev->iface)
109 return USBH_ERR_NOT_FOUND;
110
111 iface = (IFACE_T *)hdev->iface;
112
113 ret = usbh_ctrl_xfer(iface->udev,
114 REQ_TYPE_IN | REQ_TYPE_CLASS_DEV | REQ_TYPE_TO_IFACE, /* bmRequestType */
115 HID_REPORT_GET, /* bRequest */
116 rtp_id + (rtp_typ << 8), /* wValue */
117 iface->if_num, /* wIndex */
118 len, /* wLength */
119 data, &xfer_len, USB_CTRL_TIMEOUT_MS);
120 if(ret < 0)
121 {
122 HID_DBGMSG("failed to get report!\n");
123 return HID_RET_IO_ERR;
124 }
125 return (int)xfer_len;
126}
127
128
146int32_t usbh_hid_set_report(HID_DEV_T *hdev, int rtp_typ, int rtp_id,
147 uint8_t *data, int len)
148{
149 IFACE_T *iface;
150 uint32_t xfer_len;
151 int ret;
152
153 if(!hdev || !hdev->iface)
154 return USBH_ERR_NOT_FOUND;
155
156 iface = (IFACE_T *)hdev->iface;
157
158 ret = usbh_ctrl_xfer(iface->udev,
159 REQ_TYPE_OUT | REQ_TYPE_CLASS_DEV | REQ_TYPE_TO_IFACE, /* bmRequestType */
160 HID_REPORT_SET, /* bRequest */
161 rtp_id + (rtp_typ << 8), /* wValue */
162 iface->if_num, /* wIndex */
163 len, /* wLength */
164 data, &xfer_len, USB_CTRL_TIMEOUT_MS);
165 if(ret < 0)
166 {
167 HID_DBGMSG("failed to set report!\n");
168 return HID_RET_IO_ERR;
169 }
170 return (int)xfer_len;
171}
172
173
175
176static void led_ctrl_irq(UTR_T *utr)
177{
178 // HID_DBGMSG("Set LED control xfer done.\n");
179 utr->bIsTransferDone = 1;
180}
181
182int32_t usbh_hid_set_report_non_blocking(HID_DEV_T *hdev, int rtp_typ, int rtp_id,
183 uint8_t *data, int len)
184{
185 IFACE_T *iface;
186 UTR_T *utr;
187 int status;
188
189 if(!hdev || !hdev->iface)
190 return USBH_ERR_NOT_FOUND;
191
192 iface = (IFACE_T *)hdev->iface;
193
194 utr = hdev->rpd.utr_led;
195 if(utr == NULL)
196 {
197 utr = alloc_utr(iface->udev);
198 if(utr == NULL)
199 return USBH_ERR_MEMORY_OUT;
200 hdev->rpd.utr_led = utr;
201 }
202 else
203 {
204 if(utr->bIsTransferDone == 0)
205 return HID_RET_IO_ERR; /* unlikely! the last LED control trnasfer is not completed */
206 }
207
208 utr->setup.bmRequestType = REQ_TYPE_OUT | REQ_TYPE_CLASS_DEV | REQ_TYPE_TO_IFACE;
209 utr->setup.bRequest = HID_REPORT_SET;
210 utr->setup.wValue = rtp_id + (rtp_typ << 8);
211 utr->setup.wIndex = iface->if_num;
212 utr->setup.wLength = len;
213
214 utr->buff = data;
215 utr->data_len = len;
216 utr->func = led_ctrl_irq;
217 utr->bIsTransferDone = 0;
218
219 status = iface->udev->hc_driver->ctrl_xfer(utr);
220 if(status < 0)
221 {
222 iface->udev->ep0.hw_pipe = NULL;
223 return status;
224 }
225 return 0;
226}
227
229
230
242int32_t usbh_hid_get_idle(HID_DEV_T *hdev, int rtp_id, uint8_t *idle_rate)
243{
244 IFACE_T *iface;
245 uint32_t xfer_len;
246 int ret;
247
248 if(!hdev || !hdev->iface)
249 return USBH_ERR_NOT_FOUND;
250
251 iface = (IFACE_T *)hdev->iface;
252
253 ret = usbh_ctrl_xfer(iface->udev,
254 REQ_TYPE_IN | REQ_TYPE_CLASS_DEV | REQ_TYPE_TO_IFACE, /* bmRequestType */
255 HID_GET_IDLE, /* bRequest */
256 rtp_id, /* wValue */
257 iface->if_num, /* wIndex */
258 1, /* wLength */
259 idle_rate, &xfer_len, USB_CTRL_TIMEOUT_MS);
260
261 if((ret < 0) || (xfer_len != 1))
262 {
263 HID_DBGMSG("failed to get idle rate! %d\n", ret);
264 return HID_RET_IO_ERR;
265 }
266 return HID_RET_OK;
267}
268
269
282int32_t usbh_hid_set_idle(HID_DEV_T *hdev, int rtp_id, uint8_t idle_rate)
283{
284 IFACE_T *iface;
285 uint32_t xfer_len;
286 uint16_t wValue = idle_rate;
287 int ret;
288
289 if(!hdev || !hdev->iface)
290 return USBH_ERR_NOT_FOUND;
291
292 iface = (IFACE_T *)hdev->iface;
293
294 ret = usbh_ctrl_xfer(iface->udev,
295 REQ_TYPE_OUT | REQ_TYPE_CLASS_DEV | REQ_TYPE_TO_IFACE, /* bmRequestType */
296 HID_SET_IDLE, /* bRequest */
297 rtp_id + (wValue << 8), /* wValue */
298 iface->if_num, /* wIndex */
299 0, /* wLength */
300 NULL, &xfer_len, USB_CTRL_TIMEOUT_MS);
301
302 if(ret < 0)
303 {
304 HID_DBGMSG("failed to set idle rate! %d\n", ret);
305 return HID_RET_IO_ERR;
306 }
307 return HID_RET_OK;
308}
309
310
322int32_t usbh_hid_get_protocol(HID_DEV_T *hdev, uint8_t *protocol)
323{
324 IFACE_T *iface;
325 uint32_t xfer_len;
326 int ret;
327
328 if(!hdev || !hdev->iface)
329 return USBH_ERR_NOT_FOUND;
330
331 iface = (IFACE_T *)hdev->iface;
332
333 ret = usbh_ctrl_xfer(iface->udev,
334 REQ_TYPE_IN | REQ_TYPE_CLASS_DEV | REQ_TYPE_TO_IFACE, /* bmRequestType */
335 HID_GET_PROTOCOL, /* bRequest */
336 0, /* wValue */
337 iface->if_num, /* wIndex */
338 1, /* wLength */
339 protocol, &xfer_len, USB_CTRL_TIMEOUT_MS);
340
341 if((ret < 0) || (xfer_len != 1))
342 {
343 HID_DBGMSG("failed to get idle rate! %d\n", ret);
344 return HID_RET_IO_ERR;
345 }
346 return HID_RET_OK;
347}
348
349
361int32_t usbh_hid_set_protocol(HID_DEV_T *hdev, uint8_t protocol)
362{
363 IFACE_T *iface;
364 uint32_t xfer_len;
365 int ret;
366
367 if(!hdev || !hdev->iface)
368 return USBH_ERR_NOT_FOUND;
369
370 iface = (IFACE_T *)hdev->iface;
371
372 ret = usbh_ctrl_xfer(iface->udev,
373 REQ_TYPE_OUT | REQ_TYPE_CLASS_DEV | REQ_TYPE_TO_IFACE, /* bmRequestType */
374 HID_SET_PROTOCOL, /* bRequest */
375 protocol, /* wValue */
376 iface->if_num, /* wIndex */
377 0, /* wLength */
378 NULL, &xfer_len, USB_CTRL_TIMEOUT_MS);
379
380 if(ret < 0)
381 {
382 HID_DBGMSG("failed to set idle rate! %d\n", ret);
383 return HID_RET_IO_ERR;
384 }
385 return HID_RET_OK;
386}
387
388
390
391
392/*
393 * HID int-in complete function
394 */
395static void hid_read_irq(UTR_T *utr)
396{
397 HID_DEV_T *hdev;
398 int ret;
399
400 //HID_DBGMSG("hid_read_irq. %d\n", utr->xfer_len);
401
402 hdev = (HID_DEV_T *)utr->context;
403
404 if(utr->status != 0)
405 {
406 HID_DBGMSG("hid_read_irq - has error: 0x%x\n", utr->status);
407 if(hdev->read_func)
408 hdev->read_func(hdev, utr->ep->bEndpointAddress, utr->status, utr->buff, 0);
409 return;
410 }
411
412 if(hdev->bSubClassCode == HID_SUBCLASS_BOOT_DEVICE)
413 {
414 if(hdev->bProtocolCode == HID_PROTOCOL_MOUSE)
415 hid_parse_mouse_reports(hdev, utr->buff, utr->xfer_len);
416
417 if(hdev->bProtocolCode == HID_PROTOCOL_KEYBOARD)
418 hid_parse_keyboard_reports(hdev, utr->buff, utr->xfer_len);
419 }
420
421 if(hdev->read_func && utr->xfer_len)
422 hdev->read_func(hdev, utr->ep->bEndpointAddress, utr->status, utr->buff, utr->xfer_len);
423
424 utr->xfer_len = 0;
425 ret = usbh_int_xfer(utr);
426 if(ret)
427 {
428 HID_DBGMSG("hid_read_irq - failed to submit interrupt-in request (%d)", ret);
429 if(hdev->read_func)
430 hdev->read_func(hdev, utr->ep->bEndpointAddress, ret, utr->buff, 0);
431 usbh_free_mem(utr->buff, utr->data_len);
432 free_utr(utr);
433 }
434}
435
436/*
437 * HID int-out complete function
438 */
439static void hid_write_irq(UTR_T *utr)
440{
441 HID_DEV_T *hdev;
442 int ret;
443
444 //HID_DBGMSG("hid_write_irq. %d\n", urb->actual_length);
445
446 hdev = (HID_DEV_T *)utr->context;
447
448 if(utr->status)
449 {
450 HID_DBGMSG("hid_write_irq - has error: 0x%x\n", utr->status);
451 hdev->write_func(hdev, utr->ep->bEndpointAddress, utr->status, utr->buff, &(utr->data_len));
452 return;
453 }
454
455 if(hdev->write_func)
456 {
457 utr->data_len = utr->ep->wMaxPacketSize;
458 hdev->write_func(hdev, utr->ep->bEndpointAddress, utr->status, utr->buff, &(utr->data_len));
459 }
460
461 utr->xfer_len = 0;
462 ret = usbh_int_xfer(utr);
463 if(ret)
464 {
465 HID_DBGMSG("hid_write_irq - failed to submit interrupt-out request (%d)", ret);
466 hdev->write_func(hdev, utr->ep->bEndpointAddress, ret, utr->buff, &(utr->data_len));
467 free_utr(utr);
468 }
469}
470
471
473
484int32_t usbh_hid_start_int_read(HID_DEV_T *hdev, uint8_t ep_addr, HID_IR_FUNC *func)
485{
486 IFACE_T *iface = (IFACE_T *)hdev->iface;
487 UTR_T *utr;
488 EP_INFO_T *ep;
489 int i, ret;
490
491 if((!iface) || (!iface->udev))
493
494 if(!func)
496
497 for(i = 0; i < CONFIG_HID_DEV_MAX_PIPE; i++)
498 {
499 utr = hdev->utr_list[i];
500 if((utr != NULL) && (utr->ep != NULL) && (utr->ep->bEndpointAddress == ep_addr))
501 {
502 return HID_RET_XFER_IS_RUNNING; /* transfer of this pipe is running */
503 }
504 }
505
506 if(ep_addr == 0)
507 ep = usbh_iface_find_ep(iface, 0, EP_ADDR_DIR_IN | EP_ATTR_TT_INT);
508 else
509 ep = usbh_iface_find_ep(iface, ep_addr, 0);
510
511 if(ep == NULL)
513
514 utr = alloc_utr(iface->udev);
515 if(!utr)
516 return USBH_ERR_MEMORY_OUT;
517
518 utr->buff = usbh_alloc_mem(ep->wMaxPacketSize);
519 if(utr->buff == NULL)
520 {
521 free_utr(utr);
522 return USBH_ERR_MEMORY_OUT;
523 }
524
525 hdev->read_func = func;
526
527 utr->context = hdev;
528 utr->ep = ep;
529 utr->data_len = ep->wMaxPacketSize;
530 utr->xfer_len = 0;
531 utr->func = hid_read_irq;
532
533 ret = usbh_int_xfer(utr);
534 if(ret < 0)
535 {
536 HID_DBGMSG("Error - failed to submit interrupt read request (%d)", ret);
537 usbh_free_mem(utr->buff, utr->data_len);
538 free_utr(utr);
539 return HID_RET_IO_ERR;
540 }
541
542 i = get_free_utr_slot(hdev);
543 if(i < 0)
544 {
545 HID_DBGMSG("Error - No free HID slot!\n");
546 usbh_quit_utr(utr);
547 usbh_free_mem(utr->buff, utr->data_len);
548 free_utr(utr);
549 return USBH_ERR_MEMORY_OUT; /* no free UTR slot. */
550 }
551 else
552 {
553 hdev->utr_list[i] = utr;
554 }
555
556 return HID_RET_OK;
557}
558
568int32_t usbh_hid_stop_int_read(HID_DEV_T *hdev, uint8_t ep_addr)
569{
570 IFACE_T *iface = (IFACE_T *)hdev->iface;
571 UTR_T *utr;
572 int i, ret;
573
574 if((!iface) || (!iface->udev))
576
577 for(i = 0; i < CONFIG_HID_DEV_MAX_PIPE; i++)
578 {
579 utr = hdev->utr_list[i];
580 if(ep_addr == 0)
581 {
582 /* Find any running UTR whose endpoint direction is IN */
583 if((utr != NULL) && (utr->ep != NULL) &&
584 ((utr->ep->bEndpointAddress & EP_ADDR_DIR_MASK) == EP_ADDR_DIR_IN))
585 {
586 break;
587 }
588 }
589 else
590 {
591 /* Find any running UTR whose endpoint address is matched with ep_addr */
592 if((utr != NULL) && (utr->ep != NULL) && (utr->ep->bEndpointAddress == ep_addr))
593 {
594 break; /* UTR found */
595 }
596 }
597 utr = NULL;
598 }
599
600 if(utr == NULL)
602
603 hdev->utr_list[i] = NULL; /* remove it from HID UTR list */
604
605 ret = usbh_quit_utr(utr); /* force to stop the transfer */
606
607 usbh_free_mem(utr->buff, utr->ep->wMaxPacketSize);
608 free_utr(utr);
609
610 return ret;
611}
612
623int32_t usbh_hid_start_int_write(HID_DEV_T *hdev, uint8_t ep_addr, HID_IW_FUNC *func)
624{
625 IFACE_T *iface = (IFACE_T *)hdev->iface;
626 UTR_T *utr;
627 EP_INFO_T *ep;
628 int i, ret;
629
630 if((!iface) || (!iface->udev))
632
633 if(!func)
635
636 for(i = 0; i < CONFIG_HID_DEV_MAX_PIPE; i++)
637 {
638 utr = hdev->utr_list[i];
639 if((utr != NULL) && (utr->ep != NULL) && (utr->ep->bEndpointAddress == ep_addr))
640 {
641 return HID_RET_XFER_IS_RUNNING; /* transfer of this pipe is running */
642 }
643 }
644
645 if(ep_addr == 0)
646 ep = usbh_iface_find_ep(iface, 0, EP_ADDR_DIR_OUT | EP_ATTR_TT_INT);
647 else
648 ep = usbh_iface_find_ep(iface, ep_addr, 0);
649
650 if(ep == NULL)
652
653 utr = alloc_utr(iface->udev);
654 if(!utr)
655 return USBH_ERR_MEMORY_OUT;
656
657 utr->buff = usbh_alloc_mem(ep->wMaxPacketSize);
658 if(utr->buff == NULL)
659 {
660 free_utr(utr);
661 return USBH_ERR_MEMORY_OUT;
662 }
663
664 hdev->write_func = func;
665
666 utr->context = hdev;
667 utr->ep = ep;
668 utr->data_len = ep->wMaxPacketSize;
669 utr->xfer_len = 0;
670 utr->func = hid_write_irq;
671
672 /* first time interrupt write call-back to get first data packet */
673 func(hdev, ep->bEndpointAddress, 0, utr->buff, &(utr->data_len));
674
675 ret = usbh_int_xfer(utr);
676 if(ret < 0)
677 {
678 HID_DBGMSG("Error - failed to submit interrupt read request (%d)", ret);
679 free_utr(utr);
680 return HID_RET_IO_ERR;
681 }
682
683 i = get_free_utr_slot(hdev);
684 if(i < 0)
685 {
686 HID_DBGMSG("Error - No free HID slot!\n");
687 usbh_quit_utr(utr);
688 usbh_free_mem(utr->buff, utr->data_len);
689 free_utr(utr);
690 return USBH_ERR_MEMORY_OUT; /* no free UTR slot. */
691 }
692 else
693 {
694 hdev->utr_list[i] = utr;
695 }
696
697 return HID_RET_OK;
698}
699
709int32_t usbh_hid_stop_int_write(HID_DEV_T *hdev, uint8_t ep_addr)
710{
711 IFACE_T *iface = (IFACE_T *)hdev->iface;
712 UTR_T *utr;
713 int i, ret;
714
715 if((!iface) || (!iface->udev))
717
718 for(i = 0; i < CONFIG_HID_DEV_MAX_PIPE; i++)
719 {
720 utr = hdev->utr_list[i];
721 if(ep_addr == 0)
722 {
723 /* Find any running UTR whose endpoint direction is OUT */
724 if((utr != NULL) && (utr->ep != NULL) &&
725 ((utr->ep->bEndpointAddress & EP_ADDR_DIR_MASK) == EP_ADDR_DIR_OUT))
726 {
727 break;
728 }
729 }
730 else
731 {
732 /* Find any running UTR whose endpoint address is matched with ep_addr */
733 if((utr != NULL) && (utr->ep != NULL) && (utr->ep->bEndpointAddress == ep_addr))
734 {
735 break; /* UTR found */
736 }
737 }
738 utr = NULL;
739 }
740
741 if(utr == NULL)
743
744 hdev->utr_list[i] = NULL; /* remove it from HID UTR list */
745
746 ret = usbh_quit_utr(utr);
747
748 usbh_free_mem(utr->buff, utr->ep->wMaxPacketSize);
749 free_utr(utr);
750
751 return ret;
752}
753
762{
763 _mouse_callback = func;
764}
765
774{
775 _keyboard_callback = func;
776}
777
778
779
NuMicro peripheral access layer header file.
#define NULL
Definition: M471M_R1_S.h:13908
#define HID_RET_XFER_IS_RUNNING
Definition: usbh_lib.h:92
#define USBH_ERR_EP_NOT_FOUND
Definition: usbh_lib.h:39
#define HID_REPORT_GET
Definition: usbh_hid.h:155
#define HID_RET_IO_ERR
Definition: usbh_lib.h:86
#define HID_RET_DEV_NOT_FOUND
Definition: usbh_lib.h:85
#define HID_GET_IDLE
Definition: usbh_hid.h:156
#define HID_RET_INVALID_PARAMETER
Definition: usbh_lib.h:87
#define HID_REPORT_SET
Definition: usbh_hid.h:158
#define HID_RET_OK
Definition: usbh_lib.h:84
#define HID_GET_PROTOCOL
Definition: usbh_hid.h:157
#define HID_SET_PROTOCOL
Definition: usbh_hid.h:160
#define USBH_ERR_NOT_FOUND
Definition: usbh_lib.h:38
#define CONFIG_HID_DEV_MAX_PIPE
Definition: usbh_hid.h:52
#define USBH_ERR_MEMORY_OUT
Definition: usbh_lib.h:31
#define HID_SET_IDLE
Definition: usbh_hid.h:159
void usbh_hid_regitser_mouse_callback(HID_MOUSE_FUNC *func)
Register the mouse event callback function to HID class driver. Any mouse reports will be sent to use...
Definition: hid_core.c:761
void usbh_hid_regitser_keyboard_callback(HID_KEYBOARD_FUNC *func)
Register the keyboard event callback function to HID class driver. Any keyboard reports will be sent ...
Definition: hid_core.c:773
void() HID_KEYBOARD_FUNC(struct usbhid_dev *hdev, KEYBOARD_EVENT_T *kbd)
Definition: usbh_hid.h:313
void() HID_MOUSE_FUNC(struct usbhid_dev *hdev, MOUSE_EVENT_T *mouse)
Definition: usbh_hid.h:312
HIDDEN_SYMBOLS struct usbhid_dev HID_DEV_T
void() HID_IR_FUNC(struct usbhid_dev *hdev, uint16_t ep_addr, int status, uint8_t *rdata, uint32_t data_len)
Definition: usbh_lib.h:122
void() HID_IW_FUNC(struct usbhid_dev *hdev, uint16_t ep_addr, int status, uint8_t *wbuff, uint32_t *data_len)
Definition: usbh_lib.h:123
int32_t usbh_hid_stop_int_write(HID_DEV_T *hdev, uint8_t ep_addr)
stop purge the USB interrupt out transfer.
Definition: hid_core.c:709
int32_t usbh_hid_set_protocol(HID_DEV_T *hdev, uint8_t protocol)
Issue a HID class SET_PROTOCOL request. The SET_PROTOCOL switches between the boot protocol and the r...
Definition: hid_core.c:361
int32_t usbh_hid_stop_int_read(HID_DEV_T *hdev, uint8_t ep_addr)
Stop purge the USB interrupt in transfer.
Definition: hid_core.c:568
int32_t usbh_hid_set_report(HID_DEV_T *hdev, int rtp_typ, int rtp_id, uint8_t *data, int len)
Issue a HID class SET_REPORT request. The Set_Report request allows the host to send a report to the ...
Definition: hid_core.c:146
int32_t usbh_hid_get_report(HID_DEV_T *hdev, int rtp_typ, int rtp_id, uint8_t *data, int len)
Issue a HID class GET_REPORT request.
Definition: hid_core.c:101
HIDDEN_SYMBOLS int32_t usbh_hid_start_int_read(HID_DEV_T *hdev, uint8_t ep_addr, HID_IR_FUNC *func)
Start purge the USB interrupt in transfer.
Definition: hid_core.c:484
int32_t usbh_hid_get_report_descriptor(HID_DEV_T *hdev, uint8_t *desc_buf, int buf_max_len)
Read report descriptor from HID device.
Definition: hid_core.c:55
int32_t usbh_hid_set_idle(HID_DEV_T *hdev, int rtp_id, uint8_t idle_rate)
Issue a HID class SET_IDLE request. The SET_IDLE request silences a particular report on the Interrup...
Definition: hid_core.c:282
int32_t usbh_hid_get_protocol(HID_DEV_T *hdev, uint8_t *protocol)
Issue a HID class GET_PROTOCOL request. The GET_PROTOCOL request reads which protocol is currently ac...
Definition: hid_core.c:322
HIDDEN_SYMBOLS int32_t usbh_hid_get_idle(HID_DEV_T *hdev, int rtp_id, uint8_t *idle_rate)
Issue a HID class GET_IDLE request. The GET_IDLE request reads the current idle rate for a particular...
Definition: hid_core.c:242
int32_t usbh_hid_start_int_write(HID_DEV_T *hdev, uint8_t ep_addr, HID_IW_FUNC *func)
Start purge the USB interrupt out transfer.
Definition: hid_core.c:623
M471M/R1/S MCU USB Host HID report descriptor parser.
USB Host library header file.
USB Host HID class driver header file.
USB Host library exported header file.