AP08113
Capacitive-Touch Color Wheel Implementation
Implementation of Color Wheel Software
Application Note
11
V1.0, 2010-08
3.4
Overview Flow Chart of Color Wheel Software Code
Figure 4
shows the overview flow chart of the Color Wheel software code.
Figure 4
Overview Flow Chart of the Color Wheel Software Code
Start
n
Initialization of all
modules
Call “Touch-Wheel Library”
Function to:
- detect if touch-wheel is touched
- calculate AverageL/H
- calculate Angle
Light up “ON” LED
Touch-wheel is
touched?
Update Wheel_hue/sat/lum
with Angle (output from Touch-
Wheel Lib), depending on
which color mode is enabled.
y
Change colur mode and
respective LED3/2/1 (loop)
Centre button is
touched?
n
y
Centre button is touched
for long period?
n
Enter Power Down Mode
- Disable interrupts
- Disable WDT, if enabled
- Disable all peripherals and ports except TS
- Configure RTC for 1 second
- Save SFR LTS_TSVAL value
- Enter Power Down Mode 2
- Upon wake up, wait for Time Frame interrupt,
then compare current LTS_TSVAL with the
saved_value (saved value of LTS_TSVAL –
TSVAL_SUBTRACTION)
LTS_TSVAL >
saved_value?
y
y
n
Light up RGB LED (D2)
-Transform HSL to RGB
-Update PWM duty cycle
according to RGB value
n
Check for P2.0=1 and
P2.1=0
(Handled by XC800_FLOAD.exe,
by clicking “Connect” button)
Enter UART BSL Mode
to update software code
y
All manuals and user guides at all-guides.com
all-guides.com