USBLib API Guide
1.00.00.01
|
Data Structures | |
struct | tUSBDSensorInstance |
struct | tUSBDHIDSensorDevice |
struct | PACKED |
USB_CDC_GET/SET_LINE_CODING request-specific data. More... | |
Macros | |
#define | NUM_HID_SECTIONS |
#define | USBDSENSOR_SUCCESS 0 |
More... | |
#define | USBDSENSOR_TX_ERROR 1 |
#define | USBDSENSOR_NOT_CONFIGURED 2 |
The device is not currently configured and cannot perform any operations. More... | |
Enumerations | |
enum | tSensorState { eHIDSensorStateNotConnected, eHIDSensorStateIdle, eHIDSensorStateSending } |
Functions | |
tUSBDHIDSensorDevice * | USBDHIDSensorInit (uint32_t ui32Index, tUSBDHIDSensorDevice *psHIDSensorDevice) |
tUSBDHIDSensorDevice * | USBDHIDSensorCompositeInit (uint32_t ui32Index, tUSBDHIDSensorDevice *psHIDSensorDevice, tCompositeEntry *psCompEntry) |
uint32_t | USBDHIDSensorSendReport (tUSBDHIDSensorDevice *psHIDSensor, void *pvReport, uint32_t ui32Size) |
void | USBDHIDSensorTerm (tUSBDHIDSensorDevice *psSensor) |
#define NUM_HID_SECTIONS |
#define USBDSENSOR_SUCCESS 0 |
The USBDHIDSensorSendReport() call successfully scheduled the report.
Referenced by USBDHIDSensorSendReport().
#define USBDSENSOR_TX_ERROR 1 |
The USBDHIDSensorSendReport() function could not send the report at this time.
Referenced by USBDHIDSensorSendReport().
#define USBDSENSOR_NOT_CONFIGURED 2 |
The device is not currently configured and cannot perform any operations.
Referenced by USBDHIDSensorSendReport().
enum tSensorState |
tUSBDHIDSensorDevice * USBDHIDSensorInit | ( | uint32_t | ui32Index, |
tUSBDHIDSensorDevice * | psHIDSensorDevice | ||
) |
Initializes HID sensor device operation for a given USB controller.
ui32Index | is the index of the USB controller which is to be initialized for HID sensor device operation. |
psHIDSensorDevice | points to a structure containing parameters customizing the operation of the HID Sensor device. |
An application wishing to offer a USB HID sensor interface to a USB host must call this function to initialize the USB controller and attach the sensor device to the USB bus. This function performs all required USB initialization.
On successful completion, this function returns the psHIDSensorDevice pointer passed to it. This must be passed on all future calls to the HID sensor device driver.
When a host connects and configures the device, the application callback receives USB_EVENT_CONNECTED after which sensor temp, state and event are reported back to the host.
References tUSBDHIDSensorDevice::pfnCallback, tUSBDHIDSensorDevice::ppui8StringDescriptors, tUSBDSensorInstance::sHIDDevice, tUSBDHIDSensorDevice::sPrivateData, and USBDHIDSensorCompositeInit().
tUSBDHIDSensorDevice * USBDHIDSensorCompositeInit | ( | uint32_t | ui32Index, |
tUSBDHIDSensorDevice * | psHIDSensorDevice, | ||
tCompositeEntry * | psCompEntry | ||
) |
Initializes HID sensor device operation for a given USB controller.
ui32Index | is the index of the USB controller which is to be initialized for HID sensor device operation. |
psHIDSensorDevice | points to a structure containing parameters customizing the operation of the HID sensor device. |
psCompEntry | is the composite device entry to initialize when creating a composite device. |
This call is very similar to USBDHIDSensorInit() except that it is used for initializing an instance of the HID sensor device for use in a composite device. If this HID sensor 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 eHIDSensorStateNotConnected, tUSBDSensorInstance::iState, tUSBDHIDSensorDevice::pfnCallback, tUSBDHIDDevice::pfnRxCallback, tUSBDHIDSensorDevice::ppui8StringDescriptors, tUSBDHIDDevice::psReportIdle, tUSBDSensorInstance::sHIDDevice, tUSBDHIDSensorDevice::sPrivateData, tUSBDSensorInstance::sReportIdle, tUSBDHIDSensorDevice::ui16MaxPowermA, tUSBDHIDDevice::ui16MaxPowermA, tUSBDHIDSensorDevice::ui16PID, tUSBDHIDDevice::ui16PID, tHIDReportIdle::ui16TimeTillNextmS, tUSBDHIDSensorDevice::ui16VID, tUSBDHIDDevice::ui16VID, tHIDReportIdle::ui32TimeSinceReportmS, tHIDReportIdle::ui8Duration4mS, tUSBDHIDDevice::ui8NumInputReports, tUSBDHIDDevice::ui8Protocol, tUSBDHIDSensorDevice::ui8PwrAttributes, tUSBDHIDDevice::ui8PwrAttributes, tHIDReportIdle::ui8ReportID, tUSBDHIDDevice::ui8Subclass, USB_HID_PROTOCOL_NONE, and USB_HID_SCLASS_NONE.
Referenced by USBDHIDSensorInit().
uint32_t USBDHIDSensorSendReport | ( | tUSBDHIDSensorDevice * | psHIDSensor, |
void * | pvReport, | ||
uint32_t | ui32Size | ||
) |
Schedules a report to be sent once the host requests more data.
psHIDSensor | is the structure pointer that is returned from the USBDHIDSensorCompositeInit() or USBDHIDSensorInit() functions. |
pvReport | is the data to send to the host. |
ui32Size | is the number of bytes in the pvReport buffer. |
This call is made by an application to schedule data to be sent to the host when the host requests an update from the device. The application must then wait for a USB_EVENT_TX_COMPLETE event in the function provided in the pfnCallback pointer in the tUSBDHIDSensorDevice structure before being able to send more data with this function. The pointer passed in the pvReport can be updated once this call returns as the data has been copied from the buffer. The function returns USBDSENSOR_SUCCESS if the transmission was successfully scheduled or USBDSENSOR_TX_ERROR if the report could not be sent at this time. If the call is made before the device is connected or ready to communicate with the host, then the function can return USBDSENSOR_NOT_CONFIGURED.
References eHIDSensorStateNotConnected, eHIDSensorStateSending, tUSBDSensorInstance::iState, tUSBDSensorInstance::sHIDDevice, tUSBDHIDSensorDevice::sPrivateData, USBDHIDReportWrite(), USBDHIDTxPacketAvailable(), USBDSENSOR_NOT_CONFIGURED, USBDSENSOR_SUCCESS, and USBDSENSOR_TX_ERROR.
void USBDHIDSensorTerm | ( | tUSBDHIDSensorDevice * | psSensor | ) |
Shuts down the HID Sensor device.
psSensor | is the pointer to the device instance structure as returned by USBDHIDSensorInit() or USBDHIDSensorCompositeInit(). |
This function terminates HID Sensor operation for the instance supplied and removes the device from the USB bus. Following this call, the psSensor instance may not me used in any other call to the HID Sensor device other than to reinitialize by calling USBDHIDSensorInit() or USBDHIDSensorCompositeInit().
References eHIDSensorStateNotConnected, tUSBDSensorInstance::iState, tUSBDSensorInstance::sHIDDevice, tUSBDHIDSensorDevice::sPrivateData, and USBDHIDTerm().