Merge branch 'refactor/remove_tsens_legacy' into 'master'

refactor(temperature_sensor): Remove legacy temperature sensor driver

Closes IDF-12570 and IDF-13366

See merge request espressif/esp-idf!39840
This commit is contained in:
C.S.M
2025-06-16 16:09:40 +08:00
50 changed files with 192 additions and 809 deletions

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -29,6 +29,7 @@
#include "hal/temperature_sensor_types.h"
#include "hal/assert.h"
#include "hal/misc.h"
#include "hal/efuse_ll.h"
#ifdef __cplusplus
extern "C" {
@@ -266,6 +267,19 @@ static inline void temperature_sensor_ll_set_sample_rate(uint16_t rate)
HAL_FORCE_MODIFY_U32_REG_FIELD(APB_SARADC.tsens_sample, saradc_tsens_sample_rate, rate);
}
/**
* @brief Retrieve and calculate the temperature sensor calibration value.
*
* @return Temperature calibration value.
*/
static inline int temperature_sensor_ll_load_calib_param(void)
{
uint32_t cal_temp = EFUSE.rd_sys_part1_data4.temp_calib;
// BIT(8) stands for sign: 1: negative, 0: positive
int tsens_cal = ((cal_temp & BIT(8)) != 0)? -(uint8_t)cal_temp: (uint8_t)cal_temp;
return tsens_cal;
}
#ifdef __cplusplus
}
#endif