Zephyr API Documentation 4.5.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
16#ifndef ZEPHYR_INCLUDE_DRIVERS_SENSOR_CCS811_H_
17#define ZEPHYR_INCLUDE_DRIVERS_SENSOR_CCS811_H_
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23#include <zephyr/device.h>
25
32
37#define CCS811_STATUS_ERROR BIT(0)
38#define CCS811_STATUS_DATA_READY BIT(3)
39#define CCS811_STATUS_APP_VALID BIT(4)
40#define CCS811_STATUS_FW_MODE BIT(7)
42
47#define CCS811_ERROR_WRITE_REG_INVALID BIT(0)
48#define CCS811_ERROR_READ_REG_INVALID BIT(1)
49#define CCS811_ERROR_MEASMODE_INVALID BIT(2)
50#define CCS811_ERROR_MAX_RESISTANCE BIT(3)
51#define CCS811_ERROR_HEATER_FAULT BIT(4)
52#define CCS811_ERROR_HEATER_SUPPLY BIT(5)
54
59#define CCS811_MODE_IDLE 0x00
60#define CCS811_MODE_IAQ_1SEC 0x10
61#define CCS811_MODE_IAQ_10SEC 0x20
62#define CCS811_MODE_IAQ_60SEC 0x30
63#define CCS811_MODE_IAQ_250MSEC 0x40
64#define CCS811_MODE_MSK 0x70
66
91
103const struct ccs811_result_type *ccs811_result(const struct device *dev);
104
117
127int ccs811_configver_fetch(const struct device *dev,
128 struct ccs811_configver_type *ptr);
129
144int ccs811_baseline_fetch(const struct device *dev);
145
158int ccs811_baseline_update(const struct device *dev, uint16_t baseline);
159
174int ccs811_envdata_update(const struct device *dev,
175 const struct sensor_value *temperature,
176 const struct sensor_value *humidity);
177
179
180#ifdef __cplusplus
181}
182#endif
183
184#endif /* ZEPHYR_INCLUDE_DRIVERS_SENSOR_CCS811_H_ */
APIs and macros for the Zephyr device model.
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.
Main header file for sensor driver API.
__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:111
uint16_t fw_boot_version
Definition ccs811.h:112
uint8_t mode
Definition ccs811.h:115
uint8_t hw_version
Definition ccs811.h:114
uint16_t fw_app_version
Definition ccs811.h:113
Information collected from the sensor on each fetch.
Definition ccs811.h:68
uint8_t error
Sensor error flags at completion of most recent fetch.
Definition ccs811.h:89
uint16_t co2
Equivalent carbon dioxide in parts-per-million volume (ppmv).
Definition ccs811.h:70
uint16_t raw
Raw voltage and current measured by sensor.
Definition ccs811.h:79
uint16_t voc
Equivalent total volatile organic compounds in parts-per-billion volume.
Definition ccs811.h:76
uint8_t status
Sensor status at completion of most recent fetch.
Definition ccs811.h:82
Runtime device structure (in ROM) per driver instance.
Definition device.h:543
Representation of a sensor readout value.
Definition sensor.h:56