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