1 /*
2  * Copyright (c) 2019 Centaur Analytics, Inc
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_DRIVERS_SENSOR_TMP116_TMP116_H_
8 #define ZEPHYR_DRIVERS_SENSOR_TMP116_TMP116_H_
9 
10 #define TMP116_REG_TEMP		0x0
11 #define TMP116_REG_CFGR		0x1
12 #define TMP116_REG_HIGH_LIM		0x2
13 #define TMP116_REG_LOW_LIM		0x3
14 #define TMP116_REG_EEPROM_UL		0x4
15 #define TMP116_REG_EEPROM1		0x5
16 #define TMP116_REG_EEPROM2		0x6
17 #define TMP116_REG_EEPROM3		0x7
18 #define TMP117_REG_TEMP_OFFSET		0x7
19 #define TMP116_REG_EEPROM4		0x8
20 #define TMP116_REG_DEVICE_ID		0xF
21 
22 #define TMP116_RESOLUTION		78125       /* in tens of uCelsius*/
23 #define TMP116_RESOLUTION_DIV		10000000
24 
25 #define TMP116_DEVICE_ID		0x1116
26 #define TMP117_DEVICE_ID		0x0117
27 
28 #define TMP116_CFGR_AVG			(BIT(5) | BIT(6))
29 #define TMP116_CFGR_DATA_READY  BIT(13)
30 #define TMP116_EEPROM_UL_UNLOCK BIT(15)
31 #define TMP116_EEPROM_UL_BUSY   BIT(14)
32 
33 #define TMP116_AVG_1_SAMPLE		0
34 #define TMP116_AVG_8_SAMPLES	BIT(5)
35 #define TMP116_AVG_32_SAMPLES	BIT(6)
36 #define TMP116_AVG_64_SAMPLES	(BIT(5) | BIT(6))
37 
38 struct tmp116_data {
39 	uint16_t sample;
40 	uint16_t id;
41 };
42 
43 struct tmp116_dev_config {
44 	struct i2c_dt_spec bus;
45 };
46 
47 #endif /*  ZEPHYR_DRIVERS_SENSOR_TMP116_TMP116_H_ */
48