drivers: sensor: ccs811: enable drive mode 4

This mode is documented as producing a raw result every 250 ms that the
application must convert to eCO2 and eTVOC readings.  In practice
application firmware 2.0 appears to convert the readings as with all
other rates.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This commit is contained in:
Peter A. Bigot 2018-11-23 06:51:02 -06:00 committed by Maureen Helm
commit 2dd990ad55
3 changed files with 10 additions and 5 deletions

View file

@ -31,6 +31,9 @@ config CCS811_DRIVE_MODE_2
config CCS811_DRIVE_MODE_3
bool "Measurement every sixty seconds"
config CCS811_DRIVE_MODE_4
bool "Measurement every 250 milliseconds"
endchoice
config CCS811_TRIGGER

View file

@ -474,13 +474,15 @@ static int ccs811_init(struct device *dev)
}
/* Configure measurement mode */
u8_t meas_mode = 0;
u8_t meas_mode = CCS811_MODE_IDLE;
#ifdef CONFIG_CCS811_DRIVE_MODE_1
meas_mode = 0x10;
meas_mode = CCS811_MODE_IAQ_1SEC;
#elif defined(CONFIG_CCS811_DRIVE_MODE_2)
meas_mode = 0x20;
meas_mode = CCS811_MODE_IAQ_10SEC;
#elif defined(CONFIG_CCS811_DRIVE_MODE_3)
meas_mode = 0x30;
meas_mode = CCS811_MODE_IAQ_60SEC;
#elif defined(CONFIG_CCS811_DRIVE_MODE_4)
meas_mode = CCS811_MODE_IAQ_250MSEC;
#endif
if (i2c_reg_write_byte(drv_data->i2c, DT_INST_0_AMS_CCS811_BASE_ADDRESS,
CCS811_REG_MEAS_MODE,

View file

@ -41,7 +41,7 @@ extern "C" {
#define CCS811_MODE_IAQ_1SEC 0x10
#define CCS811_MODE_IAQ_10SEC 0x20
#define CCS811_MODE_IAQ_60SEC 0x30
#define CCS811_MODE_IAQ_RAW_250MSEC 0x40
#define CCS811_MODE_IAQ_250MSEC 0x40
/** @brief Information collected from the sensor on each fetch. */
struct ccs811_result_type {