Add hidReportIdInUse command to determine whether report IDs are used
This commit is contained in:
@@ -242,6 +242,13 @@ unsigned hidGetReportIdLimit ( void ) {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
unsigned hidIsReportIdInUse ( void ) {
|
||||
if ( hidGetElementReportId( hidReports[ 0 ]->location ) ) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define HID_CONFIGURABLE_ELEMENT_COUNT ( sizeof hidConfigurableElements / sizeof ( USB_HID_Report_Element_t* ))
|
||||
unsigned hidGetReportItem(
|
||||
const unsigned id,
|
||||
|
||||
@@ -181,6 +181,19 @@ size_t hidGetReportDescriptorLength( void );
|
||||
*/
|
||||
unsigned hidGetReportIdLimit ( void );
|
||||
|
||||
/**
|
||||
* @brief Does the application use Report IDs?
|
||||
*
|
||||
* If the application is not using Report IDs, then the id value that is passed around
|
||||
* everywhere can just be zero. Otherwise zero is an invalid ID that has a special meaning
|
||||
* in some cases (read the documentation for each function).
|
||||
*
|
||||
* @return Boolean
|
||||
* @retval 1 Report IDs are in use
|
||||
* @retval 0 Report IDs are not in use
|
||||
*/
|
||||
unsigned hidIsReportIdInUse ( void );
|
||||
|
||||
/**
|
||||
* @brief Get a HID Report descriptor item
|
||||
*
|
||||
|
||||
@@ -58,6 +58,11 @@ void test_validate_report( void ) {
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
}
|
||||
|
||||
void test_reportid_in_use( void ) {
|
||||
unsigned reportIdInUse = hidIsReportIdInUse();
|
||||
TEST_ASSERT_EQUAL_UINT( 1, reportIdInUse );
|
||||
}
|
||||
|
||||
// Basic report descriptor tests
|
||||
void test_unprepared_hidGetReportDescriptor( void )
|
||||
{
|
||||
|
||||
@@ -45,6 +45,11 @@ void test_validate_report( void ) {
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
}
|
||||
|
||||
void test_reportid_in_use( void ) {
|
||||
unsigned reportIdInUse = hidIsReportIdInUse();
|
||||
TEST_ASSERT_EQUAL_UINT( 0, reportIdInUse );
|
||||
}
|
||||
|
||||
// Basic report descriptor tests
|
||||
void test_unprepared_hidGetReportDescriptor( void )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user