File tree 1 file changed +27
-0
lines changed
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -120,6 +120,33 @@ void Adafruit_TCS34725::enable(void)
120
120
write8 (TCS34725_ENABLE, TCS34725_ENABLE_PON);
121
121
delay (3 );
122
122
write8 (TCS34725_ENABLE, TCS34725_ENABLE_PON | TCS34725_ENABLE_AEN);
123
+ /* Set a delay for the integration time.
124
+ This is only necessary in the case where enabling and then
125
+ immediately trying to read values back. This is because setting
126
+ AEN triggers an automatic integration, so if a read RGBC is
127
+ performed too quickly, the data is not yet valid and all 0's are
128
+ returned */
129
+ switch (_tcs34725IntegrationTime)
130
+ {
131
+ case TCS34725_INTEGRATIONTIME_2_4MS:
132
+ delay (3 );
133
+ break ;
134
+ case TCS34725_INTEGRATIONTIME_24MS:
135
+ delay (24 );
136
+ break ;
137
+ case TCS34725_INTEGRATIONTIME_50MS:
138
+ delay (50 );
139
+ break ;
140
+ case TCS34725_INTEGRATIONTIME_101MS:
141
+ delay (101 );
142
+ break ;
143
+ case TCS34725_INTEGRATIONTIME_154MS:
144
+ delay (154 );
145
+ break ;
146
+ case TCS34725_INTEGRATIONTIME_700MS:
147
+ delay (700 );
148
+ break ;
149
+ }
123
150
}
124
151
125
152
/* *************************************************************************/
You can’t perform that action at this time.
0 commit comments