User Manual

13
Figure 9. Color / ALS State Diagram
Color and Ambient Light Sense Operation
The Color and Ambient Light Sense detection functional-
ity uses an array of color and IR ltered photodiodes to
measure red, green, and blue content of light, as well as
the non-color ltered clear channel. The following regis-
ters and control bits govern Color/ALS operation and the
operational ow is depicted in Figure 9.
The Color/ALS reception signal path begins with ltered
RGBC detection at the photodiodes and ends with the
16-bit results in the RGBC data registers. Signal from the
photodiode array accumulates for a period of time set by
the value in ATIME before the results are placed into the
RGBCDATA registers. Gain is adjustable from 1x to 64x,
and is determined by the setting of CONTROL<AGAIN>.
Performance characteristics such as accuracy, resolution,
conversion speed, and power consumption can be adjust-
ed to meet the needs of the application.
Before entering (re-entering) the Color/ALS engine, an
adjustable, low power consumption, delay is entered.
The wait time for this delay is selectable using the WEN,
WTIME and WLONG control bits and ranges from 0 to
8.54s. During this period the internal oscillator is still
running, but all other circuitry is deactivated.
An interrupt can be generated whenever Clear Channel
results exceed or fall below levels set in the AILTL/AIHTL
and/or AILTH/AIHTH threshold registers. To prevent pre-
mature/false interrupts a persistence lter is also includ-
ed; interrupts will only be asserted if the consecutive
number of out-of-threshold results is equal or greater
than the value set by APERS. Each in-threshold” Clear
channel result, CDATA, will reset the persistence count. If
the analog circuitry becomes saturated, the ASAT bit will
be asserted to indicate RGBCDATA results may not be ac-
curate. The AINT and CPSAT bits are always available for
I²C polling, but AIEN bit must be set for AINT to assert a
hardware interrupt on the INT pin. Similarly, saturation
of the analog data converter can be detected by polling
CPSAT bit; to enable this feature the CPSIEN bit must be
set. AVALID is cleared by reading RGBCDATA. ASAT, and
AINT are cleared by “address accessing” (i.e. I²C transac-
tion consisting of only two bytes: chip address, followed
by a register address with R/W=1) CICLEAR or AICLEAR.
RGBC results can be used to calculate ambient light levels
(i.e. Lux) and color temperature (i.e. Kelvin).
COLLECT
COLOR
DATA
DATA TO
R,G,B,CDATA
AVALID = 1
AEN = 1
ENTER
COLOR
PERSISTANCE++
AI
L/H
RESET
PERSISTANCE
PERSISTANCE
>=
APERS
N
AINT = 1
Y
ASSERT INT PIN
AIEN ==1
?
Y
N
EXIT
COLOR/ALS ENGINE
AVALID is automatically reset
whenever any of C,R,G,B-
DATA registers are read. AINT
and CPSAT are manually
reset by a write-access to
CICLEAR or AICLEAR.
TL <=
CDATA
<= A
L/H
TH
?