Merge branch 'refactor/abstract_temperature_sensor' into 'master'

temperature_sensor: Refactor temperature sensor to new APIs (follow rule of driverNG) and support esp32s3

Closes IDF-3665, IDF-3367, and IDF-1793

See merge request espressif/esp-idf!16787
This commit is contained in:
Simon
2022-03-07 20:17:39 +08:00
69 changed files with 1714 additions and 975 deletions
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -73,9 +73,13 @@ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, int atten, uint32_t*
return ESP_OK;
}
float esp_efuse_rtc_calib_get_cal_temp(int version)
esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal)
{
assert(version == 1);
uint32_t version = esp_efuse_rtc_calib_get_ver();
if (version != 1) {
*tsens_cal = 0.0;
return ESP_ERR_NOT_SUPPORTED;
}
const esp_efuse_desc_t** cal_temp_efuse;
cal_temp_efuse = ESP_EFUSE_TEMP_CALIB;
int cal_temp_size = esp_efuse_get_field_size(cal_temp_efuse);
@@ -86,5 +90,6 @@ float esp_efuse_rtc_calib_get_cal_temp(int version)
assert(err == ESP_OK);
(void)err;
// BIT(8) stands for sign: 1: negtive, 0: positive
return ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp;
*tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp;
return ESP_OK;
}
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -47,11 +47,12 @@ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, int atten, uint32_t*
/**
* @brief Get the temperature sensor calibration number delta_T stored in the efuse.
*
* @param version Version of the stored efuse
* @param tsens_cal Pointer of the specification of temperature sensor calibration number in efuse.
*
* @return The specification of temperature sensor calibration number in efuse.
* @return ESP_OK if get the calibration value successfully.
* ESP_ERR_INVALID_ARG if can't get the calibration value.
*/
float esp_efuse_rtc_calib_get_cal_temp(int version);
esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal);
#ifdef __cplusplus
}