Skip to content

Commit 7c3c64e

Browse files
committed
usb: hid: Define sensor page usages IDs
This commit adds a subset of usage IDs defined in the Sensors' page of the HID standard as well as adding a HID usage macro that works with IDs of 2 bytes. Signed-off-by: Zak Essadaoui [email protected]
1 parent 2a8118c commit 7c3c64e

File tree

1 file changed

+20
-0
lines changed
  • include/zephyr/usb/class

1 file changed

+20
-0
lines changed

include/zephyr/usb/class/hid.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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,15 @@ extern "C" {
163165
/** HID Generic Desktop Wheel Usage ID */
164166
#define HID_USAGE_GEN_DESKTOP_WHEEL 0x38
165167

168+
/** HID Sensors Environmental Temperature Usage ID */
169+
#define HID_USAGE_SENSORS_ENVIRONMENTAL_TEMPERATURE 0x33
170+
/** HID Sensors Event Sensor State Usage ID */
171+
#define HID_USAGE_SENSORS_EVENT_SENSOR_STATE 0x201
172+
/** HID Sensors Friendly Name Usage ID */
173+
#define HID_USAGE_SENSORS_PROPERTY_FRIENDLY_NAME 0x301
174+
/** HID Sensors Timestamp Usage ID */
175+
#define HID_USAGE_SENSORS_PROPERTY_TIMESTAMP 0x529
176+
166177
/**
167178
* @}
168179
*/
@@ -363,6 +374,15 @@ extern "C" {
363374
#define HID_USAGE(idx) \
364375
HID_ITEM(HID_ITEM_TAG_USAGE, HID_ITEM_TYPE_LOCAL, 1), idx
365376

377+
/**
378+
* @brief Define HID Usage Index item with the data length of two bytes.
379+
*
380+
* @param idx Number of data fields included in the report
381+
* @return HID Usage Index item
382+
*/
383+
#define HID_USAGE16(idx) \
384+
HID_ITEM(HID_ITEM_TAG_USAGE, HID_ITEM_TYPE_LOCAL, 2), ((0xFF) & idx), ((0xFF) & (idx >> 8))
385+
366386
/**
367387
* @brief Define HID Usage Minimum item with the data length of one byte.
368388
*

0 commit comments

Comments
 (0)