Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
hid.h File Reference

USB Human Interface Device (HID) common definitions header. More...

Go to the source code of this file.

Macros

#define USB_DESC_HID   0x21
 
#define USB_DESC_HID_REPORT   0x22
 
#define USB_DESC_HID_PHYSICAL   0x23
 
#define USB_HID_GET_REPORT   0x01
 
#define USB_HID_GET_IDLE   0x02
 
#define USB_HID_GET_PROTOCOL   0x03
 
#define USB_HID_SET_REPORT   0x09
 
#define USB_HID_SET_IDLE   0x0A
 
#define USB_HID_SET_PROTOCOL   0x0B
 
#define HID_BOOT_IFACE_CODE_NONE   0
 
#define HID_BOOT_IFACE_CODE_KEYBOARD   1
 
#define HID_BOOT_IFACE_CODE_MOUSE   2
 
#define HID_PROTOCOL_BOOT   0
 
#define HID_PROTOCOL_REPORT   1
 
#define HID_ITEM_TYPE_MAIN   0x0
 
#define HID_ITEM_TYPE_GLOBAL   0x1
 
#define HID_ITEM_TYPE_LOCAL   0x2
 
#define HID_ITEM_TAG_INPUT   0x8
 
#define HID_ITEM_TAG_OUTPUT   0x9
 
#define HID_ITEM_TAG_COLLECTION   0xA
 
#define HID_ITEM_TAG_FEATURE   0xB
 
#define HID_ITEM_TAG_COLLECTION_END   0xC
 
#define HID_ITEM_TAG_USAGE_PAGE   0x0
 
#define HID_ITEM_TAG_LOGICAL_MIN   0x1
 
#define HID_ITEM_TAG_LOGICAL_MAX   0x2
 
#define HID_ITEM_TAG_PHYSICAL_MIN   0x3
 
#define HID_ITEM_TAG_PHYSICAL_MAX   0x4
 
#define HID_ITEM_TAG_UNIT_EXPONENT   0x5
 
#define HID_ITEM_TAG_UNIT   0x6
 
#define HID_ITEM_TAG_REPORT_SIZE   0x7
 
#define HID_ITEM_TAG_REPORT_ID   0x8
 
#define HID_ITEM_TAG_REPORT_COUNT   0x9
 
#define HID_ITEM_TAG_USAGE   0x0
 
#define HID_ITEM_TAG_USAGE_MIN   0x1
 
#define HID_ITEM_TAG_USAGE_MAX   0x2
 
#define HID_COLLECTION_PHYSICAL   0x00
 
#define HID_COLLECTION_APPLICATION   0x01
 
#define HID_USAGE_GEN_DESKTOP   0x01
 
#define HID_USAGE_GEN_KEYBOARD   0x07
 
#define HID_USAGE_GEN_LEDS   0x08
 
#define HID_USAGE_GEN_BUTTON   0x09
 
#define HID_USAGE_GEN_DESKTOP_UNDEFINED   0x00
 
#define HID_USAGE_GEN_DESKTOP_POINTER   0x01
 
#define HID_USAGE_GEN_DESKTOP_MOUSE   0x02
 
#define HID_USAGE_GEN_DESKTOP_JOYSTICK   0x04
 
#define HID_USAGE_GEN_DESKTOP_GAMEPAD   0x05
 
#define HID_USAGE_GEN_DESKTOP_KEYBOARD   0x06
 
#define HID_USAGE_GEN_DESKTOP_KEYPAD   0x07
 
#define HID_USAGE_GEN_DESKTOP_X   0x30
 
#define HID_USAGE_GEN_DESKTOP_Y   0x31
 
#define HID_USAGE_GEN_DESKTOP_WHEEL   0x38
 
#define HID_ITEM(bTag, bType, bSize)
 Define HID short item. More...
 
#define HID_INPUT(a)    HID_ITEM(HID_ITEM_TAG_INPUT, HID_ITEM_TYPE_MAIN, 1), a
 Define HID Input item with the data length of one byte. More...
 
#define HID_OUTPUT(a)    HID_ITEM(HID_ITEM_TAG_OUTPUT, HID_ITEM_TYPE_MAIN, 1), a
 Define HID Output item with the data length of one byte. More...
 
#define HID_FEATURE(a)    HID_ITEM(HID_ITEM_TAG_OUTPUT, HID_ITEM_TYPE_MAIN, 1), a
 Define HID Feature item with the data length of one byte. More...
 
#define HID_COLLECTION(a)    HID_ITEM(HID_ITEM_TAG_COLLECTION, HID_ITEM_TYPE_MAIN, 1), a
 Define HID Collection item with the data length of one byte. More...
 
#define HID_END_COLLECTION    HID_ITEM(HID_ITEM_TAG_COLLECTION_END, HID_ITEM_TYPE_MAIN, 0)
 Define HID End Collection (non-data) item. More...
 
#define HID_USAGE_PAGE(page)    HID_ITEM(HID_ITEM_TAG_USAGE_PAGE, HID_ITEM_TYPE_GLOBAL, 1), page
 Define HID Usage Page item. More...
 
#define HID_LOGICAL_MIN8(a)    HID_ITEM(HID_ITEM_TAG_LOGICAL_MIN, HID_ITEM_TYPE_GLOBAL, 1), a
 Define HID Logical Minimum item with the data length of one byte. More...
 
#define HID_LOGICAL_MAX8(a)    HID_ITEM(HID_ITEM_TAG_LOGICAL_MAX, HID_ITEM_TYPE_GLOBAL, 1), a
 Define HID Logical Maximum item with the data length of one byte. More...
 
#define HID_LOGICAL_MIN16(a, b)    HID_ITEM(HID_ITEM_TAG_LOGICAL_MIN, HID_ITEM_TYPE_GLOBAL, 2), a, b
 Define HID Logical Minimum item with the data length of two bytes. More...
 
#define HID_LOGICAL_MAX16(a, b)    HID_ITEM(HID_ITEM_TAG_LOGICAL_MAX, HID_ITEM_TYPE_GLOBAL, 2), a, b
 Define HID Logical Maximum item with the data length of two bytes. More...
 
#define HID_LOGICAL_MIN32(a, b, c, d)    HID_ITEM(HID_ITEM_TAG_LOGICAL_MIN, HID_ITEM_TYPE_GLOBAL, 3), a, b, c, d
 Define HID Logical Minimum item with the data length of four bytes. More...
 
#define HID_LOGICAL_MAX32(a, b, c, d)    HID_ITEM(HID_ITEM_TAG_LOGICAL_MAX, HID_ITEM_TYPE_GLOBAL, 3), a, b, c, d
 Define HID Logical Maximum item with the data length of four bytes. More...
 
#define HID_REPORT_SIZE(size)    HID_ITEM(HID_ITEM_TAG_REPORT_SIZE, HID_ITEM_TYPE_GLOBAL, 1), size
 Define HID Report Size item with the data length of one byte. More...
 
#define HID_REPORT_ID(id)    HID_ITEM(HID_ITEM_TAG_REPORT_ID, HID_ITEM_TYPE_GLOBAL, 1), id
 Define HID Report ID item with the data length of one byte. More...
 
#define HID_REPORT_COUNT(count)    HID_ITEM(HID_ITEM_TAG_REPORT_COUNT, HID_ITEM_TYPE_GLOBAL, 1), count
 Define HID Report Count item with the data length of one byte. More...
 
#define HID_USAGE(idx)    HID_ITEM(HID_ITEM_TAG_USAGE, HID_ITEM_TYPE_LOCAL, 1), idx
 Define HID Usage Index item with the data length of one byte. More...
 
#define HID_USAGE_MIN8(a)    HID_ITEM(HID_ITEM_TAG_USAGE_MIN, HID_ITEM_TYPE_LOCAL, 1), a
 Define HID Usage Minimum item with the data length of one byte. More...
 
#define HID_USAGE_MAX8(a)    HID_ITEM(HID_ITEM_TAG_USAGE_MAX, HID_ITEM_TYPE_LOCAL, 1), a
 Define HID Usage Maximum item with the data length of one byte. More...
 
#define HID_USAGE_MIN16(a, b)    HID_ITEM(HID_ITEM_TAG_USAGE_MIN, HID_ITEM_TYPE_LOCAL, 2), a, b
 Define HID Usage Minimum item with the data length of two bytes. More...
 
#define HID_USAGE_MAX16(a, b)    HID_ITEM(HID_ITEM_TAG_USAGE_MAX, HID_ITEM_TYPE_LOCAL, 2), a, b
 Define HID Usage Maximum item with the data length of two bytes. More...
 
#define HID_MOUSE_REPORT_DESC(bcnt)
 Simple HID mouse report descriptor for n button mouse. More...
 
#define HID_KEYBOARD_REPORT_DESC()
 Simple HID keyboard report descriptor. More...
 

Enumerations

enum  hid_kbd_code {
  HID_KEY_A = 4 , HID_KEY_B = 5 , HID_KEY_C = 6 , HID_KEY_D = 7 ,
  HID_KEY_E = 8 , HID_KEY_F = 9 , HID_KEY_G = 10 , HID_KEY_H = 11 ,
  HID_KEY_I = 12 , HID_KEY_J = 13 , HID_KEY_K = 14 , HID_KEY_L = 15 ,
  HID_KEY_M = 16 , HID_KEY_N = 17 , HID_KEY_O = 18 , HID_KEY_P = 19 ,
  HID_KEY_Q = 20 , HID_KEY_R = 21 , HID_KEY_S = 22 , HID_KEY_T = 23 ,
  HID_KEY_U = 24 , HID_KEY_V = 25 , HID_KEY_W = 26 , HID_KEY_X = 27 ,
  HID_KEY_Y = 28 , HID_KEY_Z = 29 , HID_KEY_1 = 30 , HID_KEY_2 = 31 ,
  HID_KEY_3 = 32 , HID_KEY_4 = 33 , HID_KEY_5 = 34 , HID_KEY_6 = 35 ,
  HID_KEY_7 = 36 , HID_KEY_8 = 37 , HID_KEY_9 = 38 , HID_KEY_0 = 39 ,
  HID_KEY_ENTER = 40 , HID_KEY_ESC = 41 , HID_KEY_BACKSPACE = 42 , HID_KEY_TAB = 43 ,
  HID_KEY_SPACE = 44 , HID_KEY_MINUS = 45 , HID_KEY_EQUAL = 46 , HID_KEY_LEFTBRACE = 47 ,
  HID_KEY_RIGHTBRACE = 48 , HID_KEY_BACKSLASH = 49 , HID_KEY_HASH = 50 , HID_KEY_SEMICOLON = 51 ,
  HID_KEY_APOSTROPHE = 52 , HID_KEY_GRAVE = 53 , HID_KEY_COMMA = 54 , HID_KEY_DOT = 55 ,
  HID_KEY_SLASH = 56 , HID_KEY_CAPSLOCK = 57 , HID_KEY_F1 = 58 , HID_KEY_F2 = 59 ,
  HID_KEY_F3 = 60 , HID_KEY_F4 = 61 , HID_KEY_F5 = 62 , HID_KEY_F6 = 63 ,
  HID_KEY_F7 = 64 , HID_KEY_F8 = 65 , HID_KEY_F9 = 66 , HID_KEY_F10 = 67 ,
  HID_KEY_F11 = 68 , HID_KEY_F12 = 69 , HID_KEY_SYSRQ = 70 , HID_KEY_SCROLLLOCK = 71 ,
  HID_KEY_PAUSE = 72 , HID_KEY_INSERT = 73 , HID_KEY_HOME = 74 , HID_KEY_PAGEUP = 75 ,
  HID_KEY_DELETE = 76 , HID_KEY_END = 77 , HID_KEY_PAGEDOWN = 78 , HID_KEY_RIGHT = 79 ,
  HID_KEY_LEFT = 80 , HID_KEY_DOWN = 81 , HID_KEY_UP = 82 , HID_KEY_NUMLOCK = 83 ,
  HID_KEY_KPSLASH = 84 , HID_KEY_KPASTERISK = 85 , HID_KEY_KPMINUS = 86 , HID_KEY_KPPLUS = 87 ,
  HID_KEY_KPENTER = 88 , HID_KEY_KP_1 = 89 , HID_KEY_KP_2 = 90 , HID_KEY_KP_3 = 91 ,
  HID_KEY_KP_4 = 92 , HID_KEY_KP_5 = 93 , HID_KEY_KP_6 = 94 , HID_KEY_KP_7 = 95 ,
  HID_KEY_KP_8 = 96 , HID_KEY_KP_9 = 97 , HID_KEY_KP_0 = 98
}
 HID keyboard button codes. More...
 
enum  hid_kbd_modifier {
  HID_KBD_MODIFIER_NONE = 0x00 , HID_KBD_MODIFIER_LEFT_CTRL = 0x01 , HID_KBD_MODIFIER_LEFT_SHIFT = 0x02 , HID_KBD_MODIFIER_LEFT_ALT = 0x04 ,
  HID_KBD_MODIFIER_LEFT_UI = 0x08 , HID_KBD_MODIFIER_RIGHT_CTRL = 0x10 , HID_KBD_MODIFIER_RIGHT_SHIFT = 0x20 , HID_KBD_MODIFIER_RIGHT_ALT = 0x40 ,
  HID_KBD_MODIFIER_RIGHT_UI = 0x80
}
 HID keyboard modifiers. More...
 
enum  hid_kbd_led {
  HID_KBD_LED_NUM_LOCK = 0x01 , HID_KBD_LED_CAPS_LOCK = 0x02 , HID_KBD_LED_SCROLL_LOCK = 0x04 , HID_KBD_LED_COMPOSE = 0x08 ,
  HID_KBD_LED_KANA = 0x10
}
 HID keyboard LEDs. More...
 

Detailed Description

USB Human Interface Device (HID) common definitions header.

Header follows Device Class Definition for Human Interface Devices (HID) Version 1.11 document (HID1_11-1.pdf).