1094332d3Sopenharmony_ci/* 2094332d3Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 3094332d3Sopenharmony_ci * 4094332d3Sopenharmony_ci * HDF is dual licensed: you can use it either under the terms of 5094332d3Sopenharmony_ci * the GPL, or the BSD license, at your option. 6094332d3Sopenharmony_ci * See the LICENSE file in the root of this repository for complete details. 7094332d3Sopenharmony_ci */ 8094332d3Sopenharmony_ci 9094332d3Sopenharmony_ci#ifndef TEMPERATURE_SHT30_H 10094332d3Sopenharmony_ci#define TEMPERATURE_SHT30_H 11094332d3Sopenharmony_ci 12094332d3Sopenharmony_ci#include "sensor_config_parser.h" 13094332d3Sopenharmony_ci#include "sensor_temperature_driver.h" 14094332d3Sopenharmony_ci 15094332d3Sopenharmony_ci/* Temperature registers addr */ 16094332d3Sopenharmony_ci#define SHT30_TEMP_DATA_ADDR 0x240B // Temperature Data 17094332d3Sopenharmony_ci 18094332d3Sopenharmony_ci/* Temperature data */ 19094332d3Sopenharmony_ci#define SHT30_TEMP_DATA_BUF_LEN 6 20094332d3Sopenharmony_ci#define SHT30_TEMP_VALUE_IDX_ZERO 0 21094332d3Sopenharmony_ci#define SHT30_TEMP_VALUE_IDX_ONE 1 22094332d3Sopenharmony_ci#define SHT30_TEMP_VALUE_IDX_TWO 2 23094332d3Sopenharmony_ci#define SHT30_TEMP_VALUE_IDX_THREE 3 24094332d3Sopenharmony_ci#define SHT30_TEMP_VALUE_IDX_FOUR 4 25094332d3Sopenharmony_ci#define SHT30_TEMP_VALUE_IDX_FIVE 5 26094332d3Sopenharmony_ci 27094332d3Sopenharmony_ci#define SHT30_TEMP_CONSATNT (-450) // -45.0 * 10 28094332d3Sopenharmony_ci#define SHT30_TEMP_SLOPE 1750 // 175.0 * 10 29094332d3Sopenharmony_ci#define SHT30_TEMP_SHFIT_1_BIT 1 30094332d3Sopenharmony_ci 31094332d3Sopenharmony_ci/* Temperature crc8 */ 32094332d3Sopenharmony_ci#define SHT30_TEMP_CRC8_BASE 0xFF 33094332d3Sopenharmony_ci#define SHT30_TEMP_CRC8_MASK 0x80 34094332d3Sopenharmony_ci#define SHT30_TEMP_CRC8_POLYNOMIAL 0x31 35094332d3Sopenharmony_ci#define SHT30_TEMP_CRC8_LEN 2 36094332d3Sopenharmony_ci 37094332d3Sopenharmony_cistruct Sht30DrvData { 38094332d3Sopenharmony_ci struct IDeviceIoService ioService; 39094332d3Sopenharmony_ci struct HdfDeviceObject *device; 40094332d3Sopenharmony_ci struct SensorCfgData *sensorCfg; 41094332d3Sopenharmony_ci}; 42094332d3Sopenharmony_ci 43094332d3Sopenharmony_ci#endif /* TEMPERATURE_SHT30_H */ 44