AP08113
Capacitive-Touch Color Wheel Implementation
Implementation of Color Wheel Software
Application Note
9
V1.0, 2010-08
3.2
Touch-Wheel Library
The Touch-Wheel Library (Library_TouchWheel.lib) has 2 main functions - calc_touchwheel() and
calc_compensation(). The functions are described in this section.
3.2.1
Calc_Touchwheel() Function
The calc_touchwheel() function provides the status (i.e. whether touch-wheel is touched), the position (the
absolute position of the last touch on the touch-wheel) and the touch-wheel average value as described in
Table 1
.
3.2.2
Calc_Compensation() Function
The compensation value is one of the user-defined parameters for calc_touchwheel function (see
Section 3.2.1
).
The compensation values for Wheel1 and Wheel2 are calculated with respect to Wheel3, as shown in
Equation (5)
and
Equation (6)
, to ensure that all values are equal under idle (no touch) condition.
(5)
(6)
Table 1
Specification of the Touch-Wheel Library Function - calc_touchwheel()
Function Name
calc_touchwheel
Prototype
void calc_touchwheel (int idata *parameter, char idata *angle, unsigned int idata *amplitude)
Input
Address pointer of touch-wheel parameters (
wheel_param[0]
)
The parameters include compensation for wheel2 and wheel1, amplitude threshold and filter
gain. Refer to
Section 4.1
for descriptions of the user-defined parameters.
Address pointer of touch-wheel angle (
wheel_angle)
The angle value is updated when the touch-wheel is touched
Address pointer of touch-wheel amplitude (
wheel_amplitude[0]
)
The amplitude includes the touch-wheel position and the touch-wheel initial average value.
Refer to
Section 4.1
for descriptions of the user-defined parameters.
Return
None
Output
Touch-wheel Status
(wheel_amplitude[0])
00
H
The touch-wheel is not touched
>00
H
The touch-wheel is touched
Touch-wheel Position
(wheel_angle)
This value is updated by the Touch-Wheel Library when the touch-wheel status is more than
0x00 (i.e. a touch is detected on the touch-wheel). The HSL value is updated accordingly
Touch-wheel Average Value
(wheel_amplitude[1])
This value is calculated and updated by the Touch-Wheel Library when the touch-wheel is not
touched
Max Stack size
2
Resource used
XRAM address 0xF0F6 - 0xF0FF (10 bytes)
1)
1) These parameters are stored by the FINDTOUCHEDPAD function and are used to calculate the Average value for the
touch-sense inputs.
COMPENSATION_WHEEL2
AVERAGEL/H of WHEEL3
(
)
AVERAGEL/H of WHEEL2
(
)
–
=
COMPENSATION_WHEEL1
AVERAGEL/H of WHEEL3
(
)
AVERAGEL/H of WHEEL1
(
)
–
=
All manuals and user guides at all-guides.com