temperature_sensor: Add temperature sensor support for ESP32-C2

This commit is contained in:
Cao Sen Miao
2022-06-14 14:50:35 +08:00
parent 7d68098089
commit 3a820462ac
38 changed files with 388 additions and 113 deletions

View File

@@ -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}")

View File

@@ -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

View File

@@ -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");

View File

@@ -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;

View File

@@ -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

View 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},
};