drivers: sensor: SHT4X Added support
This adds support for Sensirion's SHT4X temperature and humidity sensor. Signed-off-by: Leonard Pollak <leonardp@tr-host.de>
This commit is contained in:
parent
0d7cb32c58
commit
2d0fd2554a
10 changed files with 400 additions and 0 deletions
50
include/drivers/sensor/sht4x.h
Normal file
50
include/drivers/sensor/sht4x.h
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Leonard Pollak
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Extended public API for Sensirion's SHT4X T/RH sensors
|
||||
*
|
||||
* This exposes an API to the on-chip heater which is specific to
|
||||
* the application/environment and cannot be expressed within the
|
||||
* sensor driver abstraction.
|
||||
*/
|
||||
|
||||
#ifndef ZEPHYR_INCLUDE_DRIVERS_SENSOR_SHT4X_H_
|
||||
#define ZEPHYR_INCLUDE_DRIVERS_SENSOR_SHT4X_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <drivers/sensor.h>
|
||||
|
||||
/* Maximum teperature above which the heater should not be used */
|
||||
#define SHT4X_HEATER_MAX_TEMP 65
|
||||
|
||||
enum sensor_attribute_sht4x {
|
||||
/* Heater Power: 0, 1, 2 -> high, med, low */
|
||||
SENSOR_ATTR_SHT4X_HEATER_POWER = SENSOR_ATTR_PRIV_START,
|
||||
/* Heater Duration: 0, 1 -> long, short */
|
||||
SENSOR_ATTR_SHT4X_HEATER_DURATION
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Fetches data using the on-chip heater.
|
||||
*
|
||||
* Measurement is always done with "high" repeatability.
|
||||
*
|
||||
* @param dev Pointer to the sensor device
|
||||
*
|
||||
* @return 0 if successful, negative errno code if failure.
|
||||
*/
|
||||
int sht4x_fetch_with_heater(const struct device *dev);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ZEPHYR_INCLUDE_DRIVERS_SENSOR_SHT4X_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue