diff --git a/USB_config/descriptors.c b/USB_config/descriptors.c index b750f00..820a360 100644 --- a/USB_config/descriptors.c +++ b/USB_config/descriptors.c @@ -44,7 +44,7 @@ uint16_t const report_desc_size[HID_NUM_INTERFACES] = { -80 +85 }; uint8_t const report_len_input[HID_NUM_INTERFACES] = { @@ -191,7 +191,7 @@ Collection(USB_HID_APPLICATION), Collection (USB_HID_PHYSICAL), // - // The X, Y and Z values which are specified as 8-bit absolute + // The X, Y and Z values which are specified as 12-bit absolute // position values. // Usage (USB_HID_X), @@ -203,8 +203,11 @@ Collection(USB_HID_APPLICATION), Usage (USB_HID_SLIDER), Usage (USB_HID_DIAL), // - // 8 16-bit absolute values. + // 8 16-bit absolute values (but only 12 bit range due to 12-bit + // ADCs). // + LogicalMinimum(0), + LogicalMaximum16b(4095), ReportSize(16), ReportCount(8), Input(USB_HID_INPUT_DATA | USB_HID_INPUT_VARIABLE | diff --git a/USB_config/descriptors.h b/USB_config/descriptors.h index 7b2f0cc..6e8cb30 100644 --- a/USB_config/descriptors.h +++ b/USB_config/descriptors.h @@ -136,7 +136,7 @@ extern "C" //*********************************************************************************************** #define SIZEOF_DEVICE_DESCRIPTOR 0x12 #define MAX_STRING_DESCRIPTOR_INDEX 5 -#define report_desc_size_HID0 80 +#define report_desc_size_HID0 85 //#define SIZEOF_REPORT_DESCRIPTOR 36 //#define USBHID_REPORT_LENGTH 64 // length of whole HID report (including Report ID) #define CONFIG_STRING_INDEX 4 diff --git a/USB_config/hidUsage.h b/USB_config/hidUsage.h index 063bafd..a25711c 100644 --- a/USB_config/hidUsage.h +++ b/USB_config/hidUsage.h @@ -283,6 +283,25 @@ extern "C" //***************************************************************************** #define LogicalMaximum(i8Value) 0x25, ((i8Value) & 0xff) +//***************************************************************************** +// +//! This is a macro to assist adding Logical Maximum entries in HID report +//! descriptors, when the representation of the logical maximum value requires +//! 16 bits to represent. +//! +//! \param i16Value is the Logical Maximum value. +//! +//! This macro takes a value and prepares it to be placed as a Logical Maximum +//! entry into a HID report structure. This is the actual maximum value for +//! the range of values associated with a field. +//! +//! \return Not a function. +// +//***************************************************************************** +#define LogicalMaximum16b(i16Value) \ + 0x26, ((i16Value) & 0xFF), \ + (((i16Value) >> 8) & 0xFF) + //***************************************************************************** // //! This is a macro to assist adding Physical Minimum entries in HID report