@@ -32,6 +32,19 @@ const float VEML7700_LUX_RESOLUTION[VEML7700_NUM_GAIN_SETTINGS][VEML7700_NUM_INT
3232 {0.9216 , 0.4608 , 0.2304 , 0.1152 , 0.0576 , 0.0288 } // Gain (sensitivity) 1/4
3333};
3434
35+ const char *VEML7700_GAIN_SETTINGS[VEML7700_NUM_GAIN_SETTINGS + 1 ] =
36+ {
37+ // Note: these are in the order define by ALS_SM and VEML7700_sensitivity_mode_t
38+ " x1" ," x2" ," x1/8" ," x1/4" ," INVALID"
39+ };
40+
41+ const char *VEML7700_INTEGRATION_TIMES[VEML7700_NUM_INTEGRATION_TIMES + 1 ] =
42+ {
43+ // Note: these are in ascending (VEML7700_integration_time_t) order
44+ // _not_ in ALS_IT (VEML7700_config_integration_time_t) order
45+ " 25ms" ," 50ms" ," 100ms" ," 200ms" ," 400ms" ," 800ms" ," INVALID"
46+ };
47+
3548VEML7700::VEML7700 ()
3649{
3750 _i2cPort = NULL ;
@@ -269,6 +282,15 @@ VEML7700_integration_time_t VEML7700::getIntegrationTime()
269282 return ((VEML7700_integration_time_t)integrationTimeFromConfig ((VEML7700_config_integration_time_t)_configurationRegister.CONFIG_REG_IT ));
270283}
271284
285+ const char * VEML7700::getIntegrationTimeStr ()
286+ {
287+ VEML7700_integration_time_t it;
288+
289+ getIntegrationTime (&it);
290+
291+ return (VEML7700_INTEGRATION_TIMES[it]);
292+ }
293+
272294VEML7700_error_t VEML7700::setSensitivityMode (VEML7700_sensitivity_mode_t sm)
273295{
274296 VEML7700_error_t err;
@@ -315,6 +337,15 @@ VEML7700_sensitivity_mode_t VEML7700::getSensitivityMode()
315337 return ((VEML7700_sensitivity_mode_t)_configurationRegister.CONFIG_REG_SM );
316338}
317339
340+ const char * VEML7700::getSensitivityModeStr ()
341+ {
342+ VEML7700_sensitivity_mode_t sm;
343+
344+ getSensitivityMode (&sm);
345+
346+ return (VEML7700_GAIN_SETTINGS[sm]);
347+ }
348+
318349VEML7700_error_t VEML7700::setHighThreshold (uint16_t threshold)
319350{
320351 return (writeI2CRegister ((VEML7700_t)threshold, VEML7700_HIGH_THRESHOLD));
@@ -390,7 +421,7 @@ VEML7700_error_t VEML7700::getLux(float *lux)
390421 if (_debugEnabled)
391422 {
392423 _debugPort->print (F (" VEML7700::getLux: gain / sensitivity: " ));
393- _debugPort->println (sm );
424+ _debugPort->println (VEML7700_GAIN_SETTINGS[sm] );
394425 }
395426
396427 VEML7700_integration_time_t it;
@@ -403,7 +434,7 @@ VEML7700_error_t VEML7700::getLux(float *lux)
403434 if (_debugEnabled)
404435 {
405436 _debugPort->print (F (" VEML7700::getLux: integration time: " ));
406- _debugPort->println (it );
437+ _debugPort->println (VEML7700_INTEGRATION_TIMES[it] );
407438 }
408439
409440 // Now we can extract the correct resolution from the look up table.
0 commit comments