diff options
-rw-r--r-- | driver/als_opt3001.c | 4 | ||||
-rw-r--r-- | driver/als_opt3001.h | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/driver/als_opt3001.c b/driver/als_opt3001.c index fd5dded45d..4772816a2a 100644 --- a/driver/als_opt3001.c +++ b/driver/als_opt3001.c @@ -208,8 +208,8 @@ static int opt3001_set_data_rate(const struct motion_sensor_t *s, * integrating over 800ms. * Do not allow range higher than 1Hz. */ - if (rate > 1000) - rate = 1000; + if (rate > OPT3001_LIGHT_MAX_FREQ) + rate = OPT3001_LIGHT_MAX_FREQ; } rv = opt3001_i2c_read(s->port, s->addr, OPT3001_REG_CONFIGURE, ®); if (rv) diff --git a/driver/als_opt3001.h b/driver/als_opt3001.h index d2d2737e20..2f8098c381 100644 --- a/driver/als_opt3001.h +++ b/driver/als_opt3001.h @@ -36,9 +36,12 @@ enum opt3001_mode { #define OPT3001_MANUFACTURER_ID 0x5449 #define OPT3001_DEVICE_ID 0x3001 -/* Min and Max sampling frequency in mHz */ -#define OPT3001_LIGHT_MIN_FREQ 1250 -#define OPT3001_LIGHT_MAX_FREQ 10000 +/* + * Min and Max sampling frequency in mHz. + * Due to integration set at 800ms, we limit max frequency to 1Hz. + */ +#define OPT3001_LIGHT_MIN_FREQ 100 +#define OPT3001_LIGHT_MAX_FREQ 1000 #if (CONFIG_EC_MAX_SENSOR_FREQ_MILLIHZ <= OPT3001_LIGHT_MAX_FREQ) #error "EC too slow for light sensor" #endif |