Merge remote-tracking branch 'michael/feature/multiple_hid_reports' into feature/multiple_hid_reports_tests
This commit is contained in:
@@ -1,6 +1,15 @@
|
|||||||
lib_xua Change Log
|
lib_xua Change Log
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
3.0.0
|
||||||
|
-----
|
||||||
|
|
||||||
|
* ADDED: Support for HID Report IDs
|
||||||
|
* REMOVED: Support for HID Reports containing controls from mixed Usage
|
||||||
|
pages
|
||||||
|
* CHANGED: Renamed the HID API file xua_hid_report_descriptor.h to
|
||||||
|
xua_hid_report.h
|
||||||
|
|
||||||
2.1.1
|
2.1.1
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#ifndef __hid_report_descriptor_h__
|
#ifndef __hid_report_descriptor_h__
|
||||||
#define __hid_report_descriptor_h__
|
#define __hid_report_descriptor_h__
|
||||||
|
|
||||||
#include "xua_hid_report_descriptor.h"
|
#include "xua_hid_report.h"
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Existing static report descriptor kept for reference */
|
/* Existing static report descriptor kept for reference */
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#ifndef __hid_report_descriptor_h__
|
#ifndef __hid_report_descriptor_h__
|
||||||
#define __hid_report_descriptor_h__
|
#define __hid_report_descriptor_h__
|
||||||
|
|
||||||
#include "xua_hid_report_descriptor.h"
|
#include "xua_hid_report.h"
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Existing static report descriptor kept for reference */
|
/* Existing static report descriptor kept for reference */
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#ifndef __hid_report_descriptor_h__
|
#ifndef __hid_report_descriptor_h__
|
||||||
#define __hid_report_descriptor_h__
|
#define __hid_report_descriptor_h__
|
||||||
|
|
||||||
#include "xua_hid_report_descriptor.h"
|
#include "xua_hid_report.h"
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Existing static report descriptor kept for reference */
|
/* Existing static report descriptor kept for reference */
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#ifndef __hid_report_descriptor_h__
|
#ifndef __hid_report_descriptor_h__
|
||||||
#define __hid_report_descriptor_h__
|
#define __hid_report_descriptor_h__
|
||||||
|
|
||||||
#include "xua_hid_report_descriptor.h"
|
#include "xua_hid_report.h"
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Existing static report descriptor kept for reference */
|
/* Existing static report descriptor kept for reference */
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
VERSION = 2.1.1
|
VERSION = 3.0.0
|
||||||
|
|
||||||
DEPENDENT_MODULES = lib_logging(>=3.0.0) \
|
DEPENDENT_MODULES = lib_logging(>=3.0.0) \
|
||||||
lib_xassert(>=4.0.0) \
|
lib_xassert(>=4.0.0) \
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#include "testct_byref.h"
|
#include "testct_byref.h"
|
||||||
|
|
||||||
#if( 0 < HID_CONTROLS )
|
#if( 0 < HID_CONTROLS )
|
||||||
#include "xua_hid_report_descriptor.h"
|
#include "xua_hid_report.h"
|
||||||
#include "user_hid.h"
|
#include "user_hid.h"
|
||||||
#include "xua_hid.h"
|
#include "xua_hid.h"
|
||||||
unsigned char g_hidData[HID_MAX_DATA_BYTES] = {0};
|
unsigned char g_hidData[HID_MAX_DATA_BYTES] = {0};
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
#if( 0 < HID_CONTROLS )
|
#if( 0 < HID_CONTROLS )
|
||||||
#include "hid.h"
|
#include "hid.h"
|
||||||
#include "xua_hid.h"
|
#include "xua_hid.h"
|
||||||
#include "xua_hid_report_descriptor.h"
|
#include "xua_hid_report.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if DSD_CHANS_DAC > 0
|
#if DSD_CHANS_DAC > 0
|
||||||
@@ -525,6 +525,7 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, NULLABLE_RESOURCE(c
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( 0 < HID_CONTROLS )
|
#if( 0 < HID_CONTROLS )
|
||||||
|
hidReportInit();
|
||||||
hidPrepareReportDescriptor();
|
hidPrepareReportDescriptor();
|
||||||
|
|
||||||
size_t hidReportDescriptorLength = hidGetReportDescriptorLength();
|
size_t hidReportDescriptorLength = hidGetReportDescriptorLength();
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include "xud.h"
|
#include "xud.h"
|
||||||
#include "xud_std_requests.h"
|
#include "xud_std_requests.h"
|
||||||
#include "xua_hid.h"
|
#include "xua_hid.h"
|
||||||
#include "xua_hid_report_descriptor.h"
|
#include "xua_hid_report.h"
|
||||||
|
|
||||||
#if( 0 < HID_CONTROLS )
|
#if( 0 < HID_CONTROLS )
|
||||||
static unsigned HidCalcNewReportTime( const unsigned currentPeriod, const unsigned reportTime, const unsigned reportToSetIdleInterval, const unsigned newPeriod );
|
static unsigned HidCalcNewReportTime( const unsigned currentPeriod, const unsigned reportTime, const unsigned reportToSetIdleInterval, const unsigned newPeriod );
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <xs1.h>
|
#include <xs1.h>
|
||||||
#include "descriptor_defs.h"
|
#include "descriptor_defs.h"
|
||||||
#include "xua_hid_report_descriptor.h"
|
#include "xua_hid_report.h"
|
||||||
#include "hid_report_descriptor.h"
|
#include "hid_report_descriptor.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -16,15 +16,15 @@
|
|||||||
/*
|
/*
|
||||||
* Each element in s_hidChangePending corresponds to an element in hidReports.
|
* Each element in s_hidChangePending corresponds to an element in hidReports.
|
||||||
*/
|
*/
|
||||||
static unsigned s_hidChangePending[ HID_REPORT_COUNT ] = { 0U };
|
static unsigned s_hidChangePending[ HID_REPORT_COUNT ];
|
||||||
static unsigned char s_hidReportDescriptor[ HID_REPORT_DESCRIPTOR_MAX_LENGTH ];
|
static unsigned char s_hidReportDescriptor[ HID_REPORT_DESCRIPTOR_MAX_LENGTH ];
|
||||||
static size_t s_hidReportDescriptorLength = 0U;
|
static size_t s_hidReportDescriptorLength;
|
||||||
static unsigned s_hidReportDescriptorPrepared = 0U;
|
static unsigned s_hidReportDescriptorPrepared;
|
||||||
|
|
||||||
static unsigned s_hidCurrentPeriod[ HID_REPORT_COUNT ] = { ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS };
|
static unsigned s_hidCurrentPeriod[ HID_REPORT_COUNT ];
|
||||||
static unsigned s_hidIdleActive[ HID_REPORT_COUNT ] = { 0U };
|
static unsigned s_hidIdleActive[ HID_REPORT_COUNT ];
|
||||||
static unsigned s_hidNextReportTime[ HID_REPORT_COUNT ] = { 0U };
|
static unsigned s_hidNextReportTime[ HID_REPORT_COUNT ];
|
||||||
static unsigned s_hidReportTime[ HID_REPORT_COUNT ] = { 0U };
|
static unsigned s_hidReportTime[ HID_REPORT_COUNT ];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the bit position from the location of a report element
|
* @brief Get the bit position from the location of a report element
|
||||||
@@ -370,6 +370,13 @@ void hidPrepareReportDescriptor( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void hidReportInit( void )
|
||||||
|
{
|
||||||
|
for( unsigned idx = 0U; idx < HID_REPORT_COUNT; ++idx ) {
|
||||||
|
s_hidCurrentPeriod[ idx ] = ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void hidResetReportDescriptor( void )
|
void hidResetReportDescriptor( void )
|
||||||
{
|
{
|
||||||
s_hidReportDescriptorPrepared = 0U;
|
s_hidReportDescriptorPrepared = 0U;
|
||||||
@@ -350,6 +350,13 @@ unsigned hidIsIdleActive( const unsigned id );
|
|||||||
*/
|
*/
|
||||||
void hidPrepareReportDescriptor( void );
|
void hidPrepareReportDescriptor( void );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initialise the USB HID Report functionality
|
||||||
|
*
|
||||||
|
* Call this function before using any other functions in this API.
|
||||||
|
*/
|
||||||
|
void hidReportInit( void );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reset the USB HID Report descriptor
|
* @brief Reset the USB HID Report descriptor
|
||||||
*
|
*
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "xua_unit_tests.h"
|
#include "xua_unit_tests.h"
|
||||||
#include "xua_hid_report_descriptor.h"
|
#include "xua_hid_report.h"
|
||||||
|
|
||||||
// Test constants related to the report descriptor defined in 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_BIT ( 7 )
|
||||||
@@ -59,6 +59,7 @@ void test_unprepared_hidGetReportDescriptor( void )
|
|||||||
void test_prepared_hidGetReportDescriptor( void )
|
void test_prepared_hidGetReportDescriptor( void )
|
||||||
{
|
{
|
||||||
const unsigned reportId = 0;
|
const unsigned reportId = 0;
|
||||||
|
hidReportInit();
|
||||||
hidPrepareReportDescriptor();
|
hidPrepareReportDescriptor();
|
||||||
unsigned char* reportDescPtr = hidGetReportDescriptor();
|
unsigned char* reportDescPtr = hidGetReportDescriptor();
|
||||||
TEST_ASSERT_NOT_NULL( reportDescPtr );
|
TEST_ASSERT_NOT_NULL( reportDescPtr );
|
||||||
@@ -69,6 +70,7 @@ void test_prepared_hidGetReportDescriptor( void )
|
|||||||
|
|
||||||
void test_reset_unprepared_hidGetReportDescriptor( void )
|
void test_reset_unprepared_hidGetReportDescriptor( void )
|
||||||
{
|
{
|
||||||
|
hidReportInit();
|
||||||
hidPrepareReportDescriptor();
|
hidPrepareReportDescriptor();
|
||||||
hidResetReportDescriptor();
|
hidResetReportDescriptor();
|
||||||
unsigned char* reportDescPtr = hidGetReportDescriptor();
|
unsigned char* reportDescPtr = hidGetReportDescriptor();
|
||||||
@@ -77,6 +79,7 @@ void test_reset_unprepared_hidGetReportDescriptor( void )
|
|||||||
|
|
||||||
void test_reset_prepared_hidGetReportDescriptor( void )
|
void test_reset_prepared_hidGetReportDescriptor( void )
|
||||||
{
|
{
|
||||||
|
hidReportInit();
|
||||||
hidPrepareReportDescriptor();
|
hidPrepareReportDescriptor();
|
||||||
hidResetReportDescriptor();
|
hidResetReportDescriptor();
|
||||||
hidPrepareReportDescriptor();
|
hidPrepareReportDescriptor();
|
||||||
@@ -450,6 +453,7 @@ void test_initial_modification_with_subsequent_preparation( void )
|
|||||||
const unsigned char header = construct_usage_header( sizeof data / sizeof( unsigned char ));
|
const unsigned char header = construct_usage_header( sizeof data / sizeof( unsigned char ));
|
||||||
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
const unsigned char page = CONSUMER_CONTROL_PAGE;
|
||||||
|
|
||||||
|
hidReportInit();
|
||||||
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, data );
|
unsigned retVal = hidSetReportItem( reportId, byte, bit, page, header, data );
|
||||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||||
|
|
||||||
@@ -532,6 +536,7 @@ void test_initial_modification_with_subsequent_verification_2( void )
|
|||||||
|
|
||||||
void test_modification_without_subsequent_preparation( void )
|
void test_modification_without_subsequent_preparation( void )
|
||||||
{
|
{
|
||||||
|
hidReportInit();
|
||||||
hidPrepareReportDescriptor();
|
hidPrepareReportDescriptor();
|
||||||
unsigned char* reportDescPtr = hidGetReportDescriptor();
|
unsigned char* reportDescPtr = hidGetReportDescriptor();
|
||||||
TEST_ASSERT_NOT_NULL( reportDescPtr );
|
TEST_ASSERT_NOT_NULL( reportDescPtr );
|
||||||
@@ -553,6 +558,7 @@ void test_modification_without_subsequent_preparation( void )
|
|||||||
|
|
||||||
void test_modification_with_subsequent_preparation( void )
|
void test_modification_with_subsequent_preparation( void )
|
||||||
{
|
{
|
||||||
|
hidReportInit();
|
||||||
hidPrepareReportDescriptor();
|
hidPrepareReportDescriptor();
|
||||||
unsigned char* reportDescPtr = hidGetReportDescriptor();
|
unsigned char* reportDescPtr = hidGetReportDescriptor();
|
||||||
TEST_ASSERT_NOT_NULL( reportDescPtr );
|
TEST_ASSERT_NOT_NULL( reportDescPtr );
|
||||||
|
|||||||
Reference in New Issue
Block a user