Skip to content

Commit db79c2e

Browse files
committed
Add api to get CPU temperature
Fixes: espressif#563 Fixes: espressif#625 Source: https://github.com/pcbreflux/espressif/blob/master/esp32/arduino/sketchb ook/ESP32_int_temp_sensor/ESP32_int_temp_sensor.ino
1 parent ab0ea2f commit db79c2e

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

cores/esp32/esp32-hal-misc.c

+9
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@
2323
#include "esp_log.h"
2424
#include <sys/time.h>
2525

26+
//Undocumented!!! Get chip temperature in Farenheit
27+
//Source: https://github.com/pcbreflux/espressif/blob/master/esp32/arduino/sketchbook/ESP32_int_temp_sensor/ESP32_int_temp_sensor.ino
28+
uint8_t temprature_sens_read();
29+
30+
float temperatureRead()
31+
{
32+
return (temprature_sens_read() - 32) / 1.8;
33+
}
34+
2635
void yield()
2736
{
2837
vPortYield();

cores/esp32/esp32-hal.h

+3
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ void yield(void);
6161
#include "esp32-hal-bt.h"
6262
#include "esp_system.h"
6363

64+
//returns chip temperature in Celsius
65+
float temperatureRead();
66+
6467
unsigned long micros();
6568
unsigned long millis();
6669
void delay(uint32_t);

0 commit comments

Comments
 (0)