1 /* 2 * SPDX-FileCopyrightText: 2010-2021 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #pragma once 8 9 #include <stdint.h> 10 #include "esp_err.h" 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 typedef enum { 17 TSENS_DAC_L0 = 0, /*!< offset = -2, measure range: 50℃ ~ 125℃, error < 3℃. */ 18 TSENS_DAC_L1, /*!< offset = -1, measure range: 20℃ ~ 100℃, error < 2℃. */ 19 TSENS_DAC_L2, /*!< offset = 0, measure range:-10℃ ~ 80℃, error < 1℃. */ 20 TSENS_DAC_L3, /*!< offset = 1, measure range:-30℃ ~ 50℃, error < 2℃. */ 21 TSENS_DAC_L4, /*!< offset = 2, measure range:-40℃ ~ 20℃, error < 3℃. */ 22 TSENS_DAC_MAX, 23 TSENS_DAC_DEFAULT = TSENS_DAC_L2, 24 } temp_sensor_dac_offset_t; 25 26 27 /** 28 * @brief Configuration for temperature sensor reading 29 */ 30 typedef struct { 31 temp_sensor_dac_offset_t dac_offset; /*!< The temperature measurement range is configured with a built-in temperature offset DAC. */ 32 uint8_t clk_div; /*!< Default: 6 */ 33 } temp_sensor_config_t; 34 35 #define TSENS_CONFIG_DEFAULT() {.dac_offset = TSENS_DAC_L2, \ 36 .clk_div = 6} 37 38 #ifdef __cplusplus 39 } 40 #endif 41