From c68723db3c299f9f77af79b4eda7ee1083004392 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Tue, 8 Sep 2020 15:13:48 +0530 Subject: [PATCH] Update Processor.c --- ports/esp32s2/common-hal/microcontroller/Processor.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/common-hal/microcontroller/Processor.c b/ports/esp32s2/common-hal/microcontroller/Processor.c index 39b85a18b8..0df3e9e92c 100644 --- a/ports/esp32s2/common-hal/microcontroller/Processor.c +++ b/ports/esp32s2/common-hal/microcontroller/Processor.c @@ -34,8 +34,15 @@ #include "soc/efuse_reg.h" +#include "esp-idf/components/driver/esp32s2/include/driver/temp_sensor.h" + float common_hal_mcu_processor_get_temperature(void) { - return NAN; + float tsens_out; + temp_sensor_config_t temp_sensor = TSENS_CONFIG_DEFAULT(); // DEFAULT: range:-10℃ ~ 80℃, error < 1℃. + temp_sensor_set_config(temp_sensor); + temp_sensor_start(); + temp_sensor_read_celsius(&tsens_out); + return tsens_out; } float common_hal_mcu_processor_get_voltage(void) {