mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-03 08:31:44 +01:00
Temperature_sensor: Create new temperature sensor API
This commit is contained in:
22
components/efuse/esp32s2/esp_efuse_rtc_calib.c
Normal file
22
components/efuse/esp32s2/esp_efuse_rtc_calib.c
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "esp_bit_defs.h"
|
||||
#include "esp_efuse.h"
|
||||
#include "esp_efuse_rtc_table.h"
|
||||
|
||||
esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal)
|
||||
{
|
||||
uint32_t version = esp_efuse_rtc_table_read_calib_version();
|
||||
if ((version != 1) && (version != 2)) {
|
||||
*tsens_cal = 0.0;
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
*tsens_cal = esp_efuse_rtc_table_get_parsed_efuse_value(RTCCALIB_IDX_TMPSENSOR, false);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
27
components/efuse/esp32s2/include/esp_efuse_rtc_calib.h
Normal file
27
components/efuse/esp32s2/include/esp_efuse_rtc_calib.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "esp_types.h"
|
||||
#include "esp_err.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the temperature sensor calibration number delta_T stored in the efuse.
|
||||
*
|
||||
* @param tsens_cal Pointer of 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.
|
||||
*/
|
||||
esp_err_t esp_efuse_rtc_calib_get_tsens_val(float* tsens_cal);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,4 +1,5 @@
|
||||
set(EFUSE_SOC_SRCS "esp_efuse_table.c"
|
||||
"esp_efuse_fields.c"
|
||||
"esp_efuse_rtc_table.c"
|
||||
"esp_efuse_rtc_calib.c"
|
||||
"esp_efuse_utility.c")
|
||||
|
||||
Reference in New Issue
Block a user