17
2013 Microchip Technology Inc. DS00001619A-page 1 INTRODUCTION This document provides an overview of how an application can talk to a HID vendor collection over the I 2 C interface with a Microchip embedded controller or sensor hub. HID is built on a couple of fundamental concepts, a Report Descriptor, and reports. Reports are the actual data blobs that are exchanged between a device and a software client. The Report Descriptor describes the format and meaning of each data blob that it supports. Audience This document is written for firmware designers who have a background and are familiar with the sensor platform for Windows 8.x. References The following documents should be referenced when using this application note. See your Microchip representative for availability. SSC710x PCS or Data Sheet, TBD SSC710x Demo Boards’ Schematics and User Manuals Microsoft “HID Sensor Usages” White Paper, June 14, 2013 Microsoft “Integrating Motion and Orientation Sensors” White Paper, June 10, 2013 Glossary of Terms and Acronyms This document contains the following terms, defined here for the purpose of convenience and general agreement: Term Description SDT Microsoft Sensor Diagnostic Tool Utility in Windows Driver Kit (WDK) SF Sensor Fusion FW SF Firmware Acc Accelerometer Gyro Gyroscope Mag Magnetometer AN1619 Windows 8.x HID Vendor & Custom Sensor Collection Over the I 2 C Interface Author: Tom Tse Microchip Technology

AN1619 - Microchip Technologyww1.microchip.com/downloads/en/AppNotes/00001619A.pdfHID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL, HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,

  • Upload
    lengoc

  • View
    223

  • Download
    1

Embed Size (px)

Citation preview

Page 1: AN1619 - Microchip Technologyww1.microchip.com/downloads/en/AppNotes/00001619A.pdfHID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL, HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,

AN1619Windows 8.x HID Vendor & Custom Sensor

Collection Over the I2C Interface

INTRODUCTIONThis document provides an overview of how an application can talk to a HID vendor collection over the I2C interface with a Microchip embedded controller or sensor hub.

HID is built on a couple of fundamental concepts, a Report Descriptor, and reports. Reports are the actual data blobs that are exchanged between a device and a software client. The Report Descriptor describes the format and meaning of each data blob that it supports.

AudienceThis document is written for firmware designers who have a background and are familiar with the sensor platform for Windows 8.x.

ReferencesThe following documents should be referenced when using this application note. See your Microchip representative for availability.

• SSC710x PCS or Data Sheet, TBD• SSC710x Demo Boards’ Schematics and User Manuals• Microsoft “HID Sensor Usages” White Paper, June 14, 2013• Microsoft “Integrating Motion and Orientation Sensors” White Paper, June 10, 2013

Glossary of Terms and AcronymsThis document contains the following terms, defined here for the purpose of convenience and general agreement:

Term Description

SDT Microsoft Sensor Diagnostic Tool Utility in Windows Driver Kit (WDK)SF Sensor FusionFW SF FirmwareAcc AccelerometerGyro GyroscopeMag Magnetometer

Author: Tom Tse Microchip Technology

2013 Microchip Technology Inc. DS00001619A-page 1

Page 2: AN1619 - Microchip Technologyww1.microchip.com/downloads/en/AppNotes/00001619A.pdfHID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL, HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,

AN1619

VENDOR TOP LEVEL COLLECTIONSThe Report Descriptor will describe one or more Top Level Collections. A Top Level Collection is a grouping of function-ality that targets a particular software consumer (or type of consumer) of the functionality. The device describes the pur-pose of each particular Top Level Collection in order to allow consumers of HID functionality to identify Top Level Collections that they might be interested in.

For example, a Top Level Collection may be described as a Keyboard, Mouse, Consumer Control, Sensor, Display, etc. In the HID specification, these Top Level Collections are also referred to as Application Collections. In Windows, HID-CLASS will generate a unique PDO (physical device object) for each Top Level Collection described by the Report Descriptor.

In Windows 8, there is an in-box user mode Sensor HID Class driver that operates on the Sensor collection.

It is possible to define a vendor collection in the device firmware. The HIDCLASS driver will create a PDO for this. This object can be operated upon from the user space using the HID.dll and HIDClass Support Routines.

Some possible usages (and not limited to) of Vendor collection in a Sensor Hub are as follows:

• Firmware update• Acquisition of raw sensor readings• Updating sensor calibration coefficients

WINDOWS 8 HID ARCHITECTURE

FIGURE 1: BLOCK DIAGRAM

DS00001619A-page 2 2013 Microchip Technology Inc.

Page 3: AN1619 - Microchip Technologyww1.microchip.com/downloads/en/AppNotes/00001619A.pdfHID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL, HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,

AN1619

The HID driver stack in Windows is built on the class driver named HIDCLASS.SYS. Clients and transport minidrivers access the class driver from user-mode or kernel-mode.

The block diagram above includes the following:

• HID Clients – Identifies the Windows and 3rd party clients and their interfaces• HIDClass driver• HID Transport Minidriver - Identifies the Windows and 3rd party transports and their interfaces.

The system-supplied HID class driver is the WDM function driver and bus driver for the HIDClass device setup class. The executable image of the HID class driver is hidclass.sys. The HID Class driver is the glue between HID clients and various transports. This allows a HID Client to be written in an independent way from transports. This level of abstraction allows clients to work (with little to no modifications) when a new standard or 3rd party transport is introduced.

SENSOR HID CLASS DRIVERThe inbox sensor HID class driver (SensorsHIDClassDriver.dll) ships with Windows 8 and supports seven categories of sensors running over the HID transport:

• Biometric• Electrical• Environmental• Light• Mechanical• Motion• Orientation

The Sensor HID Top-level collection in the device is opened for use by the Sensor HID Class Driver.

2013 Microchip Technology Inc. DS00001619A-page 3

Page 4: AN1619 - Microchip Technologyww1.microchip.com/downloads/en/AppNotes/00001619A.pdfHID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL, HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,

AN1619

SENSOR HUB – HID VENDOR COLLECTION

The device in above block diagram has only one slave address and only one Alert line connected to Host.

FIGURE 2: BLOCK DIAGRAM SHOWING SENSOR COLLECTION AND VENDOR COLLECTION IN THE SENSOR HUB DEVICE

DS00001619A-page 4 2013 Microchip Technology Inc.

Page 5: AN1619 - Microchip Technologyww1.microchip.com/downloads/en/AppNotes/00001619A.pdfHID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL, HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,

AN1619

DEFINING THE VENDOR COLLECTIONThe Vendor collection could be defined to simply consist of one input report and one output report, each of 32 bytes as follows:

FIGURE 3: VENDOR COLLECTION DEFINITION

2013 Microchip Technology Inc. DS00001619A-page 5

Page 6: AN1619 - Microchip Technologyww1.microchip.com/downloads/en/AppNotes/00001619A.pdfHID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL, HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,

AN1619

WINDOWS 8 DEVICE MANAGER VIEW

FIGURE 4: WITH ONLY SENSOR COLLECTION

FIGURE 5: WITH BOTH SENSOR COLLECTION AND VENDOR COLLECTION

DS00001619A-page 6 2013 Microchip Technology Inc.

Page 7: AN1619 - Microchip Technologyww1.microchip.com/downloads/en/AppNotes/00001619A.pdfHID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL, HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,

AN1619

SENSORS RAW DATA ACQUISITIONCustomers can use either sensor collection or vendor collection to acquire the raw data of sensors including acceler-ometer, gyroscope, and magnetometer. Raw data is the data from the sensors prior to SF algorithm processing.

Using The Vendor Collection Using the vendor collection, it is possible to acquire the sensors raw data from a Windows 8 application. This is helpful for calibration and debugging purposes.

Following is a snapshot which shows the acquisition of sensor raw data from the vendor collection using a console appli-cation. The Sensor Diagnostic Tool is getting the accelerometer data from the sensors collection at the same time.

Using The Sensor Collection The following steps have been implemented in the firmware to add a Custom Sensor to acquire sensors RAW data from the SSC7102 demo board:

• Modify HID Report descriptor to incorporate Custom sensor report• Create new Input report and Feature Report structure

FIGURE 6: ACQUIRING SENSOR RAW DATA FROM THE VENDOR COLLECTION

2013 Microchip Technology Inc. DS00001619A-page 7

Page 8: AN1619 - Microchip Technologyww1.microchip.com/downloads/en/AppNotes/00001619A.pdfHID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL, HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,

AN1619

MODIFY HID DESCRIPTORThe following part has to be added to the HID Report descriptor:/* Support RAW Sensor data */HID_REPORT_ID(6),

//0x85,0x08,HID_USAGE_PAGE_SENSOR, // USAGE_PAGE (Sensor)HID_USAGE_SENSOR_TYPE_OTHER_CUSTOM, // USAGE (AmbientLight)HID_COLLECTION(Physical), // second nested sub-collection, for ALS //feature reports (xmit/receive)HID_USAGE_PAGE_SENSOR,// 1: connection typeHID_USAGE_SENSOR_PROPERTY_SENSOR_CONNECTION_TYPE, HID_LOGICAL_MIN_8(0),HID_LOGICAL_MAX_8(2),HID_REPORT_SIZE(8),HID_REPORT_COUNT(1),HID_COLLECTION(Logical),HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL,HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_EXTERNAL_SEL,HID_FEATURE(Data_Arr_Abs),HID_END_COLLECTION,// 2: reporting stateHID_USAGE_SENSOR_PROPERTY_REPORTING_STATE,HID_LOGICAL_MIN_8(0),HID_LOGICAL_MAX_8(5),HID_REPORT_SIZE(8),HID_REPORT_COUNT(1),HID_COLLECTION(Logical), HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_SEL, HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_SEL,HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_SEL,HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_WAKE_SEL,HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_WAKE_SEL,HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_WAKE_SEL,HID_FEATURE(Data_Arr_Abs),HID_END_COLLECTION,// 3: power stateHID_USAGE_SENSOR_PROPERTY_POWER_STATE,HID_LOGICAL_MIN_8(0),HID_LOGICAL_MAX_8(5),HID_REPORT_SIZE(8),HID_REPORT_COUNT(1),HID_COLLECTION(Logical),HID_USAGE_SENSOR_PROPERTY_POWER_STATE_UNDEFINED_SEL, HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D0_FULL_POWER_SEL, HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D1_LOW_POWER_SEL, HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D2_STANDBY_WITH_WAKE_SEL,HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D3_SLEEP_WITH_WAKE_SEL, HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D4_POWER_OFF_SEL, HID_FEATURE(Data_Arr_Abs),HID_END_COLLECTION,// 4: sensor stateHID_USAGE_SENSOR_STATE,HID_LOGICAL_MIN_8(0),HID_LOGICAL_MAX_8(6),HID_REPORT_SIZE(8),HID_REPORT_COUNT(1),HID_COLLECTION(Logical),HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,HID_USAGE_SENSOR_STATE_READY_SEL,HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,HID_USAGE_SENSOR_STATE_NO_DATA_SEL,HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,

DS00001619A-page 8 2013 Microchip Technology Inc.

Page 9: AN1619 - Microchip Technologyww1.microchip.com/downloads/en/AppNotes/00001619A.pdfHID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL, HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,

AN1619

HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,HID_USAGE_SENSOR_STATE_ERROR_SEL,HID_FEATURE(Data_Arr_Abs),HID_END_COLLECTION,// 5: report intervalHID_USAGE_SENSOR_PROPERTY_REPORT_INTERVAL,HID_LOGICAL_MIN_8(0),HID_LOGICAL_MAX_16(0xFF,0xFF),HID_REPORT_SIZE(16),HID_REPORT_COUNT(1),HID_UNIT_EXPONENT(0), HID_FEATURE(Data_Var_Abs),// 6: accuracyHID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_CUSTOM_VALUE,HID_USAGE_SENSOR_DATA_MOD_ACCURACY),HID_LOGICAL_MIN_8(0),HID_LOGICAL_MAX_16(0xFF,0xFF),HID_REPORT_SIZE(16),HID_REPORT_COUNT(1),//HID_UNIT_EXPONENT(0x0D), HID_UNIT_EXPONENT(0x00), HID_FEATURE(Data_Var_Abs),// 7: resolution

HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_CUSTOM_VALUE,HID_USAGE_SENSOR_DATA_MOD_RESOLUTION),HID_LOGICAL_MIN_8(0),HID_LOGICAL_MAX_16(0xFF,0xFF),HID_REPORT_SIZE(16),HID_REPORT_COUNT(1),//HID_UNIT_EXPONENT(0x0D), HID_UNIT_EXPONENT(0x00), HID_FEATURE(Data_Var_Abs),// 8: change sensitivity

HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_CUSTOM_VALUE,HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS),

HID_LOGICAL_MIN_8(0),HID_LOGICAL_MAX_16(0xFF,0xFF),HID_REPORT_SIZE(16),HID_REPORT_COUNT(1),//HID_UNIT_EXPONENT(0x0D), HID_UNIT_EXPONENT(0x00), HID_FEATURE(Data_Var_Abs),// 9: maxHID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_CUSTOM_VALUE,HID_USAGE_SENSOR_DATA_MOD_MAX),HID_LOGICAL_MIN_16(0x01,0x80),HID_LOGICAL_MAX_16(0xFF,0x7F),HID_REPORT_SIZE(16),HID_REPORT_COUNT(1),HID_USAGE_SENSOR_UNITS_NOT_SPECIFIED,//HID_UNIT_EXPONENT(0x0F), // scale unit to provide 1 digit past the decimal pointHID_UNIT_EXPONENT(0x00), // not scaleHID_FEATURE(Data_Var_Abs),// 10: minHID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_CUSTOM_VALUE,HID_USAGE_SENSOR_DATA_MOD_MIN),HID_LOGICAL_MIN_16(0x01,0x80),HID_LOGICAL_MAX_16(0xFF,0x7F),HID_REPORT_SIZE(16),HID_REPORT_COUNT(1),HID_USAGE_SENSOR_UNITS_NOT_SPECIFIED,//HID_UNIT_EXPONENT(0x0F), // scale unit to provide 1 digit past the decimal pointHID_UNIT_EXPONENT(0x00), // not scaleHID_FEATURE(Data_Var_Abs),

//input reports (transmit)HID_USAGE_PAGE_SENSOR,// 1: sensor state

2013 Microchip Technology Inc. DS00001619A-page 9

Page 10: AN1619 - Microchip Technologyww1.microchip.com/downloads/en/AppNotes/00001619A.pdfHID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL, HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,

AN1619

HID_USAGE_SENSOR_STATE,HID_LOGICAL_MIN_8(0),HID_LOGICAL_MAX_8(6),HID_REPORT_SIZE(8),HID_REPORT_COUNT(1),HID_COLLECTION(Logical),HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,HID_USAGE_SENSOR_STATE_READY_SEL,HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,HID_USAGE_SENSOR_STATE_NO_DATA_SEL,HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,HID_USAGE_SENSOR_STATE_ERROR_SEL,HID_INPUT(Data_Arr_Abs),HID_END_COLLECTION,// 2: event typeHID_USAGE_SENSOR_EVENT,HID_LOGICAL_MIN_8(0),HID_LOGICAL_MAX_8(5),HID_REPORT_SIZE(8),HID_REPORT_COUNT(1),HID_COLLECTION(Logical),HID_USAGE_SENSOR_EVENT_UNKNOWN_SEL,HID_USAGE_SENSOR_EVENT_STATE_CHANGED_SEL,HID_USAGE_SENSOR_EVENT_PROPERTY_CHANGED_SEL,HID_USAGE_SENSOR_EVENT_DATA_UPDATED_SEL,HID_USAGE_SENSOR_EVENT_POLL_RESPONSE_SEL,HID_USAGE_SENSOR_EVENT_CHANGE_SENSITIVITY_SEL,HID_INPUT(Data_Arr_Abs),HID_END_COLLECTION,//Data fields for Input report starts here// 3: Accelerometer Raw data : X AxisHID_USAGE_SENSOR_DATA_CUSTOM_VALUE_1,HID_LOGICAL_MIN_16(0x01,0x80),HID_LOGICAL_MAX_16(0xFF,0x7F),HID_REPORT_SIZE(16),HID_REPORT_COUNT(1),HID_UNIT_EXPONENT(0x0F),HID_INPUT(Data_Var_Abs),// 4: Accelerometer Raw data : Y AxisHID_USAGE_SENSOR_DATA_CUSTOM_VALUE_2,HID_LOGICAL_MIN_16(0x01, 0x80),HID_LOGICAL_MAX_16(0xFF, 0x7F),HID_REPORT_SIZE(16),HID_REPORT_COUNT(1), //8HID_UNIT_EXPONENT(0x0F),HID_INPUT(Data_Var_Abs),// 5: Accelerometer Raw data : Z AxisHID_USAGE_SENSOR_DATA_CUSTOM_VALUE_3,HID_LOGICAL_MIN_16(0x01,0x80),HID_LOGICAL_MAX_16(0xFF,0x7F),HID_REPORT_SIZE(16),HID_REPORT_COUNT(1),HID_UNIT_EXPONENT(0x0F),HID_INPUT(Data_Var_Abs),// 6: Magnetometer Raw data : X AxisHID_USAGE_SENSOR_DATA_CUSTOM_VALUE_4,HID_LOGICAL_MIN_16(0x01, 0x80),HID_LOGICAL_MAX_16(0xFF, 0x7F),HID_REPORT_SIZE(16),HID_REPORT_COUNT(1), //8HID_UNIT_EXPONENT(0x0F),HID_INPUT(Data_Var_Abs),// 7: Magnetometer Raw data : Y AxisHID_USAGE_SENSOR_DATA_CUSTOM_VALUE_5,

DS00001619A-page 10 2013 Microchip Technology Inc.

Page 11: AN1619 - Microchip Technologyww1.microchip.com/downloads/en/AppNotes/00001619A.pdfHID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL, HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,

AN1619

HID_LOGICAL_MIN_16(0x01,0x80),HID_LOGICAL_MAX_16(0xFF,0x7F),HID_REPORT_SIZE(16),HID_REPORT_COUNT(1),HID_UNIT_EXPONENT(0x0F),HID_INPUT(Data_Var_Abs),// 8: Magnetometer Raw data : Z AxisHID_USAGE_SENSOR_DATA_CUSTOM_VALUE_6,HID_LOGICAL_MIN_16(0x01, 0x80),HID_LOGICAL_MAX_16(0xFF, 0x7F),HID_REPORT_SIZE(16),HID_REPORT_COUNT(1), //8HID_UNIT_EXPONENT(0x0F),HID_INPUT(Data_Var_Abs),// 9: Gyroometer Raw data : X AxisHID_USAGE_SENSOR_DATA_CUSTOM_VALUE_7,HID_LOGICAL_MIN_16(0x01, 0x80),HID_LOGICAL_MAX_16(0xFF, 0x7F),HID_REPORT_SIZE(16),HID_REPORT_COUNT(1), //8HID_UNIT_EXPONENT(0x0F),HID_INPUT(Data_Var_Abs),//10: Gyroometer Raw data : Y AxisHID_USAGE_SENSOR_DATA_CUSTOM_VALUE_8,HID_LOGICAL_MIN_16(0x01, 0x80),HID_LOGICAL_MAX_16(0xFF, 0x7F),HID_REPORT_SIZE(16),HID_REPORT_COUNT(1), //8HID_UNIT_EXPONENT(0x0F),HID_INPUT(Data_Var_Abs),//11: Gyroometer Raw data : Z AxisHID_USAGE_SENSOR_DATA_CUSTOM_VALUE_9,HID_LOGICAL_MIN_16(0x01, 0x80),HID_LOGICAL_MAX_16(0xFF, 0x7F),HID_REPORT_SIZE(16),HID_REPORT_COUNT(1), //8HID_UNIT_EXPONENT(0x0F),HID_INPUT(Data_Var_Abs),

HID_END_COLLECTION, // END_COLLECTION - for ID=0x08, Raw Sensor Data

Note: Be aware, in the case of custom sensors, the values supported by the HID protocol for custom sensor only supports unsigned Integer and float values for Custom sensor. This must be kept in mind while writing the Custom sensor collection.

2013 Microchip Technology Inc. DS00001619A-page 11

Page 12: AN1619 - Microchip Technologyww1.microchip.com/downloads/en/AppNotes/00001619A.pdfHID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL, HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,

AN1619

INPUT REPORT AND FEATURE REPORT STRUCTURE To create a new sensor, we need to define its associated input and feature report. Even though Custom sensor is not a real sensor, we require the feature reports to pass enumeration as described below:

Following is the Feature report:RAW_FEATURE_REPORT{

HID_UCHAR ucReportId;HID_UCHAR ucConnectionType; //read onlyHID_UCHAR ucReportingState; //read onlyHID_UCHAR ucPowerState; //PCHID_UCHAR ucSensorState; //MCUHID_USHORT ulReportInterval; //PCHID_USHORT usAccuracy; //read onlyHID_USHORT usResolution; //read onlyHID_USHORT usChangeSensitivity; //MCUHID_SHORT sMaximum; //read onlyHID_SHORT sMinimum; //read only

}

To update the Raw Data to the host, we need the input reports with 9 fields - 3 each for Acc, Gyro and Mag respectively.

Following is the input report:RAW_INPUT_REPORT{

HID_UCHAR ucReportId;HID_UCHAR ucSensorState;HID_UCHAR ucEventType;HID_SHORT accX, accY, accZ; //Accelerometer Raw DataHID_SHORT magX, magY, magZ; //Magnetometer Raw DataHID_SHORT gyrX, gyrY, gyrZ; //Gyrometer Raw Data

}

DS00001619A-page 12 2013 Microchip Technology Inc.

Page 13: AN1619 - Microchip Technologyww1.microchip.com/downloads/en/AppNotes/00001619A.pdfHID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL, HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,

AN1619

Following is a snapshot which shows the acquisition of the sensor raw data from the sensor collection. The Sensor Diag-nostic Tool displays all Acc, Mag, and Gyro raw data respectively.

FIGURE 7: ACQUIRING SENSOR RAW DATA FROM THE SENSOR COLLECTION

2013 Microchip Technology Inc. DS00001619A-page 13

Page 14: AN1619 - Microchip Technologyww1.microchip.com/downloads/en/AppNotes/00001619A.pdfHID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL, HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,

AN1619

APPENDIX A: APPLICATION NOTE REVISION HISTORY

TABLE A-1: REVISION HISTORY Revision Level & Date Section/Figure/Entry Correction

REV A (12-13-13) All Initial Release

DS00001619A-page 14 2013 Microchip Technology Inc.

Page 15: AN1619 - Microchip Technologyww1.microchip.com/downloads/en/AppNotes/00001619A.pdfHID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL, HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,

2013 Microchip Technology Inc. DS00001619A-page 15

AN1619THE MICROCHIP WEB SITEMicrochip provides online support via our WWW site at www.microchip.com. This web site is used as a means to make files and information easily available to customers. Accessible by using your favorite Internet browser, the web site con-tains the following information:

• Product Support – Data sheets and errata, application notes and sample programs, design resources, user’s guides and hardware support documents, latest software releases and archived software

• General Technical Support – Frequently Asked Questions (FAQ), technical support requests, online discussion groups, Microchip consultant program member listing

• Business of Microchip – Product selector and ordering guides, latest Microchip press releases, listing of semi-nars and events, listings of Microchip sales offices, distributors and factory representatives

CUSTOMER CHANGE NOTIFICATION SERVICEMicrochip’s customer notification service helps keep customers current on Microchip products. Subscribers will receive e-mail notification whenever there are changes, updates, revisions or errata related to a specified product family or development tool of interest.

To register, access the Microchip web site at www.microchip.com. Under “Support”, click on “Customer Change Notifi-cation” and follow the registration instructions.

CUSTOMER SUPPORTUsers of Microchip products can receive assistance through several channels:

• Distributor or Representative• Local Sales Office• Field Application Engineer (FAE)• Technical Support

Customers should contact their distributor, representative or field application engineer (FAE) for support. Local sales offices are also available to help customers. A listing of sales offices and locations is included in the back of this docu-ment.

Technical support is available through the web site at: http://microchip.com/support

Page 16: AN1619 - Microchip Technologyww1.microchip.com/downloads/en/AppNotes/00001619A.pdfHID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL, HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,

AN1619

DS00001619A-page 16 2013 Microchip Technology Inc.

Note the following details of the code protection feature on Microchip devices:• Microchip products meet the specification contained in their particular Microchip Data Sheet.

• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions.

• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data Sheets. Most likely, the person doing so is engaged in theft of intellectual property.

• Microchip is willing to work with the customer who is concerned about the integrity of their code.

• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as “unbreakable.”

Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act. Information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer’s risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implic-itly or otherwise, under any Microchip intellectual property rights.

Trademarks

The Microchip name and logo, the Microchip logo, dsPIC, FlashFlex, KEELOQ, KEELOQ logo, MPLAB, PIC, PICmicro, PICSTART, PIC32 logo, rfPIC, SST, SST Logo, SuperFlash and UNI/O are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.

FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor, MTP, SEEVAL and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A.

Silicon Storage Technology is a registered trademark of Microchip Technology Inc. in other countries.

Analog-for-the-Digital Age, Application Maestro, BodyCom, chipKIT, chipKIT logo, CodeGuard, dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN, ECONOMONITOR, FanSense, HI-TIDE, In-Circuit Serial Programming, ICSP, Mindi, MiWi, MPASM, MPF, MPLAB Certified logo, MPLIB, MPLINK, mTouch, Omniscient Code Generation, PICC, PICC-18, PICDEM, PICDEM.net, PICkit, PICtail, REAL ICE, rfLAB, Select Mode, SQI, Serial Quad I/O, Total Endurance, TSHARC, UniWinDriver, WiperLock, ZENA and Z-Scale are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.

SQTP is a service mark of Microchip Technology Incorporated in the U.S.A.

GestIC and ULPP are registered trademarks of Microchip Technology Germany II GmbH & Co. KG, a subsidiary of Microchip Technology Inc., in other countries.

A more complete list of registered trademarks and common law trademarks owned by Standard Microsystems Corporation (“SMSC”) is available at: www.smsc.com. The absence of a trademark (name, logo, etc.) from the list does not constitute a waiver of any intellectual property rights that SMSC has established in any of its trademarks.

All other trademarks mentioned herein are property of their respective companies.

© 2013, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved.

ISBN: 9781620777114

Microchip received ISO/TS-16949:2009 certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona; Gresham, Oregon and design centers in California and India. The Company’s quality system processes and procedures are for its PIC® MCUs and dsPIC® DSCs, KEELOQ® code hopping devices, Serial EEPROMs, microperipherals, nonvolatile memory and analog products. In addition, Microchip’s quality system for the design and manufacture of development systems is ISO 9001:2000 certified.

Page 17: AN1619 - Microchip Technologyww1.microchip.com/downloads/en/AppNotes/00001619A.pdfHID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL, HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,

2013 Microchip Technology Inc. DS00001619A-page 17

AMERICASCorporate Office2355 West Chandler Blvd.Chandler, AZ 85224-6199Tel: 480-792-7200 Fax: 480-792-7277Technical Support: http://www.microchip.com/supportWeb Address: www.microchip.comAtlantaDuluth, GA Tel: 678-957-9614 Fax: 678-957-1455BostonWestborough, MA Tel: 774-760-0087 Fax: 774-760-0088ChicagoItasca, IL Tel: 630-285-0071 Fax: 630-285-0075ClevelandIndependence, OH Tel: 216-447-0464 Fax: 216-447-0643DallasAddison, TX Tel: 972-818-7423 Fax: 972-818-2924DetroitFarmington Hills, MI Tel: 248-538-2250Fax: 248-538-2260IndianapolisNoblesville, IN Tel: 317-773-8323Fax: 317-773-5453Los AngelesMission Viejo, CA Tel: 949-462-9523 Fax: 949-462-9608Santa ClaraSanta Clara, CA Tel: 408-961-6444Fax: 408-961-6445TorontoMississauga, Ontario, CanadaTel: 905-673-0699 Fax: 905-673-6509

ASIA/PACIFICAsia Pacific OfficeSuites 3707-14, 37th FloorTower 6, The GatewayHarbour City, KowloonHong KongTel: 852-2401-1200Fax: 852-2401-3431Australia - SydneyTel: 61-2-9868-6733Fax: 61-2-9868-6755China - BeijingTel: 86-10-8569-7000 Fax: 86-10-8528-2104China - ChengduTel: 86-28-8665-5511Fax: 86-28-8665-7889China - ChongqingTel: 86-23-8980-9588Fax: 86-23-8980-9500China - HangzhouTel: 86-571-2819-3187 Fax: 86-571-2819-3189China - Hong Kong SARTel: 852-2943-5100 Fax: 852-2401-3431China - NanjingTel: 86-25-8473-2460Fax: 86-25-8473-2470China - QingdaoTel: 86-532-8502-7355Fax: 86-532-8502-7205China - ShanghaiTel: 86-21-5407-5533 Fax: 86-21-5407-5066China - ShenyangTel: 86-24-2334-2829Fax: 86-24-2334-2393China - ShenzhenTel: 86-755-8864-2200 Fax: 86-755-8203-1760China - WuhanTel: 86-27-5980-5300Fax: 86-27-5980-5118China - XianTel: 86-29-8833-7252Fax: 86-29-8833-7256China - XiamenTel: 86-592-2388138 Fax: 86-592-2388130China - ZhuhaiTel: 86-756-3210040 Fax: 86-756-3210049

ASIA/PACIFICIndia - BangaloreTel: 91-80-3090-4444 Fax: 91-80-3090-4123India - New DelhiTel: 91-11-4160-8631Fax: 91-11-4160-8632India - PuneTel: 91-20-3019-1500Japan - OsakaTel: 81-6-6152-7160 Fax: 81-6-6152-9310Japan - TokyoTel: 81-3-6880- 3770 Fax: 81-3-6880-3771Korea - DaeguTel: 82-53-744-4301Fax: 82-53-744-4302Korea - SeoulTel: 82-2-554-7200Fax: 82-2-558-5932 or 82-2-558-5934Malaysia - Kuala LumpurTel: 60-3-6201-9857Fax: 60-3-6201-9859Malaysia - PenangTel: 60-4-227-8870Fax: 60-4-227-4068Philippines - ManilaTel: 63-2-634-9065Fax: 63-2-634-9069SingaporeTel: 65-6334-8870Fax: 65-6334-8850Taiwan - Hsin ChuTel: 886-3-5778-366Fax: 886-3-5770-955Taiwan - KaohsiungTel: 886-7-213-7828Fax: 886-7-330-9305Taiwan - TaipeiTel: 886-2-2508-8600 Fax: 886-2-2508-0102Thailand - BangkokTel: 66-2-694-1351Fax: 66-2-694-1350

EUROPEAustria - WelsTel: 43-7242-2244-39Fax: 43-7242-2244-393Denmark - CopenhagenTel: 45-4450-2828 Fax: 45-4485-2829France - ParisTel: 33-1-69-53-63-20 Fax: 33-1-69-30-90-79Germany - MunichTel: 49-89-627-144-0 Fax: 49-89-627-144-44Italy - Milan Tel: 39-0331-742611 Fax: 39-0331-466781Netherlands - DrunenTel: 31-416-690399 Fax: 31-416-690340Spain - MadridTel: 34-91-708-08-90Fax: 34-91-708-08-91UK - WokinghamTel: 44-118-921-5869Fax: 44-118-921-5820

Worldwide Sales and Service

08/20/13