![]() |
M480 BSP
V3.05.001
The Board Support Package for M480 Series
|
M480 USB Host HID driver. More...
#include <stdio.h>#include <string.h>#include <stdlib.h>#include "NuMicro.h"#include "usb.h"#include "usbh_lib.h"#include "usbh_hid.h"Go to the source code of this file.
Functions | |
| 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. More... | |
| 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. More... | |
| 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 device, possibly setting the state of input, output, or feature controls. More... | |
| 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 Input report. More... | |
| 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 Interrupt In pipe until a new event occurs or the specified amount of time passes. More... | |
| 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 active (either the boot protocol or the report protocol.) More... | |
| 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 report protocol (or vice versa). More... | |
| 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. More... | |
| int32_t | usbh_hid_stop_int_read (HID_DEV_T *hdev, uint8_t ep_addr) |
| Stop purge the USB interrupt in transfer. More... | |
| 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. More... | |
| int32_t | usbh_hid_stop_int_write (HID_DEV_T *hdev, uint8_t ep_addr) |
| stop purge the USB interrupt out transfer. More... | |
| 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 user application via this callback. More... | |
| 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 to user application via this callback. More... | |
M480 USB Host HID driver.
Definition in file hid_core.c.
| 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 Input report.
| [in] | hdev | HID device pointer |
| [in] | rtp_id | Report ID |
| [out] | idle_rate | An one byte buffer holds the reported idle rate. |
| 0 | Success |
| Otherwise | Failed |
Definition at line 243 of file hid_core.c.
| 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 active (either the boot protocol or the report protocol.)
| [in] | hdev | HID device pointer |
| [out] | protocol | An one byte buffer holds the protocol code. |
| 0 | Success |
| Otherwise | Failed |
Definition at line 323 of file hid_core.c.
| 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.
| [in] | hdev | HID device pointer |
| [in] | rtp_typ | Report type. Valid values are: |
| [in] | rtp_id | Report ID |
| [out] | data | Buffer to store data retrieved from this report ID. |
| [in] | len | Report length. |
| >=0 | The actual length of data obtained from this report ID. |
| Otherwise | Failed |
Definition at line 102 of file hid_core.c.
| 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.
| [in] | hdev | HID device pointer |
| [out] | desc_buf | Data buffer for report descriptor read from HID device. |
| [in] | buf_max_len | The maximum length of desc_buf. |
| <0 | Failed |
| Otherwise | Length of report descriptor read. |
Definition at line 56 of file hid_core.c.
| 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 Interrupt In pipe until a new event occurs or the specified amount of time passes.
| [in] | hdev | HID device |
| [in] | rtp_id | Report ID |
| [out] | idle_rate | The idle rate to be set. |
| 0 | Success |
| Otherwise | Failed |
Definition at line 283 of file hid_core.c.
| 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 report protocol (or vice versa).
| [in] | hdev | HID device pointer. |
| [in] | protocol | The protocol to be set. |
| 0 | Success |
| Otherwise | Failed |
Definition at line 362 of file hid_core.c.
| 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 device, possibly setting the state of input, output, or feature controls.
| [in] | hdev | HID device pointer |
| [in] | rtp_typ | Report type. Valid values are: |
| [in] | rtp_id | Report ID |
| [out] | data | Buffer store data to be send. |
| [in] | len | Report length. |
| >=0 | The actual length of data written to this report ID. |
| Otherwise | Failed |
Definition at line 147 of file hid_core.c.
| 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.
| [in] | hdev | HID device pointer. |
| [in] | ep_addr | Endpoint address. If ep_addr is 0, it will use the first found interrupt-in endpoint. If ep_addr is not 0, it will use the specified endpoint if found. |
| [in] | func | The interrupt in data receiver callback function. |
| 0 | Success |
| Otherwise | Failed |
Definition at line 485 of file hid_core.c.
| 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.
| [in] | hdev | HID device pointer. |
| [in] | ep_addr | Endpoint address. If ep_addr is 0, it will use the first found interrupt-out endpoint. If ep_addr is not 0, it will use the specified endpoint if found. |
| [in] | func | The interrupt in data transfer callback function. |
| 0 | Success |
| Otherwise | Failed |
Definition at line 614 of file hid_core.c.
| int32_t usbh_hid_stop_int_read | ( | HID_DEV_T * | hdev, |
| uint8_t | ep_addr | ||
| ) |
Stop purge the USB interrupt in transfer.
| [in] | hdev | HID device pointer |
| [in] | ep_addr | Endpoint address. If ep_addr is 0, it will use the first found interrupt-in endpoint. If ep_addr is not 0, it will use the specified endpoint if found. |
| 0 | Success |
| Otherwise | Failed |
Definition at line 559 of file hid_core.c.
| int32_t usbh_hid_stop_int_write | ( | HID_DEV_T * | hdev, |
| uint8_t | ep_addr | ||
| ) |
stop purge the USB interrupt out transfer.
| [in] | hdev | HID device pointer |
| [in] | ep_addr | Endpoint address. If ep_addr is 0, it will use the first found interrupt-out endpoint. If ep_addr is not 0, it will use the specified endpoint if found. |
| 0 | Success |
| Otherwise | Failed |
Definition at line 691 of file hid_core.c.
1.8.15