
USB Audio Design Guide 38/61
3.19.4 HID Example
The codebase includes an example of a HID volume control implementation based
on ADC data. This code should be considered an example only since an absolute
ADC input does not serve as an ideal input to a relative HID volume control. Buttons
(such as that on the single tile L-Series board) or a Rotary Encoder would be a more
fitting choice of input component.
This code is enabled if
HID_CONTROLS
,
SU1_ADC_ENABLE
and
ADC_VOL_CONTROL
are all
defined as 1.
The
Vendor_ReadHIDButtons()
function simply looks at the value from the ADC,
if is near the maximum value it reports a volume up, near the minimum value a
volume down is reported. If the ADC value is mid-range no event is reported. The
code is shown below:
void Ven d o r _Rea d H I DButt o n s ( unsigned char hidData [])
{
unsigned adcVal ;
hidData [0] = 0;
# if defined ( A D C_VOL_CO N T R O L ) && ( A D C _ VOL_CON T R O L == 1)
adcVal = g_adcVal >> 20;
if( adcVal < ( ADC_MIN + THRESH ) )
{
/* Volume down */
hidData [0] = 0 x10 ;
}
else if ( adcVal > ( A D C _MAX - T HRESH ) )
{
/* Volume up */
hidData [0] = 0 x08 ;
}
3.19.5 Validated Build Options
The reference design can be built in several ways by changing the build options.
These are described in §5.1.
The design has only been fully validated against the build options as set in the
application as distributed. See §3.1 for details and binary naming scheme.
These fully validated build configurations are listed below. In practise, due to the
similarities between the U-Series and L-Series feature set, it is fully expected that
all listed U-Series configurations will operate as expected on the L-Series and vice
versa.
REV 6.1
Kommentare zu diesen Handbüchern