forked from PAWPAW-Mirror/lib_xua
Merge develop into feature/dfu_detach_time_out
This commit is contained in:
@@ -13,6 +13,13 @@ lib_xua Change Log
|
|||||||
* ADDED: Guards to user_hid.h and xua_hid.h
|
* ADDED: Guards to user_hid.h and xua_hid.h
|
||||||
* ADDED: UAC1 HID support for AC Stop (End Call), Volume Increment and
|
* ADDED: UAC1 HID support for AC Stop (End Call), Volume Increment and
|
||||||
Volume Decrement
|
Volume Decrement
|
||||||
|
* CHANGE: UAC1 HID to report function keys f21 through f24 as specified by
|
||||||
|
customer
|
||||||
|
* CHANGE: HID interface for user to set and clear events from global
|
||||||
|
variable to function
|
||||||
|
* CHANGE HID report descriptor to use generic events instead of GPI
|
||||||
|
events, to report Key-phrase detection as AC Search, and to report end-call
|
||||||
|
detection as AC Stop
|
||||||
|
|
||||||
0.2.1
|
0.2.1
|
||||||
-----
|
-----
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved
|
// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved
|
||||||
#include "xua.h"
|
#include "xua.h"
|
||||||
#if XUA_USB_EN
|
#if XUA_USB_EN
|
||||||
#include <xs1.h>
|
#include <xs1.h>
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#if( 0 < HID_CONTROLS )
|
#if( 0 < HID_CONTROLS )
|
||||||
#include "user_hid.h"
|
#include "user_hid.h"
|
||||||
unsigned char g_hidData[1] = {0};
|
unsigned char g_hidData[HID_DATA_BYTES] = {0};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void GetADCCounts(unsigned samFreq, int &min, int &mid, int &max);
|
void GetADCCounts(unsigned samFreq, int &min, int &mid, int &max);
|
||||||
@@ -880,7 +880,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
|||||||
case XUD_SetData_Select(c_hid, ep_hid, result):
|
case XUD_SetData_Select(c_hid, ep_hid, result):
|
||||||
{
|
{
|
||||||
g_hidData[0]=0;
|
g_hidData[0]=0;
|
||||||
g_hidData[0]=UserHIDGetData();
|
UserHIDGetData(g_hidData);
|
||||||
XUD_SetReady_In(ep_hid, g_hidData, 1);
|
XUD_SetReady_In(ep_hid, g_hidData, 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -564,26 +564,26 @@ unsigned char devQualDesc_Null[] =
|
|||||||
#if( 0 < HID_CONTROLS )
|
#if( 0 < HID_CONTROLS )
|
||||||
unsigned char hidReportDescriptor[] = /* Voice Command usage as per request #HUTRR45 */
|
unsigned char hidReportDescriptor[] = /* Voice Command usage as per request #HUTRR45 */
|
||||||
{
|
{
|
||||||
0x15, 0x01, /* Logical Minimum (1) */
|
0x05, 0x01, /* Usage Page (Generic Desktop) */
|
||||||
0x25, 0x01, /* Logical Maximum (1) */
|
0x09, 0x06, /* Usage (Keyboard) */
|
||||||
0x75, 0x01, /* Report Size (1) */
|
|
||||||
0x05, 0x0c, /* Usage Page (Consumer Device) */
|
|
||||||
0x09, 0x01, /* Usage (Consumer Control) */
|
|
||||||
0xa1, 0x01, /* Collection (Application) */
|
0xa1, 0x01, /* Collection (Application) */
|
||||||
0x0a, 0x00, 0x02, /* Usage (Generic GUI Application Controls) */
|
0x75, 0x01, /* Report Size (1) */
|
||||||
0xa1, 0x02, /* Collection (Logical) */
|
|
||||||
0x95, 0x01, /* Report Count (1) */
|
|
||||||
0x0a, 0x21, 0x02, /* Usage (AC Search) */
|
|
||||||
0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */
|
|
||||||
0x0a, 0x26, 0x02, /* Usage (AC Stop) */
|
|
||||||
0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */
|
|
||||||
0x09, 0xe9, /* Usage (Volume Increment) */
|
|
||||||
0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */
|
|
||||||
0x09, 0xea, /* Usage (Volume Decrement) */
|
|
||||||
0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */
|
|
||||||
0x95, 0x04, /* Report Count (4) */
|
0x95, 0x04, /* Report Count (4) */
|
||||||
0x81, 0x01, /* Input (Cnst, Ary, Abs) */
|
0x15, 0x00, /* Logical Minimum (0) */
|
||||||
0xc0, /* End collection (Logical) */
|
0x25, 0x00, /* Logical Maximum (0) */
|
||||||
|
0x81, 0x01, /* Input (Cnst, Ary, Abs, No Wrap, Lin, Pref, No Nul) */
|
||||||
|
0x95, 0x01, /* Report Count (1) */
|
||||||
|
0x25, 0x01, /* Logical Maximum (1) */
|
||||||
|
0x05, 0x0C, /* Usage Page (Consumer) */
|
||||||
|
0x0a, 0x21, 0x02, /* Usage (AC Search) */
|
||||||
|
0x81, 0x02, /* Input (Data, Var, Abs, No Wrap, Lin, Pref, No Nul) */
|
||||||
|
0x0a, 0x26, 0x02, /* Usage (AC Stop) */
|
||||||
|
0x81, 0x02, /* Input (Data, Var, Abs, No Wrap, Lin, Pref, No Nul) */
|
||||||
|
0x95, 0x02, /* Report Count (2) */
|
||||||
|
0x05, 0x07, /* Usage Page (Key Codes) */
|
||||||
|
0x19, 0x72, /* Usage Minimum (Keyboard F23) */
|
||||||
|
0x29, 0x73, /* Usage Maximum (Keyboard F24) */
|
||||||
|
0x81, 0x02, /* Input (Data, Var, Abs, No Wrap, Lin, Pref, No Nul) */
|
||||||
0xc0 /* End collection (Application) */
|
0xc0 /* End collection (Application) */
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
// Copyright (c) 2013-2019, XMOS Ltd, All rights reserved
|
// Copyright (c) 2013-2020, XMOS Ltd, All rights reserved
|
||||||
|
|
||||||
#ifndef __USER_HID_H__
|
#ifndef __USER_HID_H__
|
||||||
#define __USER_HID_H__
|
#define __USER_HID_H__
|
||||||
|
|
||||||
/* These enumerated constants relate to the HID report desc - do not mod */
|
/**
|
||||||
|
* \brief HID event identifiers
|
||||||
|
*
|
||||||
|
* This enumeration defines a constant value for each HID event.
|
||||||
|
* It defines one value for each of the four GPI pins supported in the standard voice products.
|
||||||
|
* It defines a further 28 values for generic events.
|
||||||
|
*/
|
||||||
typedef enum hidEventId_t {
|
typedef enum hidEventId_t {
|
||||||
HID_EVENT_ID_GPI0 = 0,
|
HID_EVENT_ID_GPI0 = 0,
|
||||||
HID_EVENT_ID_GPI1,
|
HID_EVENT_ID_GPI1,
|
||||||
@@ -36,16 +42,44 @@ typedef enum hidEventId_t {
|
|||||||
HID_EVENT_ID_EVT24,
|
HID_EVENT_ID_EVT24,
|
||||||
HID_EVENT_ID_EVT25,
|
HID_EVENT_ID_EVT25,
|
||||||
HID_EVENT_ID_EVT26,
|
HID_EVENT_ID_EVT26,
|
||||||
HID_EVENT_ID_EVT27
|
HID_EVENT_ID_EVT27,
|
||||||
|
HID_EVENT_ID_INVALID = 0xffffffff,
|
||||||
} hidEventId_t;
|
} hidEventId_t;
|
||||||
|
|
||||||
#define HID_DATA_SIZE 1
|
#define HID_DATA_BYTES 4
|
||||||
|
|
||||||
#if( 0 < HID_CONTROLS )
|
#if( 0 < HID_CONTROLS )
|
||||||
|
|
||||||
unsigned UserHIDGetData( void );
|
/**
|
||||||
|
* \brief Get the data for the next HID report
|
||||||
|
*
|
||||||
|
* \note This function returns the HID data as a list of unsigned char because the
|
||||||
|
* \c XUD_SetReady_In() accepts data for transmission to the USB Host using
|
||||||
|
* this type.
|
||||||
|
*
|
||||||
|
* \param{out} hidData The HID data
|
||||||
|
*/
|
||||||
|
void UserHIDGetData( unsigned char hidData[ HID_DATA_BYTES ]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Initialize HID processing
|
||||||
|
*/
|
||||||
void UserHIDInit( void );
|
void UserHIDInit( void );
|
||||||
void UserHIDRegisterEvent( const hidEventId_t hidEventId, const int * hidEventData, const unsigned hidEventDataSize );
|
|
||||||
|
/**
|
||||||
|
* \brief Record that a HID event has occurred
|
||||||
|
*
|
||||||
|
* \param{in} hidEventId The identifier of an event which has occurred
|
||||||
|
* \param{in} hidEventData A list of data associated with the event
|
||||||
|
* \param{in} hidEventDataSize The length of the event data list
|
||||||
|
*
|
||||||
|
* \note At present, this function only takes a single element of event data, i.e.
|
||||||
|
* hidEventDataSize must equal 1.
|
||||||
|
*
|
||||||
|
* \note At present, this function treats the event data as a Boolean flag.
|
||||||
|
* Zero means False; all other values mean True.
|
||||||
|
*/
|
||||||
|
void UserHIDRecordEvent( const hidEventId_t hidEventId, const int * hidEventData, const unsigned hidEventDataSize );
|
||||||
|
|
||||||
#endif /* ( 0 < HID_CONTROLS ) */
|
#endif /* ( 0 < HID_CONTROLS ) */
|
||||||
#endif /* __USER_HID_H__ */
|
#endif /* __USER_HID_H__ */
|
||||||
|
|||||||
Reference in New Issue
Block a user