Skip to content

Commit 66cf6c4

Browse files
authored
Merge pull request adafruit#3382 from microDev1/tempSense
Add esp32s2 internal temp sensor support
2 parents bbd8029 + 14af8e4 commit 66cf6c4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

ports/esp32s2/common-hal/microcontroller/Processor.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,16 @@
3434

3535
#include "soc/efuse_reg.h"
3636

37+
#include "esp-idf/components/driver/esp32s2/include/driver/temp_sensor.h"
38+
3739
float common_hal_mcu_processor_get_temperature(void) {
38-
return NAN;
40+
float tsens_out;
41+
temp_sensor_config_t temp_sensor = TSENS_CONFIG_DEFAULT(); // DEFAULT: range:-10℃ ~ 80℃, error < 1℃.
42+
temp_sensor_set_config(temp_sensor);
43+
temp_sensor_start();
44+
temp_sensor_read_celsius(&tsens_out);
45+
temp_sensor_stop();
46+
return tsens_out;
3947
}
4048

4149
float common_hal_mcu_processor_get_voltage(void) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy