Zephyr API Documentation  3.7.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
ccs811.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 Peter Bigot Consulting, LLC
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
15#ifndef ZEPHYR_INCLUDE_DRIVERS_SENSOR_CCS811_H_
16#define ZEPHYR_INCLUDE_DRIVERS_SENSOR_CCS811_H_
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22#include <zephyr/device.h>
24
25/* Status register fields */
26#define CCS811_STATUS_ERROR BIT(0)
27#define CCS811_STATUS_DATA_READY BIT(3)
28#define CCS811_STATUS_APP_VALID BIT(4)
29#define CCS811_STATUS_FW_MODE BIT(7)
30
31/* Error register fields */
32#define CCS811_ERROR_WRITE_REG_INVALID BIT(0)
33#define CCS811_ERROR_READ_REG_INVALID BIT(1)
34#define CCS811_ERROR_MEASMODE_INVALID BIT(2)
35#define CCS811_ERROR_MAX_RESISTANCE BIT(3)
36#define CCS811_ERROR_HEATER_FAULT BIT(4)
37#define CCS811_ERROR_HEATER_SUPPLY BIT(5)
38
39/* Measurement mode constants */
40#define CCS811_MODE_IDLE 0x00
41#define CCS811_MODE_IAQ_1SEC 0x10
42#define CCS811_MODE_IAQ_10SEC 0x20
43#define CCS811_MODE_IAQ_60SEC 0x30
44#define CCS811_MODE_IAQ_250MSEC 0x40
45#define CCS811_MODE_MSK 0x70
46
51
57
60
63
70};
71
83const struct ccs811_result_type *ccs811_result(const struct device *dev);
84
96};
97
107int ccs811_configver_fetch(const struct device *dev,
108 struct ccs811_configver_type *ptr);
109
124int ccs811_baseline_fetch(const struct device *dev);
125
138int ccs811_baseline_update(const struct device *dev, uint16_t baseline);
139
154int ccs811_envdata_update(const struct device *dev,
155 const struct sensor_value *temperature,
156 const struct sensor_value *humidity);
157
158#ifdef __cplusplus
159}
160#endif
161
162#endif /* ZEPHYR_INCLUDE_DRIVERS_SENSOR_CCS811_H_ */
int ccs811_baseline_fetch(const struct device *dev)
Fetch the current value of the BASELINE register.
int ccs811_configver_fetch(const struct device *dev, struct ccs811_configver_type *ptr)
Fetch operating mode and version information.
const struct ccs811_result_type * ccs811_result(const struct device *dev)
Access storage for the most recent data read from the sensor.
int ccs811_envdata_update(const struct device *dev, const struct sensor_value *temperature, const struct sensor_value *humidity)
Update the ENV_DATA register.
int ccs811_baseline_update(const struct device *dev, uint16_t baseline)
Update the BASELINE register.
Public APIs for the sensor driver.
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
Get information about static CCS811 state.
Definition: ccs811.h:91
uint16_t fw_boot_version
Definition: ccs811.h:92
uint8_t mode
Definition: ccs811.h:95
uint8_t hw_version
Definition: ccs811.h:94
uint16_t fw_app_version
Definition: ccs811.h:93
Information collected from the sensor on each fetch.
Definition: ccs811.h:48
uint8_t error
Sensor error flags at completion of most recent fetch.
Definition: ccs811.h:69
uint16_t co2
Equivalent carbon dioxide in parts-per-million volume (ppmv).
Definition: ccs811.h:50
uint16_t raw
Raw voltage and current measured by sensor.
Definition: ccs811.h:59
uint16_t voc
Equivalent total volatile organic compounds in parts-per-billion volume.
Definition: ccs811.h:56
uint8_t status
Sensor status at completion of most recent fetch.
Definition: ccs811.h:62
Runtime device structure (in ROM) per driver instance.
Definition: device.h:403
Representation of a sensor readout value.
Definition: sensor.h:51