123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- #ifndef ZEPHYR_INCLUDE_DRIVERS_SENSOR_CCS811_H_
- #define ZEPHYR_INCLUDE_DRIVERS_SENSOR_CCS811_H_
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include <device.h>
- #include <drivers/sensor.h>
- #define CCS811_STATUS_ERROR BIT(0)
- #define CCS811_STATUS_DATA_READY BIT(3)
- #define CCS811_STATUS_APP_VALID BIT(4)
- #define CCS811_STATUS_FW_MODE BIT(7)
- #define CCS811_ERROR_WRITE_REG_INVALID BIT(0)
- #define CCS811_ERROR_READ_REG_INVALID BIT(1)
- #define CCS811_ERROR_MEASMODE_INVALID BIT(2)
- #define CCS811_ERROR_MAX_RESISTANCE BIT(3)
- #define CCS811_ERROR_HEATER_FAULT BIT(4)
- #define CCS811_ERROR_HEATER_SUPPLY BIT(5)
- #define CCS811_MODE_IDLE 0x00
- #define CCS811_MODE_IAQ_1SEC 0x10
- #define CCS811_MODE_IAQ_10SEC 0x20
- #define CCS811_MODE_IAQ_60SEC 0x30
- #define CCS811_MODE_IAQ_250MSEC 0x40
- #define CCS811_MODE_MSK 0x70
- struct ccs811_result_type {
-
- uint16_t co2;
-
- uint16_t voc;
-
- uint16_t raw;
-
- uint8_t status;
-
- uint8_t error;
- };
- const struct ccs811_result_type *ccs811_result(const struct device *dev);
- struct ccs811_configver_type {
- uint16_t fw_boot_version;
- uint16_t fw_app_version;
- uint8_t hw_version;
- uint8_t mode;
- };
- int ccs811_configver_fetch(const struct device *dev,
- struct ccs811_configver_type *ptr);
- int ccs811_baseline_fetch(const struct device *dev);
- int ccs811_baseline_update(const struct device *dev, uint16_t baseline);
- int ccs811_envdata_update(const struct device *dev,
- const struct sensor_value *temperature,
- const struct sensor_value *humidity);
- #ifdef __cplusplus
- }
- #endif
- #endif
|