Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
USB Device Interface (UDI) for Human Interface Device Generic (HID Generic)

USB Device Interface (UDI) for Human Interface Device generic (HID generic) provides an interface for the configuration and management of USB HID generic device.

The outline of this documentation is as follows:

For more details for Atmel® Software Framework (ASF) USB Device Stack and USB Device HID generic, refer to following application notes:

API Overview

Data Structures

struct  udi_hid_generic_desc_t
 Interface descriptor structure for HID generic. More...
 
struct  udi_hid_generic_report_desc_t
 Report descriptor for HID generic. More...
 

Interface with USB Device Core (UDC)

Structure required by UDC.

UDC_DESC_STORAGE udi_api_t udi_api_hid_generic
 Global structure which contains standard UDI API for UDC. More...
 

USB Interface Descriptors

The following structures provide predefined USB interface descriptors.

It must be used to define the final USB descriptors.

#define UDI_HID_GENERIC_STRING_ID   0
 By default no string associated to this interface. More...
 
#define UDI_HID_GENERIC_DESC
 Content of HID generic interface descriptor for all speed. More...
 

USB Device Interface (UDI) for Human Interface Device (HID) Generic Class

Common APIs used by high level application to use this USB class.

bool udi_hid_generic_send_report_in (uint8_t *data)
 Routine used to send a report to USB Host. More...
 

#define UDI_HID_GENERIC_DESC
Value:
{\
.iface.bLength = sizeof(usb_iface_desc_t),\
.iface.bDescriptorType = USB_DT_INTERFACE,\
.iface.bInterfaceNumber = UDI_HID_GENERIC_IFACE_NUMBER,\
.iface.bAlternateSetting = 0,\
.iface.bNumEndpoints = 2,\
.iface.bInterfaceClass = HID_CLASS,\
.iface.bInterfaceSubClass = HID_SUB_CLASS_NOBOOT,\
.iface.bInterfaceProtocol = HID_PROTOCOL_GENERIC,\
.iface.iInterface = UDI_HID_GENERIC_STRING_ID,\
.hid.bLength = sizeof(usb_hid_descriptor_t),\
.hid.bDescriptorType = USB_DT_HID,\
.hid.bcdHID = LE16(USB_HID_BDC_V1_11),\
.hid.bCountryCode = USB_HID_NO_COUNTRY_CODE,\
.hid.bNumDescriptors = USB_HID_NUM_DESC,\
.hid.bRDescriptorType = USB_DT_HID_REPORT,\
.hid.wDescriptorLength = LE16(sizeof(udi_hid_generic_report_desc_t)),\
.ep_in.bLength = sizeof(usb_ep_desc_t),\
.ep_in.bDescriptorType = USB_DT_ENDPOINT,\
.ep_in.bEndpointAddress = UDI_HID_GENERIC_EP_IN,\
.ep_in.bmAttributes = USB_EP_TYPE_INTERRUPT,\
.ep_in.wMaxPacketSize = LE16(UDI_HID_GENERIC_EP_SIZE),\
.ep_in.bInterval = 4,\
.ep_out.bLength = sizeof(usb_ep_desc_t),\
.ep_out.bDescriptorType = USB_DT_ENDPOINT,\
.ep_out.bEndpointAddress = UDI_HID_GENERIC_EP_OUT,\
.ep_out.bmAttributes = USB_EP_TYPE_INTERRUPT,\
.ep_out.wMaxPacketSize = LE16(UDI_HID_GENERIC_EP_SIZE),\
.ep_out.bInterval = 4,\
}
Report descriptor for HID generic.
Definition: udi_hid_generic_doc.h:94
HID Descriptor.
Definition: usb_protocol_hid.h:116
#define UDI_HID_GENERIC_EP_IN
Definition: udi_hid_generic_conf.h:59
#define USB_HID_NUM_DESC
Numeric expression specifying the number of class descriptors Note: Always at least one i...
Definition: usb_protocol_hid.h:143
Definition: usb_protocol_hid.h:86
Definition: usb_protocol.h:194
#define HID_SUB_CLASS_NOBOOT
Interface subclass NO support BOOT protocol.
Definition: usb_protocol_hid.h:58
Definition: usb_protocol.h:193
#define HID_PROTOCOL_GENERIC
Protocol generic standard.
Definition: usb_protocol_hid.h:66
#define USB_HID_NO_COUNTRY_CODE
Definition: usb_protocol_hid.h:147
#define HID_CLASS
Definition: usb_protocol_hid.h:52
Standard USB interface descriptor structure.
Definition: usb_protocol.h:446
#define UDI_HID_GENERIC_STRING_ID
By default no string associated to this interface.
Definition: udi_hid_generic_doc.h:105
#define UDI_HID_GENERIC_EP_OUT
Endpoint number used by HID generic interface.
Definition: udi_hid_generic_conf.h:58
Definition: usb_protocol_hid.h:87
#define USB_HID_BDC_V1_11
Numeric expression identifying the HID Class Specification release (here V1.11)
Definition: usb_protocol_hid.h:140
Standard USB endpoint descriptor structure.
Definition: usb_protocol.h:461
#define LE16(x)
Definition: compiler.h:773
Definition: usb_protocol.h:252
#define UDI_HID_GENERIC_IFACE_NUMBER
Interface number.
Definition: udi_hid_generic_conf.h:62
#define UDI_HID_GENERIC_EP_SIZE
Sizes of I/O endpoints.
Definition: common/services/usb/class/hid/device/generic/example/conf_usb.h:119

Content of HID generic interface descriptor for all speed.

#define UDI_HID_GENERIC_STRING_ID   0

By default no string associated to this interface.

bool udi_hid_generic_send_report_in ( uint8_t *  data)

Routine used to send a report to USB Host.

Parameters
[in]dataPointer on the report to send (size = UDI_HID_REPORT_IN_SIZE)
Returns
1 if function was successfully done, otherwise 0.

UDC_DESC_STORAGE udi_api_t udi_api_hid_generic

Global structure which contains standard UDI API for UDC.

Global structure which contains standard UDI API for UDC.