mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-18 18:40:13 +00:00
temperature_sensor: Add temperature sensor support for ESP32-C2
This commit is contained in:
@@ -8,6 +8,7 @@ set(srcs
|
||||
"ledc_periph.c"
|
||||
"i2c_periph.c"
|
||||
"uart_periph.c"
|
||||
"temperature_sensor_periph.c"
|
||||
"timer_periph.c")
|
||||
|
||||
add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}")
|
||||
|
||||
@@ -43,6 +43,10 @@ config SOC_EFUSE_CONSISTS_OF_ONE_KEY_BLOCK
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_TEMP_SENSOR_SUPPORTED
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_SHA_SUPPORTED
|
||||
bool
|
||||
default y
|
||||
|
||||
@@ -684,6 +684,7 @@ typedef struct {
|
||||
volatile apb_saradc_apb_ctrl_date_reg_t saradc_apb_ctrl_date;
|
||||
} apb_dev_t;
|
||||
|
||||
extern apb_dev_t APB_SARADC;
|
||||
|
||||
#ifndef __cplusplus
|
||||
_Static_assert(sizeof(apb_dev_t) == 0x400, "Invalid size of apb_dev_t structure");
|
||||
|
||||
@@ -32,6 +32,7 @@ typedef enum {
|
||||
PERIPH_GDMA_MODULE,
|
||||
PERIPH_SYSTIMER_MODULE,
|
||||
PERIPH_SARADC_MODULE,
|
||||
PERIPH_TEMPSENSOR_MODULE,
|
||||
PERIPH_MODEM_RPA_MODULE,
|
||||
PERIPH_MODULE_MAX
|
||||
} periph_module_t;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#define SOC_SUPPORTS_SECURE_DL_MODE 1
|
||||
#define SOC_EFUSE_KEY_PURPOSE_FIELD 0
|
||||
#define SOC_EFUSE_CONSISTS_OF_ONE_KEY_BLOCK 1
|
||||
|
||||
#define SOC_TEMP_SENSOR_SUPPORTED 1
|
||||
#define SOC_SHA_SUPPORTED 1
|
||||
#define SOC_ECC_SUPPORTED 1
|
||||
#define SOC_FLASH_ENC_SUPPORTED 1
|
||||
|
||||
16
components/soc/esp32c2/temperature_sensor_periph.c
Normal file
16
components/soc/esp32c2/temperature_sensor_periph.c
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "soc/temperature_sensor_periph.h"
|
||||
|
||||
const temperature_sensor_attribute_t temperature_sensor_attributes[TEMPERATURE_SENSOR_ATTR_RANGE_NUM] = {
|
||||
/*Offset reg_val min max error */
|
||||
{-2, 5, 50, 125, 3},
|
||||
{-1, 7, 20, 100, 2},
|
||||
{ 0, 15, -10, 80, 1},
|
||||
{ 1, 11, -30, 50, 2},
|
||||
{ 2, 10, -40, 20, 3},
|
||||
};
|
||||
Reference in New Issue
Block a user