Zephyr API
4.4.99
A Scalable Open Source RTOS
Toggle main menu visibility
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
14
15
#ifndef ZEPHYR_INCLUDE_DRIVERS_SENSOR_CCS811_H_
16
#define ZEPHYR_INCLUDE_DRIVERS_SENSOR_CCS811_H_
17
18
#ifdef __cplusplus
19
extern
"C"
{
20
#endif
21
22
#include <
zephyr/device.h
>
23
#include <
zephyr/drivers/sensor.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
48
struct
ccs811_result_type
{
50
uint16_t
co2
;
51
56
uint16_t
voc
;
57
59
uint16_t
raw
;
60
62
uint8_t
status
;
63
69
uint8_t
error
;
70
};
71
83
const
struct
ccs811_result_type
*
ccs811_result
(
const
struct
device
*dev);
84
91
struct
ccs811_configver_type
{
92
uint16_t
fw_boot_version
;
93
uint16_t
fw_app_version
;
94
uint8_t
hw_version
;
95
uint8_t
mode
;
96
};
97
107
int
ccs811_configver_fetch
(
const
struct
device
*dev,
108
struct
ccs811_configver_type
*ptr);
109
124
int
ccs811_baseline_fetch
(
const
struct
device
*dev);
125
138
int
ccs811_baseline_update
(
const
struct
device
*dev,
uint16_t
baseline);
139
154
int
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_ */
ccs811_baseline_fetch
int ccs811_baseline_fetch(const struct device *dev)
Fetch the current value of the BASELINE register.
ccs811_configver_fetch
int ccs811_configver_fetch(const struct device *dev, struct ccs811_configver_type *ptr)
Fetch operating mode and version information.
ccs811_result
const struct ccs811_result_type * ccs811_result(const struct device *dev)
Access storage for the most recent data read from the sensor.
ccs811_envdata_update
int ccs811_envdata_update(const struct device *dev, const struct sensor_value *temperature, const struct sensor_value *humidity)
Update the ENV_DATA register.
ccs811_baseline_update
int ccs811_baseline_update(const struct device *dev, uint16_t baseline)
Update the BASELINE register.
device.h
sensor.h
Main header file for sensor driver API.
uint8_t
__UINT8_TYPE__ uint8_t
Definition
stdint.h:88
uint16_t
__UINT16_TYPE__ uint16_t
Definition
stdint.h:89
ccs811_configver_type
Get information about static CCS811 state.
Definition
ccs811.h:91
ccs811_configver_type::fw_boot_version
uint16_t fw_boot_version
Definition
ccs811.h:92
ccs811_configver_type::mode
uint8_t mode
Definition
ccs811.h:95
ccs811_configver_type::hw_version
uint8_t hw_version
Definition
ccs811.h:94
ccs811_configver_type::fw_app_version
uint16_t fw_app_version
Definition
ccs811.h:93
ccs811_result_type
Information collected from the sensor on each fetch.
Definition
ccs811.h:48
ccs811_result_type::error
uint8_t error
Sensor error flags at completion of most recent fetch.
Definition
ccs811.h:69
ccs811_result_type::co2
uint16_t co2
Equivalent carbon dioxide in parts-per-million volume (ppmv).
Definition
ccs811.h:50
ccs811_result_type::raw
uint16_t raw
Raw voltage and current measured by sensor.
Definition
ccs811.h:59
ccs811_result_type::voc
uint16_t voc
Equivalent total volatile organic compounds in parts-per-billion volume.
Definition
ccs811.h:56
ccs811_result_type::status
uint8_t status
Sensor status at completion of most recent fetch.
Definition
ccs811.h:62
device
Runtime device structure (in ROM) per driver instance.
Definition
device.h:513
sensor_value
Representation of a sensor readout value.
Definition
sensor.h:55
zephyr
drivers
sensor
ccs811.h
Generated on
for Zephyr API by
1.17.0