diff --git a/cores/esp32/esp32-hal-misc.c b/cores/esp32/esp32-hal-misc.c index ea943b37..bf4ee06e 100644 --- a/cores/esp32/esp32-hal-misc.c +++ b/cores/esp32/esp32-hal-misc.c @@ -23,6 +23,15 @@ #include "esp_log.h" #include +//Undocumented!!! Get chip temperature in Farenheit +//Source: https://github.com/pcbreflux/espressif/blob/master/esp32/arduino/sketchbook/ESP32_int_temp_sensor/ESP32_int_temp_sensor.ino +uint8_t temprature_sens_read(); + +float temperatureRead() +{ + return (temprature_sens_read() - 32) / 1.8; +} + void yield() { vPortYield(); diff --git a/cores/esp32/esp32-hal.h b/cores/esp32/esp32-hal.h index f6a51427..d6e5ca8c 100644 --- a/cores/esp32/esp32-hal.h +++ b/cores/esp32/esp32-hal.h @@ -61,6 +61,9 @@ void yield(void); #include "esp32-hal-bt.h" #include "esp_system.h" +//returns chip temperature in Celsius +float temperatureRead(); + unsigned long micros(); unsigned long millis(); void delay(uint32_t);