USBLibAPIGuide
1.00.00.01
|
Data Structures | |
struct | tHIDInstance |
struct | tHIDReportIdle |
struct | tUSBDHIDDevice |
struct | PACKED |
USB_CDC_GET/SET_LINE_CODING request-specific data. More... | |
struct | tHIDKeyboardUsageTable |
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 |
#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 |
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.
#define UsagePage | ( | ui8Value | ) | 0x05, ((ui8Value) & 0xff) |
This is a macro to assist adding Usage Page entries in HID report descriptors.
ui8Value | is 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.
#define UsagePageVendor | ( | ui16Value | ) |
This is a macro to assist adding Usage Page entries in HID report descriptors when a vendor-specific value is to be used.
ui16Value | is 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.
#define Usage | ( | ui8Value | ) | 0x09, ((ui8Value) & 0xff) |
This is a macro to assist adding Usage entries in HID report descriptors.
ui8Value | is 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.
#define UsageVendor | ( | ui16Value | ) |
This is a macro to assist adding vendor-specific Usage entries in HID report descriptors.
ui16Value | is 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.
#define UsageMinimum | ( | ui8Value | ) | 0x19, ((ui8Value) & 0xff) |
This is a macro to assist adding Usage Minimum entries in HID report descriptors.
ui8Value | is 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.
#define UsageMaximum | ( | ui8Value | ) | 0x29, ((ui8Value) & 0xff) |
This is a macro to assist adding Usage Maximum entries in HID report descriptors.
ui8Value | is 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.
#define LogicalMinimum | ( | i8Value | ) | 0x15, ((i8Value) & 0xff) |
This is a macro to assist adding Logical Minimum entries in HID report descriptors.
i8Value | is 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.
#define LogicalMaximum | ( | i8Value | ) | 0x25, ((i8Value) & 0xff) |
This is a macro to assist adding Logical Maximum entries in HID report descriptors.
i8Value | is 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.
#define LogicalMinimum16 | ( | i8Value, | |
i8Value1 | |||
) | 0x16, i8Value, i8Value1 |
#define LogicalMaximum16 | ( | i8Value, | |
i8Value1 | |||
) | 0x26, i8Value, i8Value1 |
#define LogicalMaximum32 | ( | i8Value, | |
i8Value1, | |||
i8Value2, | |||
i8Value3 | |||
) |
#define PhysicalMinimum | ( | i16Value | ) |
This is a macro to assist adding Physical Minimum entries in HID report descriptors.
i16Value | is 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.
#define PhysicalMaximum | ( | i16Value | ) |
This is a macro to assist adding Physical Maximum entries in HID report descriptors.
i16Value | is 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.
#define Collection | ( | ui8Value | ) | 0xa1, ((ui8Value) & 0xff) |
This is a macro to assist adding Collection entries in HID report descriptors.
ui8Value | is 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.
#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.
#define ReportCount | ( | ui8Value | ) | 0x95, ((ui8Value) & 0xff) |
This is a macro to assist adding Report Count entries in HID report descriptors.
ui8Value | is 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.
#define ReportID | ( | ui8Value | ) | 0x85, ((ui8Value) & 0xff) |
This is a macro to assist adding Report ID entries in HID report descriptors.
ui8Value | is 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.
#define ReportSize | ( | ui8Value | ) | 0x75, ((ui8Value) & 0xff) |
This is a macro to assist adding Report Size entries in HID report descriptors.
ui8Value | is 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.
#define Input | ( | ui8Value | ) | 0x81, ((ui8Value) & 0xff) |
This is a macro to assist adding Input entries in HID report descriptors.
ui8Value | is 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.
#define Input2 | ( | ui16Value | ) |
This is a macro to assist adding Input entries in HID report descriptors.
ui16Value | is 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.
#define Feature | ( | ui8Value | ) | 0xB1, ((ui8Value) & 0xff) |
This is a macro to assist adding Feature entries in HID report descriptors.
ui8Value | is 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.
#define Feature2 | ( | ui16Value | ) |
This is a macro to assist adding Feature entries in HID report descriptors.
ui16Value | is 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.
#define Output | ( | ui8Value | ) | 0x91, ((ui8Value) & 0xff) |
This is a macro to assist adding Output entries in HID report descriptors.
ui8Value | is 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.
#define Output2 | ( | ui16Value | ) |
This is a macro to assist adding Output entries in HID report descriptors.
ui16Value | is 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.
#define UnitExponent | ( | i8Value | ) | 0x55, ((i8Value) & 0x0f) |
This is a macro to assist adding Unit Exponent entries in HID report descriptors.
i8Value | is 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.
#define Unit | ( | ui32Value | ) |
This is a macro to assist adding Unit entries for uncommon units in HID report descriptors.
ui32Value | is 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.
#define UnitDistance_cm 0x66, 0x11, 0x00 |
This macro inserts a Unit entry for centimeters into a report descriptor.
#define UnitDistance_i 0x66, 0x13, 0x00 |
This macro inserts a Unit entry for inches into a report descriptor.
#define UnitRotation_deg 0x66, 0x14, 0x00 |
This macro inserts a Unit entry for degrees into a report descriptor.
#define UnitRotation_rad 0x66, 0x12, 0x00 |
This macro inserts a Unit entry for radians into a report descriptor.
#define UnitMass_g 0x66, 0x01, 0x01 |
This macro inserts a Unit entry for grams into a report descriptor.
#define UnitTime_s 0x66, 0x01, 0x10 |
This macro inserts a Unit entry for seconds into a report descriptor.
#define UnitTemp_K 0x67, 0x01, 0x00, 0x01, 0x00 |
This macro inserts a Unit entry for temperature in Kelvin into a report descriptor.
#define UnitTemp_F 0x67, 0x03, 0x00, 0x01, 0x00 |
This macro inserts a Unit entry for temperature in Fahrenheit into a report descriptor.
#define UnitVelocitySI 0x66, 0x11, 0xF0 |
This macro inserts a Unit entry for velocity in cm/s into a report descriptor.
#define UnitMomentumSI 0x66, 0x11, 0xF1 |
This macro inserts a Unit entry for momentum in (grams * cm)/s into a report descriptor.
#define UnitAccelerationSI 0x66, 0x11, 0xE0 |
This macro inserts a Unit entry for acceleration in cm/s**2 into a report descriptor.
#define UnitForceSI 0x66, 0x11, 0xE1 |
This macro inserts a Unit entry for force in (cm * grams)/s**2 into a report descriptor.
#define UnitEnergySI 0x66, 0x21, 0xE1 |
This macro inserts a Unit entry for energy in (grams * cm^2)/(s^2) into a report descriptor.
#define UnitAngAccelerationSI 0x66, 0x12, 0xE0 |
This macro inserts a Unit entry for angular acceleration in degrees/(s^2) into a report descriptor.
#define UnitVoltage 0x67, 0x21, 0xD1, 0xF0, 0x00 |
This macro inserts a Unit entry for voltage into a a report descriptor.
#define UnitCurrent_A 0x67, 0x01, 0x00, 0x10, 0x00 |
This macro inserts a Unit entry for voltage into a a report descriptor.
#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 |
Referenced by USBDHIDTxPacketAvailable().
#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.
#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.
#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).
#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.
#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.
#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.
#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.
#define USB_HID_SCLASS_NONE 0x00 |
Referenced by USBDHIDSensorCompositeInit().
#define USB_HID_SCLASS_BOOT 0x01 |
Referenced by USBDHIDKeyboardCompositeInit(), and USBDHIDMouseCompositeInit().
#define USB_HID_PROTOCOL_NONE 0 |
Referenced by USBDHIDSensorCompositeInit().
#define USB_HID_PROTOCOL_KEYB 1 |
Referenced by USBDHIDKeyboardCompositeInit().
#define USB_HID_PROTOCOL_MOUSE 2 |
Referenced by USBDHIDMouseCompositeInit().
#define USB_HID_DTYPE_HID 0x21 |
#define USB_HID_DTYPE_REPORT 0x22 |
Referenced by USBHHIDGetReportDescriptor().
#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 |
Referenced by USBHHIDSetReport().
#define USBREQ_SET_IDLE 0x0a |
Referenced by USBHHIDSetIdle().
#define USBREQ_SET_PROTOCOL 0x0b |
Referenced by USBHHIDSetProtocol().
#define USB_HID_REPORT_IN 0x01 |
#define USB_HID_REPORT_OUTPUT 0x02 |
Referenced by USBHHIDSetReport().
#define USB_HID_REPORT_FEATURE 0x03 |
#define USB_HID_PROTOCOL_BOOT 0 |
#define USB_HID_PROTOCOL_REPORT 1 |
Referenced by USBDHIDKeyboardCompositeInit(), and USBDHIDMouseCompositeInit().
#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 |
Referenced by USBHKeyboardUsageToChar().
#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 |
Referenced by USBDHIDKeyboardCompositeInit(), and USBDHIDKeyboardKeyStateChange().
#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)) |
enum tHIDState |
void * USBDHIDInit | ( | uint32_t | ui32Index, |
tUSBDHIDDevice * | psHIDDevice | ||
) |
Initializes HID device operation for a given USB controller.
ui32Index | is the index of the USB controller which is to be initialized for HID device operation. |
psHIDDevice | points 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.
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().
void * USBDHIDCompositeInit | ( | uint32_t | ui32Index, |
tUSBDHIDDevice * | psHIDDevice, | ||
tCompositeEntry * | psCompEntry | ||
) |
Initializes HID device operation for a given USB controller.
ui32Index | is the index of the USB controller which is to be initialized for HID device operation. |
psHIDDevice | points to a structure containing parameters customizing the operation of the HID device. |
psCompEntry | is 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.
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().
void USBDHIDTerm | ( | void * | pvHIDInstance | ) |
Shuts down the HID device.
pvHIDInstance | is 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.
References tHIDInstance::ui32USBBase, USBBaseToIndex, and USBDCDTerm().
Referenced by USBDHIDGamepadTerm(), USBDHIDKeyboardTerm(), USBDHIDMouseTerm(), and USBDHIDSensorTerm().
void * USBDHIDSetRxCBData | ( | void * | pvHIDInstance, |
void * | pvCBData | ||
) |
Sets the client-specific pointer parameter for the receive channel callback.
pvHIDInstance | is the pointer to the device instance structure as returned by USBDHIDInit(). |
pvCBData | is 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.
void * USBDHIDSetTxCBData | ( | void * | pvHIDInstance, |
void * | pvCBData | ||
) |
Sets the client-specific data pointer for the transmit callback.
pvHIDInstance | is the pointer to the device instance structure as returned by USBDHIDInit(). |
pvCBData | is 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.
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.
pvHIDInstance | is the pointer to the device instance structure as returned by USBDHIDInit(). |
pi8Data | points to the first byte of data which is to be transmitted. |
ui32Length | is the number of bytes of data to transmit. |
bLast | is 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.
References tHIDInstance::bSendInProgress, eHIDStateIdle, and tHIDInstance::iHIDTxState.
Referenced by USBDHIDGamepadSendReport(), USBDHIDMouseStateChange(), and USBDHIDSensorSendReport().
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).
pvHIDInstance | is the pointer to the device instance structure as returned by USBDHIDInit(). |
pi8Data | points to a buffer into which the received data will be written. |
ui32Length | is the size of the buffer pointed to by pi8Data. |
bLast | indicates 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.
References tHIDInstance::ui32USBBase, and tHIDInstance::ui8OUTEndpoint.
uint32_t USBDHIDTxPacketAvailable | ( | void * | pvHIDInstance | ) |
Returns the number of free bytes in the transmit buffer.
pvHIDInstance | is 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.
References eHIDStateIdle, tHIDInstance::iHIDTxState, and USBDHID_MAX_PACKET.
Referenced by USBDHIDGamepadSendReport(), USBDHIDMouseStateChange(), and USBDHIDSensorSendReport().
uint32_t USBDHIDRxPacketAvailable | ( | void * | pvHIDInstance | ) |
Determines whether a packet is available and, if so, the size of the buffer required to read it.
pvHIDInstance | is 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.
References tHIDInstance::ui32USBBase, and tHIDInstance::ui8OUTEndpoint.
void USBDHIDPowerStatusSet | ( | void * | pvHIDInstance, |
uint8_t | ui8Power | ||
) |
Reports the device power status (bus- or self-powered) to the USB library.
pvHIDInstance | is the pointer to the HID device instance structure. |
ui8Power | indicates 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.
References USBDCDPowerStatusSet().
Referenced by USBDHIDKeyboardPowerStatusSet(), and USBDHIDMousePowerStatusSet().
bool USBDHIDRemoteWakeupRequest | ( | void * | pvHIDInstance | ) |
Requests a remote wake up to resume communication when in suspended state.
pvHIDInstance | is 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.
References USBDCDRemoteWakeupRequest().
Referenced by USBDHIDKeyboardRemoteWakeupRequest(), and USBDHIDMouseRemoteWakeupRequest().
uint8_t g_pui8HIDDeviceDescriptor[] |
Referenced by USBDHIDCompositeInit().
const tCustomHandlers g_sHIDHandlers |
Referenced by USBDHIDCompositeInit().
const tHIDKeyboardUsageTable g_sUSKeyboardMap |