X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fdrv%2Fusb_hid.h;fp=bertos%2Fdrv%2Fusb_hid.h;h=0253809d3fa85163c8a676625deb8a433cc4b5c1;hb=7ea880172d48dd62a799e49e34b8fc1a4ecb82f5;hp=0000000000000000000000000000000000000000;hpb=6ddebfbb0e36bb5e68c9364cafca25340e0be191;p=bertos.git diff --git a/bertos/drv/usb_hid.h b/bertos/drv/usb_hid.h new file mode 100644 index 00000000..0253809d --- /dev/null +++ b/bertos/drv/usb_hid.h @@ -0,0 +1,79 @@ +/** + * \file + * + * + * \author Andrea Righi + * + * \brief Generic USB Human Interface Device (HID) driver. + */ + +#ifndef USB_HID_H +#define USB_HID_H + +/* + * USB HID interface subclass and protocol codes + */ +#define USB_INTERFACE_SUBCLASS_BOOT 1 +#define USB_INTERFACE_PROTOCOL_KEYBOARD 1 +#define USB_INTERFACE_PROTOCOL_MOUSE 2 + +/* + * HID class requests + */ +#define HID_REQ_GET_REPORT 0x01 +#define HID_REQ_GET_IDLE 0x02 +#define HID_REQ_GET_PROTOCOL 0x03 +#define HID_REQ_SET_REPORT 0x09 +#define HID_REQ_SET_IDLE 0x0A +#define HID_REQ_SET_PROTOCOL 0x0B + +/* + * HID class descriptor types + */ +#define HID_DT_HID (USB_TYPE_CLASS | 0x01) +#define HID_DT_REPORT (USB_TYPE_CLASS | 0x02) +#define HID_DT_PHYSICAL (USB_TYPE_CLASS | 0x03) + +/* + * USB HID descriptor + */ +typedef struct usb_hid_descriptor +{ + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t bcdHID; + uint8_t bCountryCode; + uint8_t bNumDescriptors; + uint8_t bDescriptorHidType; + uint16_t wDescriptorLength; +} PACKED usb_hid_descriptor_t; + +#endif /* USB_HID_H */