Remove test-specific information from hid_report_descriptor.h

This commit is contained in:
Ciaran Woodward
2021-12-09 14:55:38 +00:00
parent ed7a33b40f
commit 1b186a0c2f
4 changed files with 35 additions and 44 deletions

View File

@@ -6,21 +6,6 @@
#include "xua_hid_report_descriptor.h"
#define REPORT1_MAX_VALID_BIT ( 3 )
#define REPORT1_MAX_VALID_BYTE ( 0 )
#define REPORT1_MIN_VALID_BIT ( 0 )
#define REPORT1_MIN_VALID_BYTE ( 0 )
#define REPORT2_MAX_VALID_BIT ( 7 )
#define REPORT2_MAX_VALID_BYTE ( 1 )
#define REPORT2_MIN_VALID_BIT ( 0 )
#define REPORT2_MIN_VALID_BYTE ( 0 )
#define REPORT3_MAX_VALID_BIT ( 1 )
#define REPORT3_MAX_VALID_BYTE ( 0 )
#define REPORT3_MIN_VALID_BIT ( 0 )
#define REPORT3_MIN_VALID_BYTE ( 0 )
#define USB_HID_REPORT_ID_KEYBOARD ( 0x01 )
#define USB_HID_REPORT_ID_CONSUMER ( 0x02 )
#define USB_HID_REPORT_ID_TELEPHONY ( 0x03 )
@@ -155,7 +140,7 @@ static USB_HID_Report_Element_t* const hidConfigurableElements[] = {
};
/*
* List HID Reports, one per Report ID. This should be a usage page item with the relevant
* List HID Reports, one per Report ID. This should be a usage page item with the locator filled out with ID and size
* If not using report IDs - still have one with report ID 0
*/
static const USB_HID_Report_Element_t* const hidReports[] = {
@@ -235,12 +220,6 @@ static const USB_HID_Short_Item_t* const hidReportDescriptorItems[] = {
&hidCollectionEnd
};
/*
* Define the length of the HID Report.
* This value must match the number of Report bytes defined by hidReportDescriptorItems.
*/
#define HID_REPORT_LENGTH ( 3 )
/*
* Define the number of HID Reports
* Due to XC not supporting designated initializers, this constant has a hard-coded value.

View File

@@ -5,13 +5,27 @@
#include "xua_unit_tests.h"
#include "xua_hid_report_descriptor.h"
#include "hid_report_descriptor.h"
#define HID_REPORT_ITEM_TYPE_GLOBAL ( 0x01 )
#define HID_REPORT_ITEM_TYPE_LOCAL ( 0x02 )
#define HID_REPORT_ITEM_TYPE_MAIN ( 0x00 )
#define HID_REPORT_ITEM_TYPE_RESERVED ( 0x03 )
// Test constants related to the report descriptor defined in hid_report_descriptor.h
#define REPORT1_MAX_VALID_BIT ( 3 )
#define REPORT1_MAX_VALID_BYTE ( 0 )
#define REPORT1_MIN_VALID_BIT ( 0 )
#define REPORT1_MIN_VALID_BYTE ( 0 )
#define REPORT2_MAX_VALID_BIT ( 7 )
#define REPORT2_MAX_VALID_BYTE ( 1 )
#define REPORT2_MIN_VALID_BIT ( 0 )
#define REPORT2_MIN_VALID_BYTE ( 0 )
#define REPORT3_MAX_VALID_BIT ( 1 )
#define REPORT3_MAX_VALID_BYTE ( 0 )
#define REPORT3_MIN_VALID_BIT ( 0 )
#define REPORT3_MIN_VALID_BYTE ( 0 )
#define HID_REPORT_LENGTH ( 3 )
#define HID_REPORT_COUNT ( 3 )
// Constants from USB HID Usage Tables
#define KEYBOARD_PAGE ( 0x07 )
#define CONSUMER_PAGE ( 0x0C )
#define TELEPHONY_DEVICE_PAGE ( 0x0B )

View File

@@ -6,12 +6,6 @@
#include "xua_hid_report_descriptor.h"
#define MAX_VALID_BIT ( 7 )
#define MAX_VALID_BYTE ( 1 )
#define MIN_VALID_BIT ( 0 )
#define MIN_VALID_BYTE ( 0 )
#define USB_HID_USAGE_PAGE_ID_CONSUMER ( 0x0C )
/*
@@ -112,12 +106,6 @@ static const USB_HID_Short_Item_t* const hidReportDescriptorItems[] = {
&hidCollectionEnd
};
/*
* Define the length of the HID Report.
* This value must match the number of Report bytes defined by hidReportDescriptorItems.
*/
#define HID_REPORT_LENGTH ( 2 )
/*
* Define the number of HID Reports
* Due to XC not supporting designated initializers, this constant has a hard-coded value.

View File

@@ -5,17 +5,27 @@
#include "xua_unit_tests.h"
#include "xua_hid_report_descriptor.h"
#include "hid_report_descriptor.h"
// Test constants related to the report descriptor defined in hid_report_descriptor.h
#define MAX_VALID_BIT ( 7 )
#define MAX_VALID_BYTE ( 1 )
#define MIN_VALID_BIT ( 0 )
#define MIN_VALID_BYTE ( 0 )
#define HID_REPORT_LENGTH ( 2 )
#define HID_REPORT_COUNT ( 1 )
// Constants from the USB HID Usage Tables
#define CONSUMER_CONTROL_PAGE ( 0x0C )
#define LOUDNESS_CONTROL ( 0xE7 )
#define AL_CONTROL_PANEL ( 0x019F )
#define HID_REPORT_ITEM_TYPE_GLOBAL ( 0x01 )
#define HID_REPORT_ITEM_TYPE_LOCAL ( 0x02 )
#define HID_REPORT_ITEM_TYPE_MAIN ( 0x00 )
#define HID_REPORT_ITEM_TYPE_RESERVED ( 0x03 )
#define CONSUMER_CONTROL_PAGE ( 0x0C )
#define LOUDNESS_CONTROL ( 0xE7 )
#define AL_CONTROL_PANEL ( 0x019F )
static unsigned construct_usage_header( unsigned size )
{
unsigned header = 0x00;