AP08113
Capacitive-Touch Color Wheel Implementation
Implementation of Color Wheel Software
Application Note
10
V1.0, 2010-08
The calc_compensation() function provides the compensation values for Wheel1 and Wheel2 as described in
Table 2
. The user can call this function during board calibration to obtain an estimation of the compensation
values. The values can be programmed to observe the sensitivity of the touch-wheel and further refined by the
user. This function should be called after an initialization period to get a stable value. Suggested initialization
period is about 640 Time Frame duration or interrupt and it can be calculated from
Equation (7)
.
(7)
where:
•
Divisor n is defined as 2
•
AccumulatorCounter is defined as 4
•
Number of Touch-sense inputs [TSIN(x)] is 4
•
TFD is the Time Frame Duration
3.3
RGB LED
Figure 3
shows how the touch detection on the touch-wheel (based on the color mode) is reflected on the RGB
LED (D2). The HSL value is obtained from the Touch-Wheel Library, converted to an RGB value (via the
HSL_TO_RGB function), and the CCU6 registers are programmed where their respective pins are connected to
the RGB LED.
Figure 3
HSL to RGB LED Block Diagram
Table 2
Specification of the Touch-wheel Library Function - calc_compensation()
Function Name
calc_compensation
Prototype
void calc_compensation (int idata *compensation)
Input
Address pointer of touch-wheel parameters (
compensation[0]
)
The parameters include the compensation for wheel2 and wheel1.
Return
None
Output
Wheel2 Compensation Value
(compensation[0])
The Compensation_Wheel2 value with respect to Wheel3
Wheel1 Compensation Value
(compensation[1])
The Compensation_Wheel1 value with respect to Wheel3
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.
Period 2
>
Divisor n
8
AccumulatorCounter 1
+
(
)
×
×
Number of Touch-sense inputs
(
)
TFD
×
×
HSL Color Space
RGB Color Space
R value
CCU6
G value
B value
HSL_TO_
RGB()
CC60SRLH
CC61SRLH
CC62SRLH
H value
S value
L value
Touch-wheel and centre button
RGB LED (D2)
PWM
All manuals and user guides at all-guides.com