1 /*
2  * Copyright (c) 2021, Leonard Pollak
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /**
8  * @file
9  * @brief Extended public API for Sensirion's SHT4X T/RH sensors
10  *
11  * This exposes an API to the on-chip heater which is specific to
12  * the application/environment and cannot be expressed within the
13  * sensor driver abstraction.
14  */
15 
16 #ifndef ZEPHYR_INCLUDE_DRIVERS_SENSOR_SHT4X_H_
17 #define ZEPHYR_INCLUDE_DRIVERS_SENSOR_SHT4X_H_
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #include <zephyr/drivers/sensor.h>
24 
25 /* Maximum temperature above which the heater should not be used */
26 #define SHT4X_HEATER_MAX_TEMP 65
27 
28 enum sensor_attribute_sht4x {
29 	/* Heater Power: 0, 1, 2 -> high, med, low */
30 	SENSOR_ATTR_SHT4X_HEATER_POWER = SENSOR_ATTR_PRIV_START,
31 	/* Heater Duration: 0, 1 -> long, short */
32 	SENSOR_ATTR_SHT4X_HEATER_DURATION
33 };
34 
35 /**
36  * @brief Fetches data using the on-chip heater.
37  *
38  * Measurement is always done with "high" repeatability.
39  *
40  * @param dev Pointer to the sensor device
41  *
42  * @return 0 if successful, negative errno code if failure.
43  */
44 int sht4x_fetch_with_heater(const struct device *dev);
45 
46 #ifdef __cplusplus
47 }
48 #endif
49 
50 #endif /* ZEPHYR_INCLUDE_DRIVERS_SENSOR_SHT4X_H_ */
51