Add api to get CPU temperature

Fixes: https://github.com/espressif/arduino-esp32/issues/563
Fixes: https://github.com/espressif/arduino-esp32/issues/625
Source:
https://github.com/pcbreflux/espressif/blob/master/esp32/arduino/sketchb
ook/ESP32_int_temp_sensor/ESP32_int_temp_sensor.ino
This commit is contained in:
me-no-dev 2017-09-18 17:47:06 +08:00
parent ab0ea2f6da
commit db79c2ee95
2 changed files with 12 additions and 0 deletions

View File

@ -23,6 +23,15 @@
#include "esp_log.h" #include "esp_log.h"
#include <sys/time.h> #include <sys/time.h>
//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() void yield()
{ {
vPortYield(); vPortYield();

View File

@ -61,6 +61,9 @@ void yield(void);
#include "esp32-hal-bt.h" #include "esp32-hal-bt.h"
#include "esp_system.h" #include "esp_system.h"
//returns chip temperature in Celsius
float temperatureRead();
unsigned long micros(); unsigned long micros();
unsigned long millis(); unsigned long millis();
void delay(uint32_t); void delay(uint32_t);