USBLibAPIGuide  1.00.00.01
Data Structures | Macros | Enumerations | Functions | Variables
Hid_device_class_api
Collaboration diagram for Hid_device_class_api:

Data Structures

struct  tHIDInstance
 
struct  tHIDReportIdle
 
struct  tUSBDHIDDevice
 
struct  PACKED
 USB_CDC_GET/SET_LINE_CODING request-specific data. More...
 
struct  tHIDKeyboardUsageTable
 

Macros

#define USB_RX_ERROR_FLAGS
 
#define HID_NOT_FOUND   0xFFFFFFFF
 
#define HID_DO_PACKET_RX   5
 
#define HID_DO_SEND_IDLE_REPORT   6
 
#define INT_IN_ENDPOINT   USB_EP_3
 
#define INT_OUT_ENDPOINT   USB_EP_3
 
#define HIDINTERFACE_SIZE   (9)
 
#define HIDINENDPOINT_SIZE   (7)
 
#define HIDOUTENDPOINT_SIZE   (7)
 
#define HIDDESCRIPTOR_SIZE   (9)
 
#define COMPOSITE_DHID_SIZE
 
#define UsagePage(ui8Value)   0x05, ((ui8Value) & 0xff)
 
#define UsagePageVendor(ui16Value)
 
#define Usage(ui8Value)   0x09, ((ui8Value) & 0xff)
 
#define UsageVendor(ui16Value)
 
#define UsageMinimum(ui8Value)   0x19, ((ui8Value) & 0xff)
 
#define UsageMaximum(ui8Value)   0x29, ((ui8Value) & 0xff)
 
#define LogicalMinimum(i8Value)   0x15, ((i8Value) & 0xff)
 
#define LogicalMaximum(i8Value)   0x25, ((i8Value) & 0xff)
 
#define LogicalMinimum16(i8Value, i8Value1)   0x16, i8Value, i8Value1
 
#define LogicalMaximum16(i8Value, i8Value1)   0x26, i8Value, i8Value1
 
#define LogicalMaximum32(i8Value, i8Value1, i8Value2, i8Value3)
 
#define PhysicalMinimum(i16Value)
 
#define PhysicalMaximum(i16Value)
 
#define Collection(ui8Value)   0xa1, ((ui8Value) & 0xff)
 
#define EndCollection   0xc0
 
#define ReportCount(ui8Value)   0x95, ((ui8Value) & 0xff)
 
#define ReportID(ui8Value)   0x85, ((ui8Value) & 0xff)
 
#define ReportSize(ui8Value)   0x75, ((ui8Value) & 0xff)
 
#define Input(ui8Value)   0x81, ((ui8Value) & 0xff)
 
#define Input2(ui16Value)
 
#define Feature(ui8Value)   0xB1, ((ui8Value) & 0xff)
 
#define Feature2(ui16Value)
 
#define Output(ui8Value)   0x91, ((ui8Value) & 0xff)
 
#define Output2(ui16Value)
 
#define UnitExponent(i8Value)   0x55, ((i8Value) & 0x0f)
 
#define Unit(ui32Value)
 
#define UnitDistance_cm   0x66, 0x11, 0x00
 
#define UnitDistance_i   0x66, 0x13, 0x00
 
#define UnitRotation_deg   0x66, 0x14, 0x00
 
#define UnitRotation_rad   0x66, 0x12, 0x00
 
#define UnitMass_g   0x66, 0x01, 0x01
 
#define UnitTime_s   0x66, 0x01, 0x10
 
#define UnitTemp_K   0x67, 0x01, 0x00, 0x01, 0x00
 
#define UnitTemp_F   0x67, 0x03, 0x00, 0x01, 0x00
 
#define UnitVelocitySI   0x66, 0x11, 0xF0
 
#define UnitMomentumSI   0x66, 0x11, 0xF1
 
#define UnitAccelerationSI   0x66, 0x11, 0xE0
 
#define UnitForceSI   0x66, 0x11, 0xE1
 
#define UnitEnergySI   0x66, 0x21, 0xE1
 
#define UnitAngAccelerationSI   0x66, 0x12, 0xE0
 
#define UnitVoltage   0x67, 0x21, 0xD1, 0xF0, 0x00
 
#define UnitCurrent_A   0x67, 0x01, 0x00, 0x10, 0x00
 
#define HidUsageSensorPropertyReportingState   0x0A, 0x16, 0x03
 
#define HidUsageSensorPropertySensorStatus   0x0A, 0x03, 0x03
 
#define HidUsageSensorPropertyReportInterval   0x0A, 0x0E, 0x03
 
#define HidUsageSensorData(a, b, c, d)   a, b, (c|d)
 
#define HidUsageSensorEvent   0x0A, 0x02, 0x02
 
#define HidUsageSensorDataEnvironmentalTemperature   0x0A, 0x34, 0x04
 
#define HidUsageSesnorDataModMax   0x20
 
#define HidUsageSensorDataModMin   0x30
 
#define HidUsageSensorState   0x0A, 0x01, 0x02
 
#define HidUsageSensorStateUnknown   0x0A, 0x00, 0x08
 
#define HidUsageSensorStateReady   0x0A, 0x01, 0x08
 
#define HidUsageSensorStateNotAvailable   0x0A, 0x02, 0x08
 
#define HidUsageSensorStateNoData   0x0A, 0x03, 0x08
 
#define HidUsageSensorStateInitializing   0x0A, 0x04, 0x08
 
#define HidUsageSensorStateAccessDenied   0x0A, 0x05, 0x08
 
#define HidUsageSensorStateError   0x0A, 0x06, 0x08
 
#define HidUsageSensorEventUnknown   0x0A, 0x10, 0x08
 
#define HidUsageSensorEventStateChanged   0x0A, 0x11, 0x08
 
#define HidUsageSensorEventProperyChanged   0x0A, 0x12, 0x08
 
#define HidUsageSensorEventDataUpdated   0x0A, 0x13, 0x08
 
#define HidUsageSensorEventPollResponse   0x0A, 0x14, 0x08
 
#define HidUsageSensorEventChangeSensitivity   0x0A, 0x15, 0x08
 
#define HidUsageSensorEventMaxReached   0x0A, 0x16, 0x08
 
#define HidUsageSensorEventMinReached   0x0A, 0x17, 0x08
 
#define HidUsageSensorEventHighThresholdCrossUpward   0x0A, 0x18, 0x08
 
#define HidUsageSensorEventHighThresholdCrossDownward   0x0A, 0x19, 0x08
 
#define HidUsageSensorEventLowThresholdCrossUpward   0x0A, 0x1A, 0x08
 
#define HidUsageSensorEventLowThresholdCrossDownward   0x0A, 0x1B, 0x08
 
#define HidUsageSensorEventZeroThresholdCrossUpward   0x0A, 0x1C, 0x08
 
#define HidUsageSensorEventZeroThresholdCrossDownward   0x0A, 0x1D, 0x08
 
#define HidUsageSensorEventPeriodExceeded   0x0A, 0x1E, 0x08
 
#define HidUsageSensorEventFrequencyExceeded   0x0A, 0x1F, 0x08
 
#define HidUsageSensorEventComplexTrigger   0x0A, 0x20, 0x08
 
#define USBDHID_MAX_PACKET   64
 
#define USBD_HID_EVENT_GET_REPORT   (USBD_HID_EVENT_BASE + 0)
 
#define USBD_HID_EVENT_REPORT_SENT   (USBD_HID_EVENT_BASE + 1)
 
#define USBD_HID_EVENT_GET_REPORT_BUFFER   (USBD_HID_EVENT_BASE + 2)
 
#define USBD_HID_EVENT_SET_REPORT   (USBD_HID_EVENT_BASE + 3)
 
#define USBD_HID_EVENT_GET_PROTOCOL   (USBD_HID_EVENT_BASE + 4)
 
#define USBD_HID_EVENT_SET_PROTOCOL   (USBD_HID_EVENT_BASE + 5)
 
#define USBD_HID_EVENT_IDLE_TIMEOUT   (USBD_HID_EVENT_BASE + 6)
 
#define USB_HID_SCLASS_NONE   0x00
 
#define USB_HID_SCLASS_BOOT   0x01
 
#define USB_HID_PROTOCOL_NONE   0
 
#define USB_HID_PROTOCOL_KEYB   1
 
#define USB_HID_PROTOCOL_MOUSE   2
 
#define USB_HID_DTYPE_HID   0x21
 
#define USB_HID_DTYPE_REPORT   0x22
 
#define USB_HID_DTYPE_PHYSICAL   0x23
 
#define USBREQ_GET_REPORT   0x01
 
#define USBREQ_GET_IDLE   0x02
 
#define USBREQ_GET_PROTOCOL   0x03
 
#define USBREQ_SET_REPORT   0x09
 
#define USBREQ_SET_IDLE   0x0a
 
#define USBREQ_SET_PROTOCOL   0x0b
 
#define USB_HID_REPORT_IN   0x01
 
#define USB_HID_REPORT_OUTPUT   0x02
 
#define USB_HID_REPORT_FEATURE   0x03
 
#define USB_HID_PROTOCOL_BOOT   0
 
#define USB_HID_PROTOCOL_REPORT   1
 
#define USB_HID_GENERIC_DESKTOP   0x01
 
#define USB_HID_BUTTONS   0x09
 
#define USB_HID_SENSOR   0x20
 
#define USB_HID_X   0x30
 
#define USB_HID_Y   0x31
 
#define USB_HID_Z   0x32
 
#define USB_HID_RX   0x33
 
#define USB_HID_RY   0x34
 
#define USB_HID_RZ   0x35
 
#define USB_HID_POINTER   0x01
 
#define USB_HID_MOUSE   0x02
 
#define USB_HID_JOYSTICK   0x04
 
#define USB_HID_GAME_PAD   0x05
 
#define USB_HID_KEYBOARD   0x06
 
#define USB_HID_SENSOR_TYPE_COLLECTION   0X01
 
#define USB_HID_ENVIRONMENTAL_TEMPERATURE   0x33
 
#define USB_HID_PHYSICAL   0x00
 
#define USB_HID_APPLICATION   0x01
 
#define USB_HID_LOGICAL   0x02
 
#define USB_HID_USAGE_POINTER   0x0109
 
#define USB_HID_USAGE_BUTTONS   0x0509
 
#define USB_HID_USAGE_LEDS   0x0508
 
#define USB_HID_USAGE_KEYCODES   0x0507
 
#define HID_MOUSE_BUTTON_1   0x01
 
#define HID_MOUSE_BUTTON_2   0x02
 
#define HID_MOUSE_BUTTON_3   0x04
 
#define HID_KEYB_NUM_LOCK   0x01
 
#define HID_KEYB_CAPS_LOCK   0x02
 
#define HID_KEYB_SCROLL_LOCK   0x04
 
#define HID_KEYB_COMPOSE   0x08
 
#define HID_KEYB_KANA   0x10
 
#define HID_KEYB_LEFT_CTRL   0x01
 
#define HID_KEYB_LEFT_SHIFT   0x02
 
#define HID_KEYB_LEFT_ALT   0x04
 
#define HID_KEYB_LEFT_GUI   0x08
 
#define HID_KEYB_RIGHT_CTRL   0x10
 
#define HID_KEYB_RIGHT_SHIFT   0x20
 
#define HID_KEYB_RIGHT_ALT   0x40
 
#define HID_KEYB_RIGHT_GUI   0x80
 
#define HID_KEYB_USAGE_RESERVED   0x00
 
#define HID_KEYB_USAGE_ROLLOVER   0x01
 
#define HID_KEYB_USAGE_A   0x04
 
#define HID_KEYB_USAGE_B   0x05
 
#define HID_KEYB_USAGE_C   0x06
 
#define HID_KEYB_USAGE_D   0x07
 
#define HID_KEYB_USAGE_E   0x08
 
#define HID_KEYB_USAGE_F   0x09
 
#define HID_KEYB_USAGE_G   0x0A
 
#define HID_KEYB_USAGE_H   0x0B
 
#define HID_KEYB_USAGE_I   0x0C
 
#define HID_KEYB_USAGE_J   0x0D
 
#define HID_KEYB_USAGE_K   0x0E
 
#define HID_KEYB_USAGE_L   0x0F
 
#define HID_KEYB_USAGE_M   0x10
 
#define HID_KEYB_USAGE_N   0x11
 
#define HID_KEYB_USAGE_O   0x12
 
#define HID_KEYB_USAGE_P   0x13
 
#define HID_KEYB_USAGE_Q   0x14
 
#define HID_KEYB_USAGE_R   0x15
 
#define HID_KEYB_USAGE_S   0x16
 
#define HID_KEYB_USAGE_T   0x17
 
#define HID_KEYB_USAGE_U   0x18
 
#define HID_KEYB_USAGE_V   0x19
 
#define HID_KEYB_USAGE_W   0x1A
 
#define HID_KEYB_USAGE_X   0x1B
 
#define HID_KEYB_USAGE_Y   0x1C
 
#define HID_KEYB_USAGE_Z   0x1D
 
#define HID_KEYB_USAGE_1   0x1E
 
#define HID_KEYB_USAGE_2   0x1F
 
#define HID_KEYB_USAGE_3   0x20
 
#define HID_KEYB_USAGE_4   0x21
 
#define HID_KEYB_USAGE_5   0x22
 
#define HID_KEYB_USAGE_6   0x23
 
#define HID_KEYB_USAGE_7   0x24
 
#define HID_KEYB_USAGE_8   0x25
 
#define HID_KEYB_USAGE_9   0x26
 
#define HID_KEYB_USAGE_0   0x27
 
#define HID_KEYB_USAGE_ENTER   0x28
 
#define HID_KEYB_USAGE_ESCAPE   0x29
 
#define HID_KEYB_USAGE_BACKSPACE   0x2A
 
#define HID_KEYB_USAGE_TAB   0x2B
 
#define HID_KEYB_USAGE_SPACE   0x2C
 
#define HID_KEYB_USAGE_MINUS   0x2D
 
#define HID_KEYB_USAGE_EQUAL   0x2E
 
#define HID_KEYB_USAGE_LBRACKET   0x2F
 
#define HID_KEYB_USAGE_RBRACKET   0x30
 
#define HID_KEYB_USAGE_BSLASH   0x31
 
#define HID_KEYB_USAGE_SEMICOLON   0x33
 
#define HID_KEYB_USAGE_FQUOTE   0x34
 
#define HID_KEYB_USAGE_BQUOTE   0x35
 
#define HID_KEYB_USAGE_COMMA   0x36
 
#define HID_KEYB_USAGE_PERIOD   0x37
 
#define HID_KEYB_USAGE_FSLASH   0x38
 
#define HID_KEYB_USAGE_CAPSLOCK   0x39
 
#define HID_KEYB_USAGE_F1   0x3A
 
#define HID_KEYB_USAGE_F2   0x3B
 
#define HID_KEYB_USAGE_F3   0x3C
 
#define HID_KEYB_USAGE_F4   0x3D
 
#define HID_KEYB_USAGE_F5   0x3E
 
#define HID_KEYB_USAGE_F6   0x3F
 
#define HID_KEYB_USAGE_F7   0x40
 
#define HID_KEYB_USAGE_F8   0x41
 
#define HID_KEYB_USAGE_F9   0x42
 
#define HID_KEYB_USAGE_F10   0x43
 
#define HID_KEYB_USAGE_F11   0x44
 
#define HID_KEYB_USAGE_F12   0x45
 
#define HID_KEYB_USAGE_SCROLLOCK   0x47
 
#define HID_KEYB_USAGE_PAGE_UP   0x4B
 
#define HID_KEYB_USAGE_PAGE_DOWN   0x4E
 
#define HID_KEYB_USAGE_RIGHT_ARROW   0x4F
 
#define HID_KEYB_USAGE_LEFT_ARROW   0x50
 
#define HID_KEYB_USAGE_DOWN_ARROW   0x51
 
#define HID_KEYB_USAGE_UP_ARROW   0x52
 
#define HID_KEYB_USAGE_NUMLOCK   0x53
 
#define HID_KEYB_USAGE_KEYPAD_SLASH   0x54
 
#define HID_KEYB_USAGE_KEYPAD_STAR   0x55
 
#define HID_KEYB_USAGE_KEYPAD_MINUS   0x56
 
#define HID_KEYB_USAGE_KEYPAD_PLUS   0x57
 
#define HID_KEYB_USAGE_KEPAD_ENTER   0x58
 
#define HID_KEYB_USAGE_KEYPAD_1   0x59
 
#define HID_KEYB_USAGE_KEYPAD_2   0x5A
 
#define HID_KEYB_USAGE_KEYPAD_3   0x5B
 
#define HID_KEYB_USAGE_KEYPAD_4   0x5C
 
#define HID_KEYB_USAGE_KEYPAD_5   0x5D
 
#define HID_KEYB_USAGE_KEYPAD_6   0x5E
 
#define HID_KEYB_USAGE_KEYPAD_7   0x5F
 
#define HID_KEYB_USAGE_KEYPAD_8   0x60
 
#define HID_KEYB_USAGE_KEYPAD_9   0x61
 
#define HID_KEYB_USAGE_KEYPAD_0   0x62
 
#define HID_KEYB_USAGE_KEPAD_PERIOD   0x63
 
#define USB_HID_COUNTRY_NONE   0x00
 
#define USB_HID_COUNTRY_ARABIC   0x01
 
#define USB_HID_COUNTRY_BELGIAN   0x02
 
#define USB_HID_COUNTRY_CANADA_BI   0x03
 
#define USB_HID_COUNTRY_CANADA_FR   0x04
 
#define USB_HID_COUNTRY_CZECH_REPUBLIC   0x05
 
#define USB_HID_COUNTRY_DANISH   0x06
 
#define USB_HID_COUNTRY_FINNISH   0x07
 
#define USB_HID_COUNTRY_FRENCH   0x08
 
#define USB_HID_COUNTRY_GERMAN   0x09
 
#define USB_HID_COUNTRY_GREEK   0x0A
 
#define USB_HID_COUNTRY_HEBREW   0x0B
 
#define USB_HID_COUNTRY_HUNGARY   0x0C
 
#define USB_HID_COUNTRY_INTERNATIONAL_ISO   0x0D
 
#define USB_HID_COUNTRY_ITALIAN   0x0E
 
#define USB_HID_COUNTRY_JAPAN_KATAKANA   0x0F
 
#define USB_HID_COUNTRY_KOREAN   0x10
 
#define USB_HID_COUNTRY_LATIN_AMERICAN   0x11
 
#define USB_HID_COUNTRY_NETHERLANDS   0x12
 
#define USB_HID_COUNTRY_NORWEGIAN   0x13
 
#define USB_HID_COUNTRY_PERSIAN   0x14
 
#define USB_HID_COUNTRY_POLAND   0x15
 
#define USB_HID_COUNTRY_PORTUGUESE   0x16
 
#define USB_HID_COUNTRY_RUSSIA   0x17
 
#define USB_HID_COUNTRY_SLOVAKIA   0x18
 
#define USB_HID_COUNTRY_SPANISH   0x19
 
#define USB_HID_COUNTRY_SWEDISH   0x1A
 
#define USB_HID_COUNTRY_SWISS_FRENCH   0x1B
 
#define USB_HID_COUNTRY_SWISS_GERMAN   0x1C
 
#define USB_HID_COUNTRY_SWITZERLAND   0x1D
 
#define USB_HID_COUNTRY_TAIWAN   0x1E
 
#define USB_HID_COUNTRY_TURKISH_Q   0x1F
 
#define USB_HID_COUNTRY_UK   0x20
 
#define USB_HID_COUNTRY_US   0x21
 
#define USB_HID_COUNTRY_YUGOSLAVIA   0x22
 
#define USB_HID_COUNTRY_TURKISH_F   0x23
 
#define USB_HID_INPUT_DATA   0x0000
 
#define USB_HID_INPUT_CONSTANT   0x0001
 
#define USB_HID_INPUT_ARRAY   0x0000
 
#define USB_HID_INPUT_VARIABLE   0x0002
 
#define USB_HID_INPUT_ABS   0x0000
 
#define USB_HID_INPUT_RELATIVE   0x0004
 
#define USB_HID_INPUT_NOWRAP   0x0000
 
#define USB_HID_INPUT_WRAP   0x0008
 
#define USB_HID_INPUT_LINEAR   0x0000
 
#define USB_HID_INPUT_NONLINEAR   0x0010
 
#define USB_HID_INPUT_PREFER   0x0000
 
#define USB_HID_INPUT_NONPREFER   0x0020
 
#define USB_HID_INPUT_NONULL   0x0000
 
#define USB_HID_INPUT_NULL   0x0040
 
#define USB_HID_INPUT_BITF   0x0100
 
#define USB_HID_INPUT_BYTES   0x0000
 
#define USB_HID_FEATURE_DATA   0x0000
 
#define USB_HID_FEATURE_CONSTANT   0x0001
 
#define USB_HID_FEATURE_ARRAY   0x0000
 
#define USB_HID_FEATURE_VARIABLE   0x0002
 
#define USB_HID_FEATURE_ABS   0x0000
 
#define USB_HID_FEATURE_RELATIVE   0x0004
 
#define USB_HID_FEATURE_NOWRAP   0x0000
 
#define USB_HID_FEATURE_WRAP   0x0008
 
#define USB_HID_FEATURE_LINEAR   0x0000
 
#define USB_HID_FEATURE_NONLINEAR   0x0010
 
#define USB_HID_FEATURE_PREFER   0x0000
 
#define USB_HID_FEATURE_NONPREFER   0x0020
 
#define USB_HID_FEATURE_NONULL   0x0000
 
#define USB_HID_FEATURE_NULL   0x0040
 
#define USB_HID_FEATURE_BITF   0x0100
 
#define USB_HID_FEATURE_BYTES   0x0000
 
#define USB_HID_OUTPUT_DATA   0x0000
 
#define USB_HID_OUTPUT_CONSTANT   0x0001
 
#define USB_HID_OUTPUT_ARRAY   0x0000
 
#define USB_HID_OUTPUT_VARIABLE   0x0002
 
#define USB_HID_OUTPUT_ABS   0x0000
 
#define USB_HID_OUTPUT_RELATIVE   0x0004
 
#define USB_HID_OUTPUT_NOWRAP   0x0000
 
#define USB_HID_OUTPUT_WRAP   0x0008
 
#define USB_HID_OUTPUT_LINEAR   0x0000
 
#define USB_HID_OUTPUT_NONLINEAR   0x0010
 
#define USB_HID_OUTPUT_PREFER   0x0000
 
#define USB_HID_OUTPUT_NONPREFER   0x0020
 
#define USB_HID_OUTPUT_NONULL   0x0000
 
#define USB_HID_OUTPUT_NULL   0x0040
 
#define USB_HID_OUTPUT_BITF   0x0100
 
#define USB_HID_OUTPUT_BYTES   0x0000
 
#define USB_HID_BIAS_NOT_APPLICABLE   0x00
 
#define USB_HID_BIAS_RIGHT_HAND   0x01
 
#define USB_HID_BIAS_LEFT_HAND   0x02
 
#define USB_HID_BIAS_BOTH_HANDS   0x03
 
#define USB_HID_BIAS_EITHER_HAND   0x04
 
#define USB_HID_DESIGNATOR_NONE   0x00
 
#define USB_HID_DESIGNATOR_HAND   0x01
 
#define USB_HID_DESIGNATOR_EYEBALL   0x02
 
#define USB_HID_DESIGNATOR_EYEBROW   0x03
 
#define USB_HID_DESIGNATOR_EYELID   0x04
 
#define USB_HID_DESIGNATOR_EAR   0x05
 
#define USB_HID_DESIGNATOR_NOSE   0x06
 
#define USB_HID_DESIGNATOR_MOUTH   0x07
 
#define USB_HID_DESIGNATOR_UPPER_LIP   0x08
 
#define USB_HID_DESIGNATOR_LOWER_LIP   0x09
 
#define USB_HID_DESIGNATOR_JAW   0x0A
 
#define USB_HID_DESIGNATOR_NECK   0x0B
 
#define USB_HID_DESIGNATOR_UPPER_ARM   0x0C
 
#define USB_HID_DESIGNATOR_ELBOW   0x0D
 
#define USB_HID_DESIGNATOR_FOREARM   0x0E
 
#define USB_HID_DESIGNATOR_WRIST   0x0F
 
#define USB_HID_DESIGNATOR_PALM   0x10
 
#define USB_HID_DESIGNATOR_THUMB   0x11
 
#define USB_HID_DESIGNATOR_INDEX_FINGER   0x12
 
#define USB_HID_DESIGNATOR_MIDDLE_FINGER   0x13
 
#define USB_HID_DESIGNATOR_RING_FINGER   0x14
 
#define USB_HID_DESIGNATOR_LITTLE_FINGER   0x15
 
#define USB_HID_DESIGNATOR_HEAD   0x16
 
#define USB_HID_DESIGNATOR_SHOULDER   0x17
 
#define USB_HID_DESIGNATOR_HIP   0x18
 
#define USB_HID_DESIGNATOR_WAIST   0x19
 
#define USB_HID_DESIGNATOR_THIGH   0x1A
 
#define USB_HID_DESIGNATOR_KNEE   0x1B
 
#define USB_HID_DESIGNATOR_CALF   0x1C
 
#define USB_HID_DESIGNATOR_ANKLE   0x1D
 
#define USB_HID_DESIGNATOR_FOOT   0x1E
 
#define USB_HID_DESIGNATOR_HEEL   0x1F
 
#define USB_HID_DESIGNATOR_BALL_OF_FOOT   0x20
 
#define USB_HID_DESIGNATOR_BIG_TOE   0x21
 
#define USB_HID_DESIGNATOR_SECOND_TOE   0x22
 
#define USB_HID_DESIGNATOR_THIRD_TOE   0x23
 
#define USB_HID_DESIGNATOR_FOURTH_TOE   0x24
 
#define USB_HID_DESIGNATOR_LITTLE_TOE   0x25
 
#define USB_HID_DESIGNATOR_BROW   0x26
 
#define USB_HID_DESIGNATOR_CHEEK   0x27
 
#define USB_HID_QUALIFIER_NOT_APPLICABLE   (0x00 << 5)
 
#define USB_HID_QUALIFIER_RIGHT   (0x01 << 5)
 
#define USB_HID_QUALIFIER_LEFT   (0x02 << 5)
 
#define USB_HID_QUALIFIER_BOTH   (0x03 << 5)
 
#define USB_HID_QUALIFIER_EITHER   (0x04 << 5)
 
#define USB_HID_QUALIFIER_CENTER   (0x05 << 5)
 
#define USBH_HID_MAX_USAGE   256
 
#define USBH_HID_CAPS_ARRAY_SZ   (USBH_HID_MAX_USAGE/sizeof(uint32_t))
 

Enumerations

enum  tHIDState { eHIDStateUnconfigured, eHIDStateIdle, eHIDStateWaitData }
 

Functions

void * USBDHIDInit (uint32_t ui32Index, tUSBDHIDDevice *psHIDDevice)
 
void * USBDHIDCompositeInit (uint32_t ui32Index, tUSBDHIDDevice *psHIDDevice, tCompositeEntry *psCompEntry)
 
void USBDHIDTerm (void *pvHIDInstance)
 
void * USBDHIDSetRxCBData (void *pvHIDInstance, void *pvCBData)
 
void * USBDHIDSetTxCBData (void *pvHIDInstance, void *pvCBData)
 
uint32_t USBDHIDReportWrite (void *pvHIDInstance, uint8_t *pi8Data, uint32_t ui32Length, bool bLast)
 
uint32_t USBDHIDPacketRead (void *pvHIDInstance, uint8_t *pi8Data, uint32_t ui32Length, bool bLast)
 
uint32_t USBDHIDTxPacketAvailable (void *pvHIDInstance)
 
uint32_t USBDHIDRxPacketAvailable (void *pvHIDInstance)
 
void USBDHIDPowerStatusSet (void *pvHIDInstance, uint8_t ui8Power)
 
bool USBDHIDRemoteWakeupRequest (void *pvHIDInstance)
 

Variables

uint8_t g_pui8HIDDeviceDescriptor []
 
const tCustomHandlers g_sHIDHandlers
 
const tHIDKeyboardUsageTable g_sUSKeyboardMap
 

Detailed Description

Macro Definition Documentation

§ USB_RX_ERROR_FLAGS

#define USB_RX_ERROR_FLAGS
Value:
USBERR_DEV_RX_OVERRUN | \
USBERR_DEV_RX_FIFO_FULL)
#define USBERR_DEV_RX_DATA_ERROR
The device detected a CRC error in received data.
Definition: usblib.h:1303

§ HID_NOT_FOUND

#define HID_NOT_FOUND   0xFFFFFFFF

§ HID_DO_PACKET_RX

#define HID_DO_PACKET_RX   5

§ HID_DO_SEND_IDLE_REPORT

#define HID_DO_SEND_IDLE_REPORT   6

§ INT_IN_ENDPOINT

#define INT_IN_ENDPOINT   USB_EP_3

§ INT_OUT_ENDPOINT

#define INT_OUT_ENDPOINT   USB_EP_3

§ HIDINTERFACE_SIZE

#define HIDINTERFACE_SIZE   (9)

§ HIDINENDPOINT_SIZE

#define HIDINENDPOINT_SIZE   (7)

§ HIDOUTENDPOINT_SIZE

#define HIDOUTENDPOINT_SIZE   (7)

§ HIDDESCRIPTOR_SIZE

#define HIDDESCRIPTOR_SIZE   (9)

§ COMPOSITE_DHID_SIZE

#define COMPOSITE_DHID_SIZE
Value:
HIDOUTENDPOINT_SIZE + HIDDESCRIPTOR_SIZE)
#define HIDINENDPOINT_SIZE
Definition: usbdhid.h:56
#define HIDINTERFACE_SIZE
Definition: usbdhid.h:49
#define HIDDESCRIPTOR_SIZE
Definition: usbdhid.h:70

The size of the memory that should be allocated to create a configuration descriptor for a single instance of the USB HID Device. This does not include the configuration descriptor which is automatically ignored by the composite device class.

§ UsagePage

#define UsagePage (   ui8Value)    0x05, ((ui8Value) & 0xff)

This is a macro to assist adding Usage Page entries in HID report descriptors.

Parameters
ui8Valueis the Usage Page value.

This macro takes a value and prepares it to be placed as a Usage Page entry into a HID report structure. These are defined by the USB HID specification.

Returns
Not a function.

§ UsagePageVendor

#define UsagePageVendor (   ui16Value)
Value:
0x06, ((ui16Value) & 0xFF), \
(((ui16Value) >> 8) & 0xFF)

This is a macro to assist adding Usage Page entries in HID report descriptors when a vendor-specific value is to be used.

Parameters
ui16Valueis the Usage Page value.

This macro takes a value and prepares it to be placed as a Usage Page entry into a HID report structure. These are defined by the USB HID specification. Vendor-specific values must lie in the range 0xFF00 to 0xFFFF inclusive.

Returns
Not a function.

§ Usage

#define Usage (   ui8Value)    0x09, ((ui8Value) & 0xff)

This is a macro to assist adding Usage entries in HID report descriptors.

Parameters
ui8Valueis the Usage value.

This macro takes a value and prepares it to be placed as a Usage entry into a HID report structure. These are defined by the USB HID specification.

Returns
Not a function.

§ UsageVendor

#define UsageVendor (   ui16Value)
Value:
0x0A, ((ui16Value) & 0xFF), \
(((ui16Value) >> 8) & 0xFF)

This is a macro to assist adding vendor-specific Usage entries in HID report descriptors.

Parameters
ui16Valueis the vendor-specific Usage value in the range 0xFF00 to 0xFFFF.

This macro takes a value and prepares it to be placed as a Usage entry into a HID report structure. These are defined by the USB HID specification.

Returns
Not a function.

§ UsageMinimum

#define UsageMinimum (   ui8Value)    0x19, ((ui8Value) & 0xff)

This is a macro to assist adding Usage Minimum entries in HID report descriptors.

Parameters
ui8Valueis the Usage Minimum value.

This macro takes a value and prepares it to be placed as a Usage Minimum entry into a HID report structure. This is the first or minimum value associated with a usage value.

Returns
Not a function.

§ UsageMaximum

#define UsageMaximum (   ui8Value)    0x29, ((ui8Value) & 0xff)

This is a macro to assist adding Usage Maximum entries in HID report descriptors.

Parameters
ui8Valueis the Usage Maximum value.

This macro takes a value and prepares it to be placed as a Usage Maximum entry into a HID report structure. This is the last or maximum value associated with a usage value.

Returns
Not a function.

§ LogicalMinimum

#define LogicalMinimum (   i8Value)    0x15, ((i8Value) & 0xff)

This is a macro to assist adding Logical Minimum entries in HID report descriptors.

Parameters
i8Valueis the Logical Minimum value.

This macro takes a value and prepares it to be placed as a Logical Minimum entry into a HID report structure. This is the actual minimum value for a range of values associated with a field.

Returns
Not a function.

§ LogicalMaximum

#define LogicalMaximum (   i8Value)    0x25, ((i8Value) & 0xff)

This is a macro to assist adding Logical Maximum entries in HID report descriptors.

Parameters
i8Valueis the Logical Maximum value.

This macro takes a value and prepares it to be placed as a Logical Maximum entry into a HID report structure. This is the actual maximum value for a range of values associated with a field.

Returns
Not a function.

§ LogicalMinimum16

#define LogicalMinimum16 (   i8Value,
  i8Value1 
)    0x16, i8Value, i8Value1

§ LogicalMaximum16

#define LogicalMaximum16 (   i8Value,
  i8Value1 
)    0x26, i8Value, i8Value1

§ LogicalMaximum32

#define LogicalMaximum32 (   i8Value,
  i8Value1,
  i8Value2,
  i8Value3 
)
Value:
0x17, \
i8Value, i8Value1, i8Value2, i8Value3

§ PhysicalMinimum

#define PhysicalMinimum (   i16Value)
Value:
0x36, ((i16Value) & 0xFF), \
(((i16Value) >> 8) & 0xFF)

This is a macro to assist adding Physical Minimum entries in HID report descriptors.

Parameters
i16Valueis the Physical Minimum value. It is a signed, 16 bit number.

This macro takes a value and prepares it to be placed as a Physical Minimum entry into a HID report structure. This is value is used in conversion of the control logical value, as returned to the host in the relevant report, to a physical measurement in the appropriate units.

Returns
Not a function.

§ PhysicalMaximum

#define PhysicalMaximum (   i16Value)
Value:
0x46, ((i16Value) & 0xFF), \
(((i16Value) >> 8) & 0xFF)

This is a macro to assist adding Physical Maximum entries in HID report descriptors.

Parameters
i16Valueis the Physical Maximum value. It is a signed, 16 bit number.

This macro takes a value and prepares it to be placed as a Physical Maximum entry into a HID report structure. This is value is used in conversion of the control logical value, as returned to the host in the relevant report, to a physical measurement in the appropriate units.

Returns
Not a function.

§ Collection

#define Collection (   ui8Value)    0xa1, ((ui8Value) & 0xff)

This is a macro to assist adding Collection entries in HID report descriptors.

Parameters
ui8Valueis the type of Collection.

This macro takes a value and prepares it to be placed as a Collection entry into a HID report structure. This is the type of values that are being grouped together, for instance input, output or features can be grouped together as a collection.

Returns
Not a function.

§ EndCollection

#define EndCollection   0xc0

This is a macro to assist adding End Collection entries in HID report descriptors.

This macro can be used to place an End Collection entry into a HID report structure. This is a tag to indicate that a collection of entries has ended in the HID report structure. This terminates a previous Collection() entry.

Returns
Not a function.

§ ReportCount

#define ReportCount (   ui8Value)    0x95, ((ui8Value) & 0xff)

This is a macro to assist adding Report Count entries in HID report descriptors.

Parameters
ui8Valueis the number of items in a report item.

This macro takes a value and prepares it to be placed as a Report Count entry into a HID report structure. This is number of entries of Report Size for a given item.

Returns
Not a function.

§ ReportID

#define ReportID (   ui8Value)    0x85, ((ui8Value) & 0xff)

This is a macro to assist adding Report ID entries in HID report descriptors.

Parameters
ui8Valueis the identifier prefix for the current report.

This macro takes a value and prepares it to be placed as a Report ID entry into a HID report structure. This value is used as a 1 byte prefix for the report it is contained within.

Returns
Not a function.

§ ReportSize

#define ReportSize (   ui8Value)    0x75, ((ui8Value) & 0xff)

This is a macro to assist adding Report Size entries in HID report descriptors.

Parameters
ui8Valueis the size, in bits, of items in a report item.

This macro takes a value and prepares it to be placed as a Report Size entry into a HID report structure. This is size in bits of the entries of of a report entry. The Report Count specifies how many entries of Report Size are in a given item. These can be individual bits or bit fields.

Returns
Not a function.

§ Input

#define Input (   ui8Value)    0x81, ((ui8Value) & 0xff)

This is a macro to assist adding Input entries in HID report descriptors.

Parameters
ui8Valueis bit mask to specify the type of a set of input report items. Note that if the USB_HID_INPUT_BITF flag is required, the Input2 macro (which uses a 2 byte version of the Input item tag) must be used instead of this macro.

This macro takes a value and prepares it to be placed as an Input entry into a HID report structure. This specifies the type of an input item in a report structure. These refer to a bit mask of flags that indicate the type of input for a set of items.

Returns
Not a function.

§ Input2

#define Input2 (   ui16Value)
Value:
0x82, ((ui16Value) & 0xff), \
(((ui16Value) >> 8) & 0xFF)

This is a macro to assist adding Input entries in HID report descriptors.

Parameters
ui16Valueis bit mask to specify the type of a set of input report items. Note that this macro uses a version of the Input item tag with a two byte payload and allows any of the 8 possible data bits for the tag to be used. If USB_HID_INPUT_BITF (bit 8) is not required, the Input macro may be used instead.

This macro takes a value and prepares it to be placed as an Input entry into a HID report structure. This specifies the type of an input item in a report structure. These refer to a bit mask of flags that indicate the type of input for a set of items.

Returns
Not a function.

§ Feature

#define Feature (   ui8Value)    0xB1, ((ui8Value) & 0xff)

This is a macro to assist adding Feature entries in HID report descriptors.

Parameters
ui8Valueis bit mask to specify the type of a set of feature report items. Note that if the USB_HID_FEATURE_BITF flag is required, the Feature2 macro (which uses a 2 byte version of the Feature item tag) must be used instead of this macro.

This macro takes a value and prepares it to be placed as a Feature entry into a HID report structure. This specifies the type of a feature item in a report structure. These refer to a bit mask of flags that indicate the type of feature for a set of items.

Returns
Not a function.

§ Feature2

#define Feature2 (   ui16Value)
Value:
0xB2, ((ui16Value) & 0xff), \
(((ui16Value) >> 8) & 0xFF)

This is a macro to assist adding Feature entries in HID report descriptors.

Parameters
ui16Valueis bit mask to specify the type of a set of feature report items. Note that this macro uses a version of the Feature item tag with a two byte payload and allows any of the 8 possible data bits for the tag to be used. If USB_HID_FEATURE_BITF (bit 8) is not required, the Feature macro may be used instead.

This macro takes a value and prepares it to be placed as a Feature entry into a HID report structure. This specifies the type of a feature item in a report structure. These refer to a bit mask of flags that indicate the type of feature for a set of items.

Returns
Not a function.

§ Output

#define Output (   ui8Value)    0x91, ((ui8Value) & 0xff)

This is a macro to assist adding Output entries in HID report descriptors.

Parameters
ui8Valueis bit mask to specify the type of a set of output report items. Note that if the USB_HID_OUTPUT_BITF flag is required, the Output2 macro (which uses a 2 byte version of the Output item tag) must be used instead of this macro.

This macro takes a value and prepares it to be placed as an Output entry into a HID report structure. This specifies the type of an output item in a report structure. These refer to a bit mask of flags that indicate the type of output for a set of items.

Returns
Not a function.

§ Output2

#define Output2 (   ui16Value)
Value:
0x92, ((ui16Value) & 0xff), \
(((ui16Value) >> 8) & 0xFF)

This is a macro to assist adding Output entries in HID report descriptors.

Parameters
ui16Valueis bit mask to specify the type of a set of output report items. Note that this macro uses a version of the Output item tag with a two byte payload and allows any of the 8 possible data bits for the tag to be used. If USB_HID_OUTPUT_BITF is not required, the Output macro may be used instead.

This macro takes a value and prepares it to be placed as an Output entry into a HID report structure. This specifies the type of an output item in a report structure. These refer to a bit mask of flags that indicate the type of output for a set of items.

Returns
Not a function.

§ UnitExponent

#define UnitExponent (   i8Value)    0x55, ((i8Value) & 0x0f)

This is a macro to assist adding Unit Exponent entries in HID report descriptors.

Parameters
i8Valueis the required exponent in the range [-8, 7].

This macro takes a value and prepares it to be placed as a Unit Exponent entry into a HID report structure. This is the exponent applied to PhysicalMinimum and PhysicalMaximum when scaling and converting control values to "real" units.

Returns
Not a function.

§ Unit

#define Unit (   ui32Value)
Value:
0x67, (ui32Value & 0xFF), \
(((ui32Value) >> 8) & 0xFF), \
(((ui32Value) >> 16) & 0xFF), \
(((ui32Value) >> 24) & 0xFF)

This is a macro to assist adding Unit entries for uncommon units in HID report descriptors.

Parameters
ui32Valueis the definition of the unit required as defined in section 6.2.2.7 of the USB HID device class definition document.

This macro takes a value and prepares it to be placed as a Unit entry into a HID report structure. Note that individual macros are defined for common units and this macro is intended for use when a complex or uncommon unit is needed. It allows entry of a 5 nibble unit definition into the report descriptor.

Returns
Not a function.

§ UnitDistance_cm

#define UnitDistance_cm   0x66, 0x11, 0x00

This macro inserts a Unit entry for centimeters into a report descriptor.

§ UnitDistance_i

#define UnitDistance_i   0x66, 0x13, 0x00

This macro inserts a Unit entry for inches into a report descriptor.

§ UnitRotation_deg

#define UnitRotation_deg   0x66, 0x14, 0x00

This macro inserts a Unit entry for degrees into a report descriptor.

§ UnitRotation_rad

#define UnitRotation_rad   0x66, 0x12, 0x00

This macro inserts a Unit entry for radians into a report descriptor.

§ UnitMass_g

#define UnitMass_g   0x66, 0x01, 0x01

This macro inserts a Unit entry for grams into a report descriptor.

§ UnitTime_s

#define UnitTime_s   0x66, 0x01, 0x10

This macro inserts a Unit entry for seconds into a report descriptor.

§ UnitTemp_K

#define UnitTemp_K   0x67, 0x01, 0x00, 0x01, 0x00

This macro inserts a Unit entry for temperature in Kelvin into a report descriptor.

§ UnitTemp_F

#define UnitTemp_F   0x67, 0x03, 0x00, 0x01, 0x00

This macro inserts a Unit entry for temperature in Fahrenheit into a report descriptor.

§ UnitVelocitySI

#define UnitVelocitySI   0x66, 0x11, 0xF0

This macro inserts a Unit entry for velocity in cm/s into a report descriptor.

§ UnitMomentumSI

#define UnitMomentumSI   0x66, 0x11, 0xF1

This macro inserts a Unit entry for momentum in (grams * cm)/s into a report descriptor.

§ UnitAccelerationSI

#define UnitAccelerationSI   0x66, 0x11, 0xE0

This macro inserts a Unit entry for acceleration in cm/s**2 into a report descriptor.

§ UnitForceSI

#define UnitForceSI   0x66, 0x11, 0xE1

This macro inserts a Unit entry for force in (cm * grams)/s**2 into a report descriptor.

§ UnitEnergySI

#define UnitEnergySI   0x66, 0x21, 0xE1

This macro inserts a Unit entry for energy in (grams * cm^2)/(s^2) into a report descriptor.

§ UnitAngAccelerationSI

#define UnitAngAccelerationSI   0x66, 0x12, 0xE0

This macro inserts a Unit entry for angular acceleration in degrees/(s^2) into a report descriptor.

§ UnitVoltage

#define UnitVoltage   0x67, 0x21, 0xD1, 0xF0, 0x00

This macro inserts a Unit entry for voltage into a a report descriptor.

§ UnitCurrent_A

#define UnitCurrent_A   0x67, 0x01, 0x00, 0x10, 0x00

This macro inserts a Unit entry for voltage into a a report descriptor.

§ HidUsageSensorPropertyReportingState

#define HidUsageSensorPropertyReportingState   0x0A, 0x16, 0x03

§ HidUsageSensorPropertySensorStatus

#define HidUsageSensorPropertySensorStatus   0x0A, 0x03, 0x03

§ HidUsageSensorPropertyReportInterval

#define HidUsageSensorPropertyReportInterval   0x0A, 0x0E, 0x03

§ HidUsageSensorData

#define HidUsageSensorData (   a,
  b,
  c,
 
)    a, b, (c|d)

§ HidUsageSensorEvent

#define HidUsageSensorEvent   0x0A, 0x02, 0x02

§ HidUsageSensorDataEnvironmentalTemperature

#define HidUsageSensorDataEnvironmentalTemperature   0x0A, 0x34, 0x04

§ HidUsageSesnorDataModMax

#define HidUsageSesnorDataModMax   0x20

§ HidUsageSensorDataModMin

#define HidUsageSensorDataModMin   0x30

§ HidUsageSensorState

#define HidUsageSensorState   0x0A, 0x01, 0x02

§ HidUsageSensorStateUnknown

#define HidUsageSensorStateUnknown   0x0A, 0x00, 0x08

§ HidUsageSensorStateReady

#define HidUsageSensorStateReady   0x0A, 0x01, 0x08

§ HidUsageSensorStateNotAvailable

#define HidUsageSensorStateNotAvailable   0x0A, 0x02, 0x08

§ HidUsageSensorStateNoData

#define HidUsageSensorStateNoData   0x0A, 0x03, 0x08

§ HidUsageSensorStateInitializing

#define HidUsageSensorStateInitializing   0x0A, 0x04, 0x08

§ HidUsageSensorStateAccessDenied

#define HidUsageSensorStateAccessDenied   0x0A, 0x05, 0x08

§ HidUsageSensorStateError

#define HidUsageSensorStateError   0x0A, 0x06, 0x08

§ HidUsageSensorEventUnknown

#define HidUsageSensorEventUnknown   0x0A, 0x10, 0x08

§ HidUsageSensorEventStateChanged

#define HidUsageSensorEventStateChanged   0x0A, 0x11, 0x08

§ HidUsageSensorEventProperyChanged

#define HidUsageSensorEventProperyChanged   0x0A, 0x12, 0x08

§ HidUsageSensorEventDataUpdated

#define HidUsageSensorEventDataUpdated   0x0A, 0x13, 0x08

§ HidUsageSensorEventPollResponse

#define HidUsageSensorEventPollResponse   0x0A, 0x14, 0x08

§ HidUsageSensorEventChangeSensitivity

#define HidUsageSensorEventChangeSensitivity   0x0A, 0x15, 0x08

§ HidUsageSensorEventMaxReached

#define HidUsageSensorEventMaxReached   0x0A, 0x16, 0x08

§ HidUsageSensorEventMinReached

#define HidUsageSensorEventMinReached   0x0A, 0x17, 0x08

§ HidUsageSensorEventHighThresholdCrossUpward

#define HidUsageSensorEventHighThresholdCrossUpward   0x0A, 0x18, 0x08

§ HidUsageSensorEventHighThresholdCrossDownward

#define HidUsageSensorEventHighThresholdCrossDownward   0x0A, 0x19, 0x08

§ HidUsageSensorEventLowThresholdCrossUpward

#define HidUsageSensorEventLowThresholdCrossUpward   0x0A, 0x1A, 0x08

§ HidUsageSensorEventLowThresholdCrossDownward

#define HidUsageSensorEventLowThresholdCrossDownward   0x0A, 0x1B, 0x08

§ HidUsageSensorEventZeroThresholdCrossUpward

#define HidUsageSensorEventZeroThresholdCrossUpward   0x0A, 0x1C, 0x08

§ HidUsageSensorEventZeroThresholdCrossDownward

#define HidUsageSensorEventZeroThresholdCrossDownward   0x0A, 0x1D, 0x08

§ HidUsageSensorEventPeriodExceeded

#define HidUsageSensorEventPeriodExceeded   0x0A, 0x1E, 0x08

§ HidUsageSensorEventFrequencyExceeded

#define HidUsageSensorEventFrequencyExceeded   0x0A, 0x1F, 0x08

§ HidUsageSensorEventComplexTrigger

#define HidUsageSensorEventComplexTrigger   0x0A, 0x20, 0x08

§ USBDHID_MAX_PACKET

#define USBDHID_MAX_PACKET   64

§ USBD_HID_EVENT_GET_REPORT

#define USBD_HID_EVENT_GET_REPORT   (USBD_HID_EVENT_BASE + 0)

This event indicates that the host is requesting a particular report be returned via endpoint 0, the control endpoint. The ui32MsgValue parameter contains the requested report type in the high byte and report ID in the low byte (as passed in the wValue field of the USB request structure). The pvMsgData parameter contains a pointer which must be written with the address of the first byte of the requested report. The callback must return the size in bytes of the report pointed to by *pvMsgData. The memory returned in response to this event must remain unaltered until USBD_HID_EVENT_REPORT_SENT is sent.

§ USBD_HID_EVENT_REPORT_SENT

#define USBD_HID_EVENT_REPORT_SENT   (USBD_HID_EVENT_BASE + 1)

This event indicates that a report previously requested via a USBD_HID_EVENT_GET_REPORT has been successfully transmitted to the host. The application may now free or reuse the report memory passed on the previous event. Although this would seem to be an event that would be passed to the transmit channel callback, it is actually passed to the receive channel callback. This ensures that all events related to the request and transmission of reports via endpoint zero can be handled in a single function.

§ USBD_HID_EVENT_GET_REPORT_BUFFER

#define USBD_HID_EVENT_GET_REPORT_BUFFER   (USBD_HID_EVENT_BASE + 2)

This event indicates that the host has sent a Set_Report request to the device and requests that the device provide a buffer into which the report can be written. The ui32MsgValue parameter contains the received report type in the high byte and report ID in the low byte (as passed in the wValue field of the USB request structure). The pvMsgData parameter contains the length of buffer requested. Note that this is the actual length value cast to a "void *" type and not a pointer in this case. The callback must return a pointer to a suitable buffer (cast to the standard "uint32_t" return type for the callback).

§ USBD_HID_EVENT_SET_REPORT

#define USBD_HID_EVENT_SET_REPORT   (USBD_HID_EVENT_BASE + 3)

This event indicates that the host has sent the device a report via endpoint 0, the control endpoint. The ui32MsgValue field indicates the size of the report and pvMsgData points to the first byte of the report. The report buffer was previously returned in response to an earlier USBD_HID_EVENT_GET_REPORT_BUFFER callback. The HID device class driver does not access the memory pointed to by pvMsgData after this callback is made so the application is free to reuse or free it at this point.

§ USBD_HID_EVENT_GET_PROTOCOL

#define USBD_HID_EVENT_GET_PROTOCOL   (USBD_HID_EVENT_BASE + 4)

This event is sent in response to a Get_Protocol request from the host. The callback should provide the current protocol via the return code, USB_HID_PROTOCOL_BOOT or USB_HID_PROTOCOL_REPORT.

§ USBD_HID_EVENT_SET_PROTOCOL

#define USBD_HID_EVENT_SET_PROTOCOL   (USBD_HID_EVENT_BASE + 5)

This event is sent in response to a Set_Protocol request from the host. The ui32MsgData value contains the requested protocol, USB_HID_PROTOCOL_BOOT or USB_HID_PROTOCOL_REPORT.

§ USBD_HID_EVENT_IDLE_TIMEOUT

#define USBD_HID_EVENT_IDLE_TIMEOUT   (USBD_HID_EVENT_BASE + 6)

This event indicates to an application that a report idle timeout has occurred and requests a pointer to the report that must be sent back to the host. The ui32MsgData value contains the requested report ID and pvMsgData contains a pointer that must be written with a pointer to the report data that is to be sent. The callback must return the number of bytes in the report pointed to by *pvMsgData.

§ USB_HID_SCLASS_NONE

#define USB_HID_SCLASS_NONE   0x00

§ USB_HID_SCLASS_BOOT

#define USB_HID_SCLASS_BOOT   0x01

§ USB_HID_PROTOCOL_NONE

#define USB_HID_PROTOCOL_NONE   0

§ USB_HID_PROTOCOL_KEYB

#define USB_HID_PROTOCOL_KEYB   1

§ USB_HID_PROTOCOL_MOUSE

#define USB_HID_PROTOCOL_MOUSE   2

§ USB_HID_DTYPE_HID

#define USB_HID_DTYPE_HID   0x21

§ USB_HID_DTYPE_REPORT

#define USB_HID_DTYPE_REPORT   0x22

§ USB_HID_DTYPE_PHYSICAL

#define USB_HID_DTYPE_PHYSICAL   0x23

§ USBREQ_GET_REPORT

#define USBREQ_GET_REPORT   0x01

§ USBREQ_GET_IDLE

#define USBREQ_GET_IDLE   0x02

§ USBREQ_GET_PROTOCOL

#define USBREQ_GET_PROTOCOL   0x03

§ USBREQ_SET_REPORT

#define USBREQ_SET_REPORT   0x09

Referenced by USBHHIDSetReport().

§ USBREQ_SET_IDLE

#define USBREQ_SET_IDLE   0x0a

Referenced by USBHHIDSetIdle().

§ USBREQ_SET_PROTOCOL

#define USBREQ_SET_PROTOCOL   0x0b

Referenced by USBHHIDSetProtocol().

§ USB_HID_REPORT_IN

#define USB_HID_REPORT_IN   0x01

§ USB_HID_REPORT_OUTPUT

#define USB_HID_REPORT_OUTPUT   0x02

Referenced by USBHHIDSetReport().

§ USB_HID_REPORT_FEATURE

#define USB_HID_REPORT_FEATURE   0x03

§ USB_HID_PROTOCOL_BOOT

#define USB_HID_PROTOCOL_BOOT   0

§ USB_HID_PROTOCOL_REPORT

#define USB_HID_PROTOCOL_REPORT   1

§ USB_HID_GENERIC_DESKTOP

#define USB_HID_GENERIC_DESKTOP   0x01

§ USB_HID_BUTTONS

#define USB_HID_BUTTONS   0x09

§ USB_HID_SENSOR

#define USB_HID_SENSOR   0x20

§ USB_HID_X

#define USB_HID_X   0x30

§ USB_HID_Y

#define USB_HID_Y   0x31

§ USB_HID_Z

#define USB_HID_Z   0x32

§ USB_HID_RX

#define USB_HID_RX   0x33

§ USB_HID_RY

#define USB_HID_RY   0x34

§ USB_HID_RZ

#define USB_HID_RZ   0x35

§ USB_HID_POINTER

#define USB_HID_POINTER   0x01

§ USB_HID_MOUSE

#define USB_HID_MOUSE   0x02

§ USB_HID_JOYSTICK

#define USB_HID_JOYSTICK   0x04

§ USB_HID_GAME_PAD

#define USB_HID_GAME_PAD   0x05

§ USB_HID_KEYBOARD

#define USB_HID_KEYBOARD   0x06

§ USB_HID_SENSOR_TYPE_COLLECTION

#define USB_HID_SENSOR_TYPE_COLLECTION   0X01

§ USB_HID_ENVIRONMENTAL_TEMPERATURE

#define USB_HID_ENVIRONMENTAL_TEMPERATURE   0x33

§ USB_HID_PHYSICAL

#define USB_HID_PHYSICAL   0x00

§ USB_HID_APPLICATION

#define USB_HID_APPLICATION   0x01

§ USB_HID_LOGICAL

#define USB_HID_LOGICAL   0x02

§ USB_HID_USAGE_POINTER

#define USB_HID_USAGE_POINTER   0x0109

§ USB_HID_USAGE_BUTTONS

#define USB_HID_USAGE_BUTTONS   0x0509

§ USB_HID_USAGE_LEDS

#define USB_HID_USAGE_LEDS   0x0508

§ USB_HID_USAGE_KEYCODES

#define USB_HID_USAGE_KEYCODES   0x0507

§ HID_MOUSE_BUTTON_1

#define HID_MOUSE_BUTTON_1   0x01

§ HID_MOUSE_BUTTON_2

#define HID_MOUSE_BUTTON_2   0x02

§ HID_MOUSE_BUTTON_3

#define HID_MOUSE_BUTTON_3   0x04

§ HID_KEYB_NUM_LOCK

#define HID_KEYB_NUM_LOCK   0x01

§ HID_KEYB_CAPS_LOCK

#define HID_KEYB_CAPS_LOCK   0x02

Referenced by USBHKeyboardUsageToChar().

§ HID_KEYB_SCROLL_LOCK

#define HID_KEYB_SCROLL_LOCK   0x04

§ HID_KEYB_COMPOSE

#define HID_KEYB_COMPOSE   0x08

§ HID_KEYB_KANA

#define HID_KEYB_KANA   0x10

§ HID_KEYB_LEFT_CTRL

#define HID_KEYB_LEFT_CTRL   0x01

§ HID_KEYB_LEFT_SHIFT

#define HID_KEYB_LEFT_SHIFT   0x02

§ HID_KEYB_LEFT_ALT

#define HID_KEYB_LEFT_ALT   0x04

§ HID_KEYB_LEFT_GUI

#define HID_KEYB_LEFT_GUI   0x08

§ HID_KEYB_RIGHT_CTRL

#define HID_KEYB_RIGHT_CTRL   0x10

§ HID_KEYB_RIGHT_SHIFT

#define HID_KEYB_RIGHT_SHIFT   0x20

§ HID_KEYB_RIGHT_ALT

#define HID_KEYB_RIGHT_ALT   0x40

§ HID_KEYB_RIGHT_GUI

#define HID_KEYB_RIGHT_GUI   0x80

§ HID_KEYB_USAGE_RESERVED

#define HID_KEYB_USAGE_RESERVED   0x00

§ HID_KEYB_USAGE_ROLLOVER

#define HID_KEYB_USAGE_ROLLOVER   0x01

§ HID_KEYB_USAGE_A

#define HID_KEYB_USAGE_A   0x04

§ HID_KEYB_USAGE_B

#define HID_KEYB_USAGE_B   0x05

§ HID_KEYB_USAGE_C

#define HID_KEYB_USAGE_C   0x06

§ HID_KEYB_USAGE_D

#define HID_KEYB_USAGE_D   0x07

§ HID_KEYB_USAGE_E

#define HID_KEYB_USAGE_E   0x08

§ HID_KEYB_USAGE_F

#define HID_KEYB_USAGE_F   0x09

§ HID_KEYB_USAGE_G

#define HID_KEYB_USAGE_G   0x0A

§ HID_KEYB_USAGE_H

#define HID_KEYB_USAGE_H   0x0B

§ HID_KEYB_USAGE_I

#define HID_KEYB_USAGE_I   0x0C

§ HID_KEYB_USAGE_J

#define HID_KEYB_USAGE_J   0x0D

§ HID_KEYB_USAGE_K

#define HID_KEYB_USAGE_K   0x0E

§ HID_KEYB_USAGE_L

#define HID_KEYB_USAGE_L   0x0F

§ HID_KEYB_USAGE_M

#define HID_KEYB_USAGE_M   0x10

§ HID_KEYB_USAGE_N

#define HID_KEYB_USAGE_N   0x11

§ HID_KEYB_USAGE_O

#define HID_KEYB_USAGE_O   0x12

§ HID_KEYB_USAGE_P

#define HID_KEYB_USAGE_P   0x13

§ HID_KEYB_USAGE_Q

#define HID_KEYB_USAGE_Q   0x14

§ HID_KEYB_USAGE_R

#define HID_KEYB_USAGE_R   0x15

§ HID_KEYB_USAGE_S

#define HID_KEYB_USAGE_S   0x16

§ HID_KEYB_USAGE_T

#define HID_KEYB_USAGE_T   0x17

§ HID_KEYB_USAGE_U

#define HID_KEYB_USAGE_U   0x18

§ HID_KEYB_USAGE_V

#define HID_KEYB_USAGE_V   0x19

§ HID_KEYB_USAGE_W

#define HID_KEYB_USAGE_W   0x1A

§ HID_KEYB_USAGE_X

#define HID_KEYB_USAGE_X   0x1B

§ HID_KEYB_USAGE_Y

#define HID_KEYB_USAGE_Y   0x1C

§ HID_KEYB_USAGE_Z

#define HID_KEYB_USAGE_Z   0x1D

§ HID_KEYB_USAGE_1

#define HID_KEYB_USAGE_1   0x1E

§ HID_KEYB_USAGE_2

#define HID_KEYB_USAGE_2   0x1F

§ HID_KEYB_USAGE_3

#define HID_KEYB_USAGE_3   0x20

§ HID_KEYB_USAGE_4

#define HID_KEYB_USAGE_4   0x21

§ HID_KEYB_USAGE_5

#define HID_KEYB_USAGE_5   0x22

§ HID_KEYB_USAGE_6

#define HID_KEYB_USAGE_6   0x23

§ HID_KEYB_USAGE_7

#define HID_KEYB_USAGE_7   0x24

§ HID_KEYB_USAGE_8

#define HID_KEYB_USAGE_8   0x25

§ HID_KEYB_USAGE_9

#define HID_KEYB_USAGE_9   0x26

§ HID_KEYB_USAGE_0

#define HID_KEYB_USAGE_0   0x27

§ HID_KEYB_USAGE_ENTER

#define HID_KEYB_USAGE_ENTER   0x28

§ HID_KEYB_USAGE_ESCAPE

#define HID_KEYB_USAGE_ESCAPE   0x29

§ HID_KEYB_USAGE_BACKSPACE

#define HID_KEYB_USAGE_BACKSPACE   0x2A

§ HID_KEYB_USAGE_TAB

#define HID_KEYB_USAGE_TAB   0x2B

§ HID_KEYB_USAGE_SPACE

#define HID_KEYB_USAGE_SPACE   0x2C

§ HID_KEYB_USAGE_MINUS

#define HID_KEYB_USAGE_MINUS   0x2D

§ HID_KEYB_USAGE_EQUAL

#define HID_KEYB_USAGE_EQUAL   0x2E

§ HID_KEYB_USAGE_LBRACKET

#define HID_KEYB_USAGE_LBRACKET   0x2F

§ HID_KEYB_USAGE_RBRACKET

#define HID_KEYB_USAGE_RBRACKET   0x30

§ HID_KEYB_USAGE_BSLASH

#define HID_KEYB_USAGE_BSLASH   0x31

§ HID_KEYB_USAGE_SEMICOLON

#define HID_KEYB_USAGE_SEMICOLON   0x33

§ HID_KEYB_USAGE_FQUOTE

#define HID_KEYB_USAGE_FQUOTE   0x34

§ HID_KEYB_USAGE_BQUOTE

#define HID_KEYB_USAGE_BQUOTE   0x35

§ HID_KEYB_USAGE_COMMA

#define HID_KEYB_USAGE_COMMA   0x36

§ HID_KEYB_USAGE_PERIOD

#define HID_KEYB_USAGE_PERIOD   0x37

§ HID_KEYB_USAGE_FSLASH

#define HID_KEYB_USAGE_FSLASH   0x38

§ HID_KEYB_USAGE_CAPSLOCK

#define HID_KEYB_USAGE_CAPSLOCK   0x39

§ HID_KEYB_USAGE_F1

#define HID_KEYB_USAGE_F1   0x3A

§ HID_KEYB_USAGE_F2

#define HID_KEYB_USAGE_F2   0x3B

§ HID_KEYB_USAGE_F3

#define HID_KEYB_USAGE_F3   0x3C

§ HID_KEYB_USAGE_F4

#define HID_KEYB_USAGE_F4   0x3D

§ HID_KEYB_USAGE_F5

#define HID_KEYB_USAGE_F5   0x3E

§ HID_KEYB_USAGE_F6

#define HID_KEYB_USAGE_F6   0x3F

§ HID_KEYB_USAGE_F7

#define HID_KEYB_USAGE_F7   0x40

§ HID_KEYB_USAGE_F8

#define HID_KEYB_USAGE_F8   0x41

§ HID_KEYB_USAGE_F9

#define HID_KEYB_USAGE_F9   0x42

§ HID_KEYB_USAGE_F10

#define HID_KEYB_USAGE_F10   0x43

§ HID_KEYB_USAGE_F11

#define HID_KEYB_USAGE_F11   0x44

§ HID_KEYB_USAGE_F12

#define HID_KEYB_USAGE_F12   0x45

§ HID_KEYB_USAGE_SCROLLOCK

#define HID_KEYB_USAGE_SCROLLOCK   0x47

§ HID_KEYB_USAGE_PAGE_UP

#define HID_KEYB_USAGE_PAGE_UP   0x4B

§ HID_KEYB_USAGE_PAGE_DOWN

#define HID_KEYB_USAGE_PAGE_DOWN   0x4E

§ HID_KEYB_USAGE_RIGHT_ARROW

#define HID_KEYB_USAGE_RIGHT_ARROW   0x4F

§ HID_KEYB_USAGE_LEFT_ARROW

#define HID_KEYB_USAGE_LEFT_ARROW   0x50

§ HID_KEYB_USAGE_DOWN_ARROW

#define HID_KEYB_USAGE_DOWN_ARROW   0x51

§ HID_KEYB_USAGE_UP_ARROW

#define HID_KEYB_USAGE_UP_ARROW   0x52

§ HID_KEYB_USAGE_NUMLOCK

#define HID_KEYB_USAGE_NUMLOCK   0x53

§ HID_KEYB_USAGE_KEYPAD_SLASH

#define HID_KEYB_USAGE_KEYPAD_SLASH   0x54

§ HID_KEYB_USAGE_KEYPAD_STAR

#define HID_KEYB_USAGE_KEYPAD_STAR   0x55

§ HID_KEYB_USAGE_KEYPAD_MINUS

#define HID_KEYB_USAGE_KEYPAD_MINUS   0x56

§ HID_KEYB_USAGE_KEYPAD_PLUS

#define HID_KEYB_USAGE_KEYPAD_PLUS   0x57

§ HID_KEYB_USAGE_KEPAD_ENTER

#define HID_KEYB_USAGE_KEPAD_ENTER   0x58

§ HID_KEYB_USAGE_KEYPAD_1

#define HID_KEYB_USAGE_KEYPAD_1   0x59

§ HID_KEYB_USAGE_KEYPAD_2

#define HID_KEYB_USAGE_KEYPAD_2   0x5A

§ HID_KEYB_USAGE_KEYPAD_3

#define HID_KEYB_USAGE_KEYPAD_3   0x5B

§ HID_KEYB_USAGE_KEYPAD_4

#define HID_KEYB_USAGE_KEYPAD_4   0x5C

§ HID_KEYB_USAGE_KEYPAD_5

#define HID_KEYB_USAGE_KEYPAD_5   0x5D

§ HID_KEYB_USAGE_KEYPAD_6

#define HID_KEYB_USAGE_KEYPAD_6   0x5E

§ HID_KEYB_USAGE_KEYPAD_7

#define HID_KEYB_USAGE_KEYPAD_7   0x5F

§ HID_KEYB_USAGE_KEYPAD_8

#define HID_KEYB_USAGE_KEYPAD_8   0x60

§ HID_KEYB_USAGE_KEYPAD_9

#define HID_KEYB_USAGE_KEYPAD_9   0x61

§ HID_KEYB_USAGE_KEYPAD_0

#define HID_KEYB_USAGE_KEYPAD_0   0x62

§ HID_KEYB_USAGE_KEPAD_PERIOD

#define HID_KEYB_USAGE_KEPAD_PERIOD   0x63

§ USB_HID_COUNTRY_NONE

#define USB_HID_COUNTRY_NONE   0x00

§ USB_HID_COUNTRY_ARABIC

#define USB_HID_COUNTRY_ARABIC   0x01

§ USB_HID_COUNTRY_BELGIAN

#define USB_HID_COUNTRY_BELGIAN   0x02

§ USB_HID_COUNTRY_CANADA_BI

#define USB_HID_COUNTRY_CANADA_BI   0x03

§ USB_HID_COUNTRY_CANADA_FR

#define USB_HID_COUNTRY_CANADA_FR   0x04

§ USB_HID_COUNTRY_CZECH_REPUBLIC

#define USB_HID_COUNTRY_CZECH_REPUBLIC   0x05

§ USB_HID_COUNTRY_DANISH

#define USB_HID_COUNTRY_DANISH   0x06

§ USB_HID_COUNTRY_FINNISH

#define USB_HID_COUNTRY_FINNISH   0x07

§ USB_HID_COUNTRY_FRENCH

#define USB_HID_COUNTRY_FRENCH   0x08

§ USB_HID_COUNTRY_GERMAN

#define USB_HID_COUNTRY_GERMAN   0x09

§ USB_HID_COUNTRY_GREEK

#define USB_HID_COUNTRY_GREEK   0x0A

§ USB_HID_COUNTRY_HEBREW

#define USB_HID_COUNTRY_HEBREW   0x0B

§ USB_HID_COUNTRY_HUNGARY

#define USB_HID_COUNTRY_HUNGARY   0x0C

§ USB_HID_COUNTRY_INTERNATIONAL_ISO

#define USB_HID_COUNTRY_INTERNATIONAL_ISO   0x0D

§ USB_HID_COUNTRY_ITALIAN

#define USB_HID_COUNTRY_ITALIAN   0x0E

§ USB_HID_COUNTRY_JAPAN_KATAKANA

#define USB_HID_COUNTRY_JAPAN_KATAKANA   0x0F

§ USB_HID_COUNTRY_KOREAN

#define USB_HID_COUNTRY_KOREAN   0x10

§ USB_HID_COUNTRY_LATIN_AMERICAN

#define USB_HID_COUNTRY_LATIN_AMERICAN   0x11

§ USB_HID_COUNTRY_NETHERLANDS

#define USB_HID_COUNTRY_NETHERLANDS   0x12

§ USB_HID_COUNTRY_NORWEGIAN

#define USB_HID_COUNTRY_NORWEGIAN   0x13

§ USB_HID_COUNTRY_PERSIAN

#define USB_HID_COUNTRY_PERSIAN   0x14

§ USB_HID_COUNTRY_POLAND

#define USB_HID_COUNTRY_POLAND   0x15

§ USB_HID_COUNTRY_PORTUGUESE

#define USB_HID_COUNTRY_PORTUGUESE   0x16

§ USB_HID_COUNTRY_RUSSIA

#define USB_HID_COUNTRY_RUSSIA   0x17

§ USB_HID_COUNTRY_SLOVAKIA

#define USB_HID_COUNTRY_SLOVAKIA   0x18

§ USB_HID_COUNTRY_SPANISH

#define USB_HID_COUNTRY_SPANISH   0x19

§ USB_HID_COUNTRY_SWEDISH

#define USB_HID_COUNTRY_SWEDISH   0x1A

§ USB_HID_COUNTRY_SWISS_FRENCH

#define USB_HID_COUNTRY_SWISS_FRENCH   0x1B

§ USB_HID_COUNTRY_SWISS_GERMAN

#define USB_HID_COUNTRY_SWISS_GERMAN   0x1C

§ USB_HID_COUNTRY_SWITZERLAND

#define USB_HID_COUNTRY_SWITZERLAND   0x1D

§ USB_HID_COUNTRY_TAIWAN

#define USB_HID_COUNTRY_TAIWAN   0x1E

§ USB_HID_COUNTRY_TURKISH_Q

#define USB_HID_COUNTRY_TURKISH_Q   0x1F

§ USB_HID_COUNTRY_UK

#define USB_HID_COUNTRY_UK   0x20

§ USB_HID_COUNTRY_US

#define USB_HID_COUNTRY_US   0x21

§ USB_HID_COUNTRY_YUGOSLAVIA

#define USB_HID_COUNTRY_YUGOSLAVIA   0x22

§ USB_HID_COUNTRY_TURKISH_F

#define USB_HID_COUNTRY_TURKISH_F   0x23

§ USB_HID_INPUT_DATA

#define USB_HID_INPUT_DATA   0x0000

§ USB_HID_INPUT_CONSTANT

#define USB_HID_INPUT_CONSTANT   0x0001

§ USB_HID_INPUT_ARRAY

#define USB_HID_INPUT_ARRAY   0x0000

§ USB_HID_INPUT_VARIABLE

#define USB_HID_INPUT_VARIABLE   0x0002

§ USB_HID_INPUT_ABS

#define USB_HID_INPUT_ABS   0x0000

§ USB_HID_INPUT_RELATIVE

#define USB_HID_INPUT_RELATIVE   0x0004

§ USB_HID_INPUT_NOWRAP

#define USB_HID_INPUT_NOWRAP   0x0000

§ USB_HID_INPUT_WRAP

#define USB_HID_INPUT_WRAP   0x0008

§ USB_HID_INPUT_LINEAR

#define USB_HID_INPUT_LINEAR   0x0000

§ USB_HID_INPUT_NONLINEAR

#define USB_HID_INPUT_NONLINEAR   0x0010

§ USB_HID_INPUT_PREFER

#define USB_HID_INPUT_PREFER   0x0000

§ USB_HID_INPUT_NONPREFER

#define USB_HID_INPUT_NONPREFER   0x0020

§ USB_HID_INPUT_NONULL

#define USB_HID_INPUT_NONULL   0x0000

§ USB_HID_INPUT_NULL

#define USB_HID_INPUT_NULL   0x0040

§ USB_HID_INPUT_BITF

#define USB_HID_INPUT_BITF   0x0100

§ USB_HID_INPUT_BYTES

#define USB_HID_INPUT_BYTES   0x0000

§ USB_HID_FEATURE_DATA

#define USB_HID_FEATURE_DATA   0x0000

§ USB_HID_FEATURE_CONSTANT

#define USB_HID_FEATURE_CONSTANT   0x0001

§ USB_HID_FEATURE_ARRAY

#define USB_HID_FEATURE_ARRAY   0x0000

§ USB_HID_FEATURE_VARIABLE

#define USB_HID_FEATURE_VARIABLE   0x0002

§ USB_HID_FEATURE_ABS

#define USB_HID_FEATURE_ABS   0x0000

§ USB_HID_FEATURE_RELATIVE

#define USB_HID_FEATURE_RELATIVE   0x0004

§ USB_HID_FEATURE_NOWRAP

#define USB_HID_FEATURE_NOWRAP   0x0000

§ USB_HID_FEATURE_WRAP

#define USB_HID_FEATURE_WRAP   0x0008

§ USB_HID_FEATURE_LINEAR

#define USB_HID_FEATURE_LINEAR   0x0000

§ USB_HID_FEATURE_NONLINEAR

#define USB_HID_FEATURE_NONLINEAR   0x0010

§ USB_HID_FEATURE_PREFER

#define USB_HID_FEATURE_PREFER   0x0000

§ USB_HID_FEATURE_NONPREFER

#define USB_HID_FEATURE_NONPREFER   0x0020

§ USB_HID_FEATURE_NONULL

#define USB_HID_FEATURE_NONULL   0x0000

§ USB_HID_FEATURE_NULL

#define USB_HID_FEATURE_NULL   0x0040

§ USB_HID_FEATURE_BITF

#define USB_HID_FEATURE_BITF   0x0100

§ USB_HID_FEATURE_BYTES

#define USB_HID_FEATURE_BYTES   0x0000

§ USB_HID_OUTPUT_DATA

#define USB_HID_OUTPUT_DATA   0x0000

§ USB_HID_OUTPUT_CONSTANT

#define USB_HID_OUTPUT_CONSTANT   0x0001

§ USB_HID_OUTPUT_ARRAY

#define USB_HID_OUTPUT_ARRAY   0x0000

§ USB_HID_OUTPUT_VARIABLE

#define USB_HID_OUTPUT_VARIABLE   0x0002

§ USB_HID_OUTPUT_ABS

#define USB_HID_OUTPUT_ABS   0x0000

§ USB_HID_OUTPUT_RELATIVE

#define USB_HID_OUTPUT_RELATIVE   0x0004

§ USB_HID_OUTPUT_NOWRAP

#define USB_HID_OUTPUT_NOWRAP   0x0000

§ USB_HID_OUTPUT_WRAP

#define USB_HID_OUTPUT_WRAP   0x0008

§ USB_HID_OUTPUT_LINEAR

#define USB_HID_OUTPUT_LINEAR   0x0000

§ USB_HID_OUTPUT_NONLINEAR

#define USB_HID_OUTPUT_NONLINEAR   0x0010

§ USB_HID_OUTPUT_PREFER

#define USB_HID_OUTPUT_PREFER   0x0000

§ USB_HID_OUTPUT_NONPREFER

#define USB_HID_OUTPUT_NONPREFER   0x0020

§ USB_HID_OUTPUT_NONULL

#define USB_HID_OUTPUT_NONULL   0x0000

§ USB_HID_OUTPUT_NULL

#define USB_HID_OUTPUT_NULL   0x0040

§ USB_HID_OUTPUT_BITF

#define USB_HID_OUTPUT_BITF   0x0100

§ USB_HID_OUTPUT_BYTES

#define USB_HID_OUTPUT_BYTES   0x0000

§ USB_HID_BIAS_NOT_APPLICABLE

#define USB_HID_BIAS_NOT_APPLICABLE   0x00

§ USB_HID_BIAS_RIGHT_HAND

#define USB_HID_BIAS_RIGHT_HAND   0x01

§ USB_HID_BIAS_LEFT_HAND

#define USB_HID_BIAS_LEFT_HAND   0x02

§ USB_HID_BIAS_BOTH_HANDS

#define USB_HID_BIAS_BOTH_HANDS   0x03

§ USB_HID_BIAS_EITHER_HAND

#define USB_HID_BIAS_EITHER_HAND   0x04

§ USB_HID_DESIGNATOR_NONE

#define USB_HID_DESIGNATOR_NONE   0x00

§ USB_HID_DESIGNATOR_HAND

#define USB_HID_DESIGNATOR_HAND   0x01

§ USB_HID_DESIGNATOR_EYEBALL

#define USB_HID_DESIGNATOR_EYEBALL   0x02

§ USB_HID_DESIGNATOR_EYEBROW

#define USB_HID_DESIGNATOR_EYEBROW   0x03

§ USB_HID_DESIGNATOR_EYELID

#define USB_HID_DESIGNATOR_EYELID   0x04

§ USB_HID_DESIGNATOR_EAR

#define USB_HID_DESIGNATOR_EAR   0x05

§ USB_HID_DESIGNATOR_NOSE

#define USB_HID_DESIGNATOR_NOSE   0x06

§ USB_HID_DESIGNATOR_MOUTH

#define USB_HID_DESIGNATOR_MOUTH   0x07

§ USB_HID_DESIGNATOR_UPPER_LIP

#define USB_HID_DESIGNATOR_UPPER_LIP   0x08

§ USB_HID_DESIGNATOR_LOWER_LIP

#define USB_HID_DESIGNATOR_LOWER_LIP   0x09

§ USB_HID_DESIGNATOR_JAW

#define USB_HID_DESIGNATOR_JAW   0x0A

§ USB_HID_DESIGNATOR_NECK

#define USB_HID_DESIGNATOR_NECK   0x0B

§ USB_HID_DESIGNATOR_UPPER_ARM

#define USB_HID_DESIGNATOR_UPPER_ARM   0x0C

§ USB_HID_DESIGNATOR_ELBOW

#define USB_HID_DESIGNATOR_ELBOW   0x0D

§ USB_HID_DESIGNATOR_FOREARM

#define USB_HID_DESIGNATOR_FOREARM   0x0E

§ USB_HID_DESIGNATOR_WRIST

#define USB_HID_DESIGNATOR_WRIST   0x0F

§ USB_HID_DESIGNATOR_PALM

#define USB_HID_DESIGNATOR_PALM   0x10

§ USB_HID_DESIGNATOR_THUMB

#define USB_HID_DESIGNATOR_THUMB   0x11

§ USB_HID_DESIGNATOR_INDEX_FINGER

#define USB_HID_DESIGNATOR_INDEX_FINGER   0x12

§ USB_HID_DESIGNATOR_MIDDLE_FINGER

#define USB_HID_DESIGNATOR_MIDDLE_FINGER   0x13

§ USB_HID_DESIGNATOR_RING_FINGER

#define USB_HID_DESIGNATOR_RING_FINGER   0x14

§ USB_HID_DESIGNATOR_LITTLE_FINGER

#define USB_HID_DESIGNATOR_LITTLE_FINGER   0x15

§ USB_HID_DESIGNATOR_HEAD

#define USB_HID_DESIGNATOR_HEAD   0x16

§ USB_HID_DESIGNATOR_SHOULDER

#define USB_HID_DESIGNATOR_SHOULDER   0x17

§ USB_HID_DESIGNATOR_HIP

#define USB_HID_DESIGNATOR_HIP   0x18

§ USB_HID_DESIGNATOR_WAIST

#define USB_HID_DESIGNATOR_WAIST   0x19

§ USB_HID_DESIGNATOR_THIGH

#define USB_HID_DESIGNATOR_THIGH   0x1A

§ USB_HID_DESIGNATOR_KNEE

#define USB_HID_DESIGNATOR_KNEE   0x1B

§ USB_HID_DESIGNATOR_CALF

#define USB_HID_DESIGNATOR_CALF   0x1C

§ USB_HID_DESIGNATOR_ANKLE

#define USB_HID_DESIGNATOR_ANKLE   0x1D

§ USB_HID_DESIGNATOR_FOOT

#define USB_HID_DESIGNATOR_FOOT   0x1E

§ USB_HID_DESIGNATOR_HEEL

#define USB_HID_DESIGNATOR_HEEL   0x1F

§ USB_HID_DESIGNATOR_BALL_OF_FOOT

#define USB_HID_DESIGNATOR_BALL_OF_FOOT   0x20

§ USB_HID_DESIGNATOR_BIG_TOE

#define USB_HID_DESIGNATOR_BIG_TOE   0x21

§ USB_HID_DESIGNATOR_SECOND_TOE

#define USB_HID_DESIGNATOR_SECOND_TOE   0x22

§ USB_HID_DESIGNATOR_THIRD_TOE

#define USB_HID_DESIGNATOR_THIRD_TOE   0x23

§ USB_HID_DESIGNATOR_FOURTH_TOE

#define USB_HID_DESIGNATOR_FOURTH_TOE   0x24

§ USB_HID_DESIGNATOR_LITTLE_TOE

#define USB_HID_DESIGNATOR_LITTLE_TOE   0x25

§ USB_HID_DESIGNATOR_BROW

#define USB_HID_DESIGNATOR_BROW   0x26

§ USB_HID_DESIGNATOR_CHEEK

#define USB_HID_DESIGNATOR_CHEEK   0x27

§ USB_HID_QUALIFIER_NOT_APPLICABLE

#define USB_HID_QUALIFIER_NOT_APPLICABLE   (0x00 << 5)

§ USB_HID_QUALIFIER_RIGHT

#define USB_HID_QUALIFIER_RIGHT   (0x01 << 5)

§ USB_HID_QUALIFIER_LEFT

#define USB_HID_QUALIFIER_LEFT   (0x02 << 5)

§ USB_HID_QUALIFIER_BOTH

#define USB_HID_QUALIFIER_BOTH   (0x03 << 5)

§ USB_HID_QUALIFIER_EITHER

#define USB_HID_QUALIFIER_EITHER   (0x04 << 5)

§ USB_HID_QUALIFIER_CENTER

#define USB_HID_QUALIFIER_CENTER   (0x05 << 5)

§ USBH_HID_MAX_USAGE

#define USBH_HID_MAX_USAGE   256

§ USBH_HID_CAPS_ARRAY_SZ

#define USBH_HID_CAPS_ARRAY_SZ   (USBH_HID_MAX_USAGE/sizeof(uint32_t))

Enumeration Type Documentation

§ tHIDState

enum tHIDState
Enumerator
eHIDStateUnconfigured 
eHIDStateIdle 
eHIDStateWaitData 

Function Documentation

§ USBDHIDInit()

void * USBDHIDInit ( uint32_t  ui32Index,
tUSBDHIDDevice psHIDDevice 
)

Initializes HID device operation for a given USB controller.

Parameters
ui32Indexis the index of the USB controller which is to be initialized for HID device operation.
psHIDDevicepoints to a structure containing parameters customizing the operation of the HID device.

An application wishing to offer a USB HID interface to a host system must call this function to initialize the USB controller and attach the device to the USB bus. This function performs all required USB initialization.

On successful completion, this function will return the psHIDDevice pointer passed to it. This must be passed on all future calls from the application to the HID device class driver.

The USB HID device class API offers the application a report-based transmit interface for Input reports. Output reports may be received via the control endpoint or via a dedicated Interrupt OUT endpoint. If using the dedicated endpoint, report data is delivered to the application packet-by- packet. If the application uses reports longer than USBDHID_MAX_PACKET bytes and would rather receive full reports, it may use a USB buffer above the receive channel to allow full reports to be read.

Transmit Operation:

Calls to USBDHIDReportWrite() pass complete reports to the driver for transmission. These will be transmitted to the host using as many USB packets as are necessary to complete the transmission.

Once a full Input report has been acknowledged by the USB host, a USB_EVENT_TX_COMPLETE event is sent to the application transmit callback to inform it that another report may be transmitted.

Receive Operation (when using a dedicated interrupt OUT endpoint):

An incoming USB data packet will result in a call to the application callback with event USB_EVENT_RX_AVAILABLE. The application must then call USBDHIDPacketRead(), passing a buffer capable of holding the received packet. The size of the packet may be determined by calling function USBDHIDRxPacketAvailable() prior to reading the packet.

Receive Operation (when not using a dedicated OUT endpoint):

If no dedicated OUT endpoint is used, Output and Feature reports are sent from the host using the control endpoint, endpoint zero. When such a report is received, USBD_HID_EVENT_GET_REPORT_BUFFER is sent to the application which must respond with a buffer large enough to hold the report. The device class driver will then copy the received report into the supplied buffer before sending USBD_HID_EVENT_SET_REPORT to indicate that the report is now available.

Note
The application must not make any calls to the low level USB device interface if interacting with USB via the USB HID device class API. Doing so will cause unpredictable (though almost certainly unpleasant) behavior.
Returns
Returns NULL on failure or the psHIDDevice pointer on success.

References tUSBDHIDDevice::pfnRxCallback, tUSBDHIDDevice::pfnTxCallback, tUSBDHIDDevice::ppui8ClassDescriptors, tUSBDHIDDevice::ppui8StringDescriptors, tUSBDHIDDevice::psHIDDescriptor, tUSBDHIDDevice::psReportIdle, tDeviceInfo::pui8DeviceDescriptor, tHIDInstance::sDevInfo, tUSBDHIDDevice::sPrivateData, tUSBDHIDDevice::ui16PID, tUSBDHIDDevice::ui16VID, tUSBDHIDDevice::ui8NumInputReports, USBDCDInit(), and USBDHIDCompositeInit().

Referenced by USBDHIDMouseInit().

§ USBDHIDCompositeInit()

void * USBDHIDCompositeInit ( uint32_t  ui32Index,
tUSBDHIDDevice psHIDDevice,
tCompositeEntry psCompEntry 
)

Initializes HID device operation for a given USB controller.

Parameters
ui32Indexis the index of the USB controller which is to be initialized for HID device operation.
psHIDDevicepoints to a structure containing parameters customizing the operation of the HID device.
psCompEntryis the composite device entry to initialize when creating a composite device.

USB HID device classes call this function to initialize the lower level HID interface in the USB controller. If this HID device device is part of a composite device, then the psCompEntry should point to the composite device entry to initialize. This is part of the array that is passed to the USBDCompositeInit() function.

Returns
Returns zero on failure or a non-zero instance value that should be used with the remaining USB HID APIs.

References tHIDInstance::bConnected, tHIDInstance::bGetRequestPending, tHIDInstance::bSendInProgress, eHIDStateUnconfigured, g_pui8HIDDeviceDescriptor, g_sHIDHandlers, tHIDInstance::iHIDRxState, tHIDInstance::iHIDTxState, tUSBDHIDDevice::pfnRxCallback, tUSBDHIDDevice::pfnTxCallback, tUSBDHIDDevice::ppsConfigDescriptor, tDeviceInfo::ppsConfigDescriptors, tUSBDHIDDevice::ppui8ClassDescriptors, tDeviceInfo::ppui8StringDescriptors, tUSBDHIDDevice::ppui8StringDescriptors, tDeviceInfo::psCallbacks, tCompositeEntry::psDevInfo, tUSBDHIDDevice::psHIDDescriptor, tUSBDHIDDevice::psReportIdle, tDeviceInfo::pui8DeviceDescriptor, tHIDInstance::pui8InReportData, tHIDInstance::pui8OutReportData, tCompositeEntry::pvInstance, tHIDInstance::sDevInfo, tUSBDHIDDevice::sPrivateData, tHIDInstance::ui16DeferredOpFlags, tHIDInstance::ui16InReportIndex, tHIDInstance::ui16InReportSize, tHIDInstance::ui16OutReportSize, tDeviceInfo::ui32NumStringDescriptors, tUSBDHIDDevice::ui32NumStringDescriptors, tHIDInstance::ui32USBBase, tHIDInstance::ui8INEndpoint, tHIDInstance::ui8Interface, tUSBDHIDDevice::ui8NumInputReports, tHIDInstance::ui8OUTEndpoint, USBDCDConfigGetInterfaceEndpoint(), and USBDCDDeviceInfoInit().

Referenced by USBDHIDInit().

§ USBDHIDTerm()

void USBDHIDTerm ( void *  pvHIDInstance)

Shuts down the HID device.

Parameters
pvHIDInstanceis the pointer to the device instance structure as returned by USBDHIDInit().

This function terminates HID operation for the instance supplied and removes the device from the USB bus. This function should not be called if the HID device is part of a composite device and instead the USBDCompositeTerm() function should be called for the full composite device.

Following this call, the pvHIDInstance instance should not me used in any other calls.

Returns
None.

References tHIDInstance::ui32USBBase, USBBaseToIndex, and USBDCDTerm().

Referenced by USBDHIDGamepadTerm(), USBDHIDKeyboardTerm(), USBDHIDMouseTerm(), and USBDHIDSensorTerm().

§ USBDHIDSetRxCBData()

void * USBDHIDSetRxCBData ( void *  pvHIDInstance,
void *  pvCBData 
)

Sets the client-specific pointer parameter for the receive channel callback.

Parameters
pvHIDInstanceis the pointer to the device instance structure as returned by USBDHIDInit().
pvCBDatais the pointer that client wishes to be provided on each event sent to the receive channel callback function.

The client uses this function to change the callback pointer passed in the first parameter on all callbacks to the pfnRxCallback function passed on USBDHIDInit().

If a client wants to make runtime changes in the callback pointer, it must ensure that the pvHIDInstance structure passed to USBDHIDInit() resides in RAM. If this structure is in flash, callback data changes will not be possible.

Returns
Returns the previous callback pointer that was being used for this instance's receive callback.

§ USBDHIDSetTxCBData()

void * USBDHIDSetTxCBData ( void *  pvHIDInstance,
void *  pvCBData 
)

Sets the client-specific data pointer for the transmit callback.

Parameters
pvHIDInstanceis the pointer to the device instance structure as returned by USBDHIDInit().
pvCBDatais the pointer that client wishes to be provided on each event sent to the transmit channel callback function.

The client uses this function to change the callback data pointer passed in the first parameter on all callbacks to the pfnTxCallback function passed on USBDHIDInit().

If a client wants to make runtime changes in the callback data, it must ensure that the pvHIDInstance structure passed to USBDHIDInit() resides in RAM. If this structure is in flash, callback data changes will not be possible.

Returns
Returns the previous callback data pointer that was being used for this instance's transmit callback.

§ USBDHIDReportWrite()

uint32_t USBDHIDReportWrite ( void *  pvHIDInstance,
uint8_t *  pi8Data,
uint32_t  ui32Length,
bool  bLast 
)

Transmits a HID device report to the USB host via the HID interrupt IN endpoint.

Parameters
pvHIDInstanceis the pointer to the device instance structure as returned by USBDHIDInit().
pi8Datapoints to the first byte of data which is to be transmitted.
ui32Lengthis the number of bytes of data to transmit.
bLastis ignored in this implementation. This parameter is required to ensure compatibility with other device class drivers and USB buffers.

This function schedules the supplied data for transmission to the USB host in a single USB transaction using as many packets as it takes to send all the data in the report. If no transmission is currently ongoing, the first packet of data is immediately copied to the relevant USB endpoint FIFO for transmission. Whenever all the report data has been acknowledged by the host, a USB_EVENT_TX_COMPLETE event will be sent to the application transmit callback indicating that another report can now be transmitted.

The caller must ensure that the data pointed to by pui8Data remains accessible and unaltered until the USB_EVENT_TX_COMPLETE is received.

Returns
Returns the number of bytes actually scheduled for transmission. At this level, this will either be the number of bytes passed or 0 to indicate a failure.

References tHIDInstance::bSendInProgress, eHIDStateIdle, and tHIDInstance::iHIDTxState.

Referenced by USBDHIDGamepadSendReport(), USBDHIDMouseStateChange(), and USBDHIDSensorSendReport().

§ USBDHIDPacketRead()

uint32_t USBDHIDPacketRead ( void *  pvHIDInstance,
uint8_t *  pi8Data,
uint32_t  ui32Length,
bool  bLast 
)

Reads a packet of data received from the USB host via the interrupt OUT endpoint (if in use).

Parameters
pvHIDInstanceis the pointer to the device instance structure as returned by USBDHIDInit().
pi8Datapoints to a buffer into which the received data will be written.
ui32Lengthis the size of the buffer pointed to by pi8Data.
bLastindicates whether the client will make a further call to read additional data from the packet.

This function reads up to ui32Length bytes of data received from the USB host into the supplied application buffer. If the driver detects that the entire packet has been read, it is acknowledged to the host.

The bLast parameter is ignored in this implementation since the end of a packet can be determined without relying upon the client to provide this information.

Returns
Returns the number of bytes of data read.

References tHIDInstance::ui32USBBase, and tHIDInstance::ui8OUTEndpoint.

§ USBDHIDTxPacketAvailable()

uint32_t USBDHIDTxPacketAvailable ( void *  pvHIDInstance)

Returns the number of free bytes in the transmit buffer.

Parameters
pvHIDInstanceis the pointer to the device instance structure as returned by USBDHIDInit().

This function indicates to the caller whether or not it is safe to send a new report using a call to USBDHIDReportWrite(). The value returned will be the maximum USB packet size (USBDHID_MAX_PACKET) if no transmission is currently outstanding or 0 if a transmission is in progress. Since the function USBDHIDReportWrite() can accept full reports longer than a single USB packet, the caller should be aware that the returned value from this class driver, unlike others, does not indicate the maximum size of report that can be written but is merely an indication that another report can be written.

Returns
Returns 0 if an outgoing report is still being transmitted or USBDHID_MAX_PACKET if no transmission is currently in progress.

References eHIDStateIdle, tHIDInstance::iHIDTxState, and USBDHID_MAX_PACKET.

Referenced by USBDHIDGamepadSendReport(), USBDHIDMouseStateChange(), and USBDHIDSensorSendReport().

§ USBDHIDRxPacketAvailable()

uint32_t USBDHIDRxPacketAvailable ( void *  pvHIDInstance)

Determines whether a packet is available and, if so, the size of the buffer required to read it.

Parameters
pvHIDInstanceis the pointer to the device instance structure as returned by USBDHIDInit().

This function may be used to determine if a received packet remains to be read and allows the application to determine the buffer size needed to read the data.

Returns
Returns 0 if no received packet remains unprocessed or the size of the packet if a packet is waiting to be read.

References tHIDInstance::ui32USBBase, and tHIDInstance::ui8OUTEndpoint.

§ USBDHIDPowerStatusSet()

void USBDHIDPowerStatusSet ( void *  pvHIDInstance,
uint8_t  ui8Power 
)

Reports the device power status (bus- or self-powered) to the USB library.

Parameters
pvHIDInstanceis the pointer to the HID device instance structure.
ui8Powerindicates the current power status, either USB_STATUS_SELF_PWR or USB_STATUS_BUS_PWR.

Applications which support switching between bus- or self-powered operation should call this function whenever the power source changes to indicate the current power status to the USB library. This information is required by the USB library to allow correct responses to be provided when the host requests status from the device.

Returns
None.

References USBDCDPowerStatusSet().

Referenced by USBDHIDKeyboardPowerStatusSet(), and USBDHIDMousePowerStatusSet().

§ USBDHIDRemoteWakeupRequest()

bool USBDHIDRemoteWakeupRequest ( void *  pvHIDInstance)

Requests a remote wake up to resume communication when in suspended state.

Parameters
pvHIDInstanceis the pointer to the HID device instance structure.

When the bus is suspended, an application which supports remote wake up (advertised to the host via the configuration descriptor) may call this function to initiate remote wake up signaling to the host. If the remote wake up feature has not been disabled by the host, this will cause the bus to resume operation within 20mS. If the host has disabled remote wake up, false will be returned to indicate that the wake up request was not successful.

Returns
Returns true if the remote wake up is not disabled and the signaling was started or false if remote wake up is disabled or if signaling is currently ongoing following a previous call to this function.

References USBDCDRemoteWakeupRequest().

Referenced by USBDHIDKeyboardRemoteWakeupRequest(), and USBDHIDMouseRemoteWakeupRequest().

Variable Documentation

§ g_pui8HIDDeviceDescriptor

uint8_t g_pui8HIDDeviceDescriptor[]
Initial value:
=
{
18,
USBShort(0x110),
0,
USBShort(0),
USBShort(0),
USBShort(0x100),
1,
2,
3,
1
}
#define USB_HID_PROTOCOL_NONE
Definition: usbhid.h:57
#define USBDHID_MAX_PACKET
Definition: usbdhid.h:666
#define USBShort(ui16Value)
Definition: usblib.h:834
#define USB_CLASS_DEVICE
Definition: usblib.h:419
#define USB_DTYPE_DEVICE
Definition: usblib.h:280

Referenced by USBDHIDCompositeInit().

§ g_sHIDHandlers

const tCustomHandlers g_sHIDHandlers

Referenced by USBDHIDCompositeInit().

§ g_sUSKeyboardMap

const tHIDKeyboardUsageTable g_sUSKeyboardMap
© Copyright 1995-2020, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale