Zephyr API Documentation  3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
USB HID Item helpers

Macros

#define HID_ITEM(bTag, bType, bSize)
 Define HID short item.
 
#define HID_INPUT(a)    HID_ITEM(HID_ITEM_TAG_INPUT, HID_ITEM_TYPE_MAIN, 1), a
 Define HID Input item with the data length of one byte.
 
#define HID_OUTPUT(a)    HID_ITEM(HID_ITEM_TAG_OUTPUT, HID_ITEM_TYPE_MAIN, 1), a
 Define HID Output item with the data length of one byte.
 
#define HID_FEATURE(a)    HID_ITEM(HID_ITEM_TAG_FEATURE, HID_ITEM_TYPE_MAIN, 1), a
 Define HID Feature item with the data length of one byte.
 
#define HID_COLLECTION(a)    HID_ITEM(HID_ITEM_TAG_COLLECTION, HID_ITEM_TYPE_MAIN, 1), a
 Define HID Collection item with the data length of one byte.
 
#define HID_END_COLLECTION    HID_ITEM(HID_ITEM_TAG_COLLECTION_END, HID_ITEM_TYPE_MAIN, 0)
 Define HID End Collection (non-data) item.
 
#define HID_USAGE_PAGE(page)    HID_ITEM(HID_ITEM_TAG_USAGE_PAGE, HID_ITEM_TYPE_GLOBAL, 1), page
 Define HID Usage Page item.
 
#define HID_LOGICAL_MIN8(a)    HID_ITEM(HID_ITEM_TAG_LOGICAL_MIN, HID_ITEM_TYPE_GLOBAL, 1), a
 Define HID Logical Minimum item with the data length of one byte.
 
#define HID_LOGICAL_MAX8(a)    HID_ITEM(HID_ITEM_TAG_LOGICAL_MAX, HID_ITEM_TYPE_GLOBAL, 1), a
 Define HID Logical Maximum item with the data length of one byte.
 
#define HID_LOGICAL_MIN16(a, b)    HID_ITEM(HID_ITEM_TAG_LOGICAL_MIN, HID_ITEM_TYPE_GLOBAL, 2), a, b
 Define HID Logical Minimum item with the data length of two bytes.
 
#define HID_LOGICAL_MAX16(a, b)    HID_ITEM(HID_ITEM_TAG_LOGICAL_MAX, HID_ITEM_TYPE_GLOBAL, 2), a, b
 Define HID Logical Maximum item with the data length of two bytes.
 
#define HID_LOGICAL_MIN32(a, b, c, d)    HID_ITEM(HID_ITEM_TAG_LOGICAL_MIN, HID_ITEM_TYPE_GLOBAL, 3), a, b, c, d
 Define HID Logical Minimum item with the data length of four bytes.
 
#define HID_LOGICAL_MAX32(a, b, c, d)    HID_ITEM(HID_ITEM_TAG_LOGICAL_MAX, HID_ITEM_TYPE_GLOBAL, 3), a, b, c, d
 Define HID Logical Maximum item with the data length of four bytes.
 
#define HID_REPORT_SIZE(size)    HID_ITEM(HID_ITEM_TAG_REPORT_SIZE, HID_ITEM_TYPE_GLOBAL, 1), size
 Define HID Report Size item with the data length of one byte.
 
#define HID_REPORT_ID(id)    HID_ITEM(HID_ITEM_TAG_REPORT_ID, HID_ITEM_TYPE_GLOBAL, 1), id
 Define HID Report ID item with the data length of one byte.
 
#define HID_REPORT_COUNT(count)    HID_ITEM(HID_ITEM_TAG_REPORT_COUNT, HID_ITEM_TYPE_GLOBAL, 1), count
 Define HID Report Count item with the data length of one byte.
 
#define HID_USAGE(idx)    HID_ITEM(HID_ITEM_TAG_USAGE, HID_ITEM_TYPE_LOCAL, 1), idx
 Define HID Usage Index item with the data length of one byte.
 
#define HID_USAGE_MIN8(a)    HID_ITEM(HID_ITEM_TAG_USAGE_MIN, HID_ITEM_TYPE_LOCAL, 1), a
 Define HID Usage Minimum item with the data length of one byte.
 
#define HID_USAGE_MAX8(a)    HID_ITEM(HID_ITEM_TAG_USAGE_MAX, HID_ITEM_TYPE_LOCAL, 1), a
 Define HID Usage Maximum item with the data length of one byte.
 
#define HID_USAGE_MIN16(a, b)    HID_ITEM(HID_ITEM_TAG_USAGE_MIN, HID_ITEM_TYPE_LOCAL, 2), a, b
 Define HID Usage Minimum item with the data length of two bytes.
 
#define HID_USAGE_MAX16(a, b)    HID_ITEM(HID_ITEM_TAG_USAGE_MAX, HID_ITEM_TYPE_LOCAL, 2), a, b
 Define HID Usage Maximum item with the data length of two bytes.
 

Detailed Description

Macro Definition Documentation

◆ HID_COLLECTION

#define HID_COLLECTION (   a)     HID_ITEM(HID_ITEM_TAG_COLLECTION, HID_ITEM_TYPE_MAIN, 1), a

#include <zephyr/usb/class/hid.h>

Define HID Collection item with the data length of one byte.

For usage examples, see HID_MOUSE_REPORT_DESC(), HID_KEYBOARD_REPORT_DESC()

Parameters
aCollection item data
Returns
HID Collection item

◆ HID_END_COLLECTION

#define HID_END_COLLECTION    HID_ITEM(HID_ITEM_TAG_COLLECTION_END, HID_ITEM_TYPE_MAIN, 0)

#include <zephyr/usb/class/hid.h>

Define HID End Collection (non-data) item.

For usage examples, see HID_MOUSE_REPORT_DESC(), HID_KEYBOARD_REPORT_DESC()

Returns
HID End Collection item

◆ HID_FEATURE

#define HID_FEATURE (   a)     HID_ITEM(HID_ITEM_TAG_FEATURE, HID_ITEM_TYPE_MAIN, 1), a

#include <zephyr/usb/class/hid.h>

Define HID Feature item with the data length of one byte.

Parameters
aFeature item data
Returns
HID Feature item

◆ HID_INPUT

#define HID_INPUT (   a)     HID_ITEM(HID_ITEM_TAG_INPUT, HID_ITEM_TYPE_MAIN, 1), a

#include <zephyr/usb/class/hid.h>

Define HID Input item with the data length of one byte.

For usage examples, see HID_MOUSE_REPORT_DESC(), HID_KEYBOARD_REPORT_DESC()

Parameters
aInput item data
Returns
HID Input item

◆ HID_ITEM

#define HID_ITEM (   bTag,
  bType,
  bSize 
)

#include <zephyr/usb/class/hid.h>

Value:
(((bTag & 0xF) << 4) | \
((bType & 0x3) << 2) | (bSize & 0x3))

Define HID short item.

Parameters
bTagItem tag
bTypeItem type
bSizeItem data size
Returns
HID Input item

◆ HID_LOGICAL_MAX16

#define HID_LOGICAL_MAX16 (   a,
 
)     HID_ITEM(HID_ITEM_TAG_LOGICAL_MAX, HID_ITEM_TYPE_GLOBAL, 2), a, b

#include <zephyr/usb/class/hid.h>

Define HID Logical Maximum item with the data length of two bytes.

Parameters
aMinimum value lower byte
bMinimum value higher byte
Returns
HID Logical Maximum item

◆ HID_LOGICAL_MAX32

#define HID_LOGICAL_MAX32 (   a,
  b,
  c,
  d 
)     HID_ITEM(HID_ITEM_TAG_LOGICAL_MAX, HID_ITEM_TYPE_GLOBAL, 3), a, b, c, d

#include <zephyr/usb/class/hid.h>

Define HID Logical Maximum item with the data length of four bytes.

Parameters
aMinimum value lower byte
bMinimum value low middle byte
cMinimum value high middle byte
dMinimum value higher byte
Returns
HID Logical Maximum item

◆ HID_LOGICAL_MAX8

#define HID_LOGICAL_MAX8 (   a)     HID_ITEM(HID_ITEM_TAG_LOGICAL_MAX, HID_ITEM_TYPE_GLOBAL, 1), a

#include <zephyr/usb/class/hid.h>

Define HID Logical Maximum item with the data length of one byte.

For usage examples, see HID_MOUSE_REPORT_DESC(), HID_KEYBOARD_REPORT_DESC()

Parameters
aMaximum value in logical units
Returns
HID Logical Maximum item

◆ HID_LOGICAL_MIN16

#define HID_LOGICAL_MIN16 (   a,
 
)     HID_ITEM(HID_ITEM_TAG_LOGICAL_MIN, HID_ITEM_TYPE_GLOBAL, 2), a, b

#include <zephyr/usb/class/hid.h>

Define HID Logical Minimum item with the data length of two bytes.

Parameters
aMinimum value lower byte
bMinimum value higher byte
Returns
HID Logical Minimum item

◆ HID_LOGICAL_MIN32

#define HID_LOGICAL_MIN32 (   a,
  b,
  c,
  d 
)     HID_ITEM(HID_ITEM_TAG_LOGICAL_MIN, HID_ITEM_TYPE_GLOBAL, 3), a, b, c, d

#include <zephyr/usb/class/hid.h>

Define HID Logical Minimum item with the data length of four bytes.

Parameters
aMinimum value lower byte
bMinimum value low middle byte
cMinimum value high middle byte
dMinimum value higher byte
Returns
HID Logical Minimum item

◆ HID_LOGICAL_MIN8

#define HID_LOGICAL_MIN8 (   a)     HID_ITEM(HID_ITEM_TAG_LOGICAL_MIN, HID_ITEM_TYPE_GLOBAL, 1), a

#include <zephyr/usb/class/hid.h>

Define HID Logical Minimum item with the data length of one byte.

For usage examples, see HID_MOUSE_REPORT_DESC(), HID_KEYBOARD_REPORT_DESC()

Parameters
aMinimum value in logical units
Returns
HID Logical Minimum item

◆ HID_OUTPUT

#define HID_OUTPUT (   a)     HID_ITEM(HID_ITEM_TAG_OUTPUT, HID_ITEM_TYPE_MAIN, 1), a

#include <zephyr/usb/class/hid.h>

Define HID Output item with the data length of one byte.

For usage examples, see HID_KEYBOARD_REPORT_DESC()

Parameters
aOutput item data
Returns
HID Output item

◆ HID_REPORT_COUNT

#define HID_REPORT_COUNT (   count)     HID_ITEM(HID_ITEM_TAG_REPORT_COUNT, HID_ITEM_TYPE_GLOBAL, 1), count

#include <zephyr/usb/class/hid.h>

Define HID Report Count item with the data length of one byte.

For usage examples, see HID_MOUSE_REPORT_DESC(), HID_KEYBOARD_REPORT_DESC()

Parameters
countNumber of data fields included in the report
Returns
HID Report Count item

◆ HID_REPORT_ID

#define HID_REPORT_ID (   id)     HID_ITEM(HID_ITEM_TAG_REPORT_ID, HID_ITEM_TYPE_GLOBAL, 1), id

#include <zephyr/usb/class/hid.h>

Define HID Report ID item with the data length of one byte.

Parameters
idReport ID
Returns
HID Report ID item

◆ HID_REPORT_SIZE

#define HID_REPORT_SIZE (   size)     HID_ITEM(HID_ITEM_TAG_REPORT_SIZE, HID_ITEM_TYPE_GLOBAL, 1), size

#include <zephyr/usb/class/hid.h>

Define HID Report Size item with the data length of one byte.

For usage examples, see HID_MOUSE_REPORT_DESC(), HID_KEYBOARD_REPORT_DESC()

Parameters
sizeReport field size in bits
Returns
HID Report Size item

◆ HID_USAGE

#define HID_USAGE (   idx)     HID_ITEM(HID_ITEM_TAG_USAGE, HID_ITEM_TYPE_LOCAL, 1), idx

#include <zephyr/usb/class/hid.h>

Define HID Usage Index item with the data length of one byte.

For usage examples, see HID_MOUSE_REPORT_DESC(), HID_KEYBOARD_REPORT_DESC()

Parameters
idxNumber of data fields included in the report
Returns
HID Usage Index item

◆ HID_USAGE_MAX16

#define HID_USAGE_MAX16 (   a,
 
)     HID_ITEM(HID_ITEM_TAG_USAGE_MAX, HID_ITEM_TYPE_LOCAL, 2), a, b

#include <zephyr/usb/class/hid.h>

Define HID Usage Maximum item with the data length of two bytes.

For usage examples, see HID_MOUSE_REPORT_DESC(), HID_KEYBOARD_REPORT_DESC()

Parameters
aEnding Usage lower byte
bEnding Usage higher byte
Returns
HID Usage Maximum item

◆ HID_USAGE_MAX8

#define HID_USAGE_MAX8 (   a)     HID_ITEM(HID_ITEM_TAG_USAGE_MAX, HID_ITEM_TYPE_LOCAL, 1), a

#include <zephyr/usb/class/hid.h>

Define HID Usage Maximum item with the data length of one byte.

For usage examples, see HID_MOUSE_REPORT_DESC(), HID_KEYBOARD_REPORT_DESC()

Parameters
aEnding Usage
Returns
HID Usage Maximum item

◆ HID_USAGE_MIN16

#define HID_USAGE_MIN16 (   a,
 
)     HID_ITEM(HID_ITEM_TAG_USAGE_MIN, HID_ITEM_TYPE_LOCAL, 2), a, b

#include <zephyr/usb/class/hid.h>

Define HID Usage Minimum item with the data length of two bytes.

For usage examples, see HID_MOUSE_REPORT_DESC(), HID_KEYBOARD_REPORT_DESC()

Parameters
aStarting Usage lower byte
bStarting Usage higher byte
Returns
HID Usage Minimum item

◆ HID_USAGE_MIN8

#define HID_USAGE_MIN8 (   a)     HID_ITEM(HID_ITEM_TAG_USAGE_MIN, HID_ITEM_TYPE_LOCAL, 1), a

#include <zephyr/usb/class/hid.h>

Define HID Usage Minimum item with the data length of one byte.

For usage examples, see HID_MOUSE_REPORT_DESC(), HID_KEYBOARD_REPORT_DESC()

Parameters
aStarting Usage
Returns
HID Usage Minimum item

◆ HID_USAGE_PAGE

#define HID_USAGE_PAGE (   page)     HID_ITEM(HID_ITEM_TAG_USAGE_PAGE, HID_ITEM_TYPE_GLOBAL, 1), page

#include <zephyr/usb/class/hid.h>

Define HID Usage Page item.

For usage examples, see HID_MOUSE_REPORT_DESC(), HID_KEYBOARD_REPORT_DESC()

Parameters
pageUsage Page
Returns
HID Usage Page item