@@ -141,6 +141,8 @@ extern "C" {
141141#define HID_USAGE_GEN_LEDS 0x08
142142/** HID Button Usage page */
143143#define HID_USAGE_GEN_BUTTON 0x09
144+ /** HID Sensors Usage page */
145+ #define HID_USAGE_SENSORS 0x20
144146
145147/** HID Generic Desktop Undefined Usage ID */
146148#define HID_USAGE_GEN_DESKTOP_UNDEFINED 0x00
@@ -163,6 +165,33 @@ extern "C" {
163165/** HID Generic Desktop Wheel Usage ID */
164166#define HID_USAGE_GEN_DESKTOP_WHEEL 0x38
165167
168+ /** HID Sensors Collection Usage ID */
169+ #define HID_USAGE_SENSOR_TYPE_COLLECTION 0x001
170+ /** HID Sensors Environmental Temperature Type Usage ID */
171+ #define HID_USAGE_SENSORS_TYPE_ENVIRONMENTAL_TEMPERATURE 0x033
172+ /** HID Sensors Event Sensor State Usage ID */
173+ #define HID_USAGE_SENSORS_EVENT_SENSOR_STATE 0x201
174+ /** HID Sensors Friendly Name Property Usage ID */
175+ #define HID_USAGE_SENSORS_PROPERTY_FRIENDLY_NAME 0x301
176+ /** HID Sensors Enviromental Temperature Data Usage ID */
177+ #define HID_USAGE_SENSORS_DATA_ENVIRONMENTAL_TEMPERATURE 0x434
178+ /** HID Sensors Timestamp Property Usage ID */
179+ #define HID_USAGE_SENSORS_PROPERTY_TIMESTAMP 0x529
180+ /** HID Sensors Sensor State Undefined Usage ID */
181+ #define HID_USAGE_SENSORS_SENSOR_STATE_UNDEFINED 0x800
182+ /** HID Sensors Sensor State Ready Usage ID */
183+ #define HID_USAGE_SENSORS_SENSOR_STATE_READY 0x801
184+ /** HID Sensors Sensor State Not Available Usage ID */
185+ #define HID_USAGE_SENSORS_SENSOR_STATE_NOT_AVAILABLE 0x802
186+ /** HID Sensors Sensor State No Data Usage ID */
187+ #define HID_USAGE_SENSORS_SENSOR_STATE_NO_DATA 0x803
188+ /** HID Sensors Sensor State Initializing Usage ID */
189+ #define HID_USAGE_SENSORS_SENSOR_STATE_INITIALIZING 0x804
190+ /** HID Sensors Sensor State Access Denied Usage ID */
191+ #define HID_USAGE_SENSORS_SENSOR_STATE_ACCESS_DENIED 0x805
192+ /** HID Sensors Sensor State Error Usage ID */
193+ #define HID_USAGE_SENSORS_SENSOR_STATE_ERROR 0x806
194+
166195/**
167196 * @}
168197 */
@@ -357,12 +386,21 @@ extern "C" {
357386 * For usage examples, see @ref HID_MOUSE_REPORT_DESC(),
358387 * @ref HID_KEYBOARD_REPORT_DESC()
359388 *
360- * @param idx Number of data fields included in the report
389+ * @param idx HID Usage ID per the HID Usage Table
361390 * @return HID Usage Index item
362391 */
363392#define HID_USAGE (idx ) \
364393 HID_ITEM(HID_ITEM_TAG_USAGE, HID_ITEM_TYPE_LOCAL, 1), idx
365394
395+ /**
396+ * @brief Define HID Usage Index item with the data length of two bytes.
397+ *
398+ * @param idx HID Usage ID per the HID Usage Table
399+ * @return HID Usage Index item
400+ */
401+ #define HID_USAGE16 (idx ) \
402+ HID_ITEM(HID_ITEM_TAG_USAGE, HID_ITEM_TYPE_LOCAL, 2), (uint8_t)idx, (idx >> 8)
403+
366404/**
367405 * @brief Define HID Usage Minimum item with the data length of one byte.
368406 *
@@ -413,6 +451,15 @@ extern "C" {
413451#define HID_USAGE_MAX16 (a , b ) \
414452 HID_ITEM(HID_ITEM_TAG_USAGE_MAX, HID_ITEM_TYPE_LOCAL, 2), a, b
415453
454+ /**
455+ * @brief Define HID Unit Exponent item.
456+ *
457+ * @param exp Unit exponent, refer to the HID Unit Exponent table
458+ * in the specification for usage
459+ * @return HID Unit Exponent item
460+ */
461+ #define HID_UNIT_EXPONENT (exp ) HID_ITEM(HID_ITEM_TAG_UNIT_EXPONENT, HID_ITEM_TYPE_GLOBAL, 1), exp
462+
416463/**
417464 * @}
418465 */
0 commit comments