mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-02 06:38:47 +00:00
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:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "hal/temperature_sensor_types.h"
|
||||
#include "hal/assert.h"
|
||||
#include "hal/misc.h"
|
||||
#include "hal/efuse_ll.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -151,6 +152,22 @@ static inline void temperature_sensor_ll_set_clk_div(uint8_t clk_div)
|
||||
HAL_FORCE_MODIFY_U32_REG_FIELD(APB_SARADC.apb_tsens_ctrl, tsens_clk_div, clk_div);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Retrieve and calculate the temperature sensor calibration value.
|
||||
*
|
||||
* @return Temperature calibration value.
|
||||
*/
|
||||
static inline int temperature_sensor_ll_load_calib_param(void)
|
||||
{
|
||||
if (efuse_ll_get_blk_version_major() == 0) {
|
||||
return 0;
|
||||
}
|
||||
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
|
||||
|
Reference in New Issue
Block a user