sgp40reg.h revision 1.1 1 1.1 brad /* $NetBSD: sgp40reg.h,v 1.1 2021/10/14 13:54:46 brad Exp $ */
2 1.1 brad
3 1.1 brad /*
4 1.1 brad * Copyright (c) 2021 Brad Spencer <brad (at) anduin.eldar.org>
5 1.1 brad *
6 1.1 brad * Permission to use, copy, modify, and distribute this software for any
7 1.1 brad * purpose with or without fee is hereby granted, provided that the above
8 1.1 brad * copyright notice and this permission notice appear in all copies.
9 1.1 brad *
10 1.1 brad * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 1.1 brad * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 1.1 brad * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 1.1 brad * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 1.1 brad * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 1.1 brad * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 1.1 brad * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 1.1 brad */
18 1.1 brad
19 1.1 brad #ifndef _DEV_I2C_SGP40REG_H_
20 1.1 brad #define _DEV_I2C_SGP40REG_H_
21 1.1 brad
22 1.1 brad #define SGP40_TYPICAL_ADDR 0x59
23 1.1 brad
24 1.1 brad /* There are three documented commands for this chip, plus one that is called a
25 1.1 brad soft reset. But really the soft reset is a general reset of all devices on
26 1.1 brad the bus, hence it is not as usable as one would hope
27 1.1 brad */
28 1.1 brad
29 1.1 brad #define SGP40_MEASURE_RAW 0x260f
30 1.1 brad #define SGP40_MEASURE_TEST 0x280e
31 1.1 brad #define SGP40_HEATER_OFF 0x3615
32 1.1 brad /* The get serial number command is documented in version 1.1 of the
33 1.1 brad datasheet.
34 1.1 brad */
35 1.1 brad #define SGP40_GET_SERIAL_NUMBER 0x3682
36 1.1 brad /* The get featureset command is not documented in any datasheet that could
37 1.1 brad be found. However, it is present and used in a lot of example code.
38 1.1 brad It has no additional arguments aside from the command itself, and returns
39 1.1 brad a uint16_t for the data and a uint8_t for the crc.
40 1.1 brad */
41 1.1 brad #define SGP40_GET_FEATURESET 0x202f
42 1.1 brad
43 1.1 brad /* The results of a self test are documented as being either everything is ok, or
44 1.1 brad something failed.
45 1.1 brad */
46 1.1 brad
47 1.1 brad #define SGP40_TEST_RESULTS_ALL_PASSED 0xd400
48 1.1 brad #define SGP40_TEST_RESULTS_SOME_FAILED 0x4b00
49 1.1 brad
50 1.1 brad #endif
51