1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #ifndef TEMPERATURE_SHT30_H 10 #define TEMPERATURE_SHT30_H 11 12 #include "sensor_config_parser.h" 13 #include "sensor_temperature_driver.h" 14 15 /* Temperature registers addr */ 16 #define SHT30_TEMP_DATA_ADDR 0x240B // Temperature Data 17 18 /* Temperature data */ 19 #define SHT30_TEMP_DATA_BUF_LEN 6 20 #define SHT30_TEMP_VALUE_IDX_ZERO 0 21 #define SHT30_TEMP_VALUE_IDX_ONE 1 22 #define SHT30_TEMP_VALUE_IDX_TWO 2 23 #define SHT30_TEMP_VALUE_IDX_THREE 3 24 #define SHT30_TEMP_VALUE_IDX_FOUR 4 25 #define SHT30_TEMP_VALUE_IDX_FIVE 5 26 27 #define SHT30_TEMP_CONSATNT (-450) // -45.0 * 10 28 #define SHT30_TEMP_SLOPE 1750 // 175.0 * 10 29 #define SHT30_TEMP_SHFIT_1_BIT 1 30 31 /* Temperature crc8 */ 32 #define SHT30_TEMP_CRC8_BASE 0xFF 33 #define SHT30_TEMP_CRC8_MASK 0x80 34 #define SHT30_TEMP_CRC8_POLYNOMIAL 0x31 35 #define SHT30_TEMP_CRC8_LEN 2 36 37 struct Sht30DrvData { 38 struct IDeviceIoService ioService; 39 struct HdfDeviceObject *device; 40 struct SensorCfgData *sensorCfg; 41 }; 42 43 #endif /* TEMPERATURE_SHT30_H */ 44