File tree 1 file changed +15
-0
lines changed
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 40
40
#include "esp32/rom/rtc.h"
41
41
#elif CONFIG_IDF_TARGET_ESP32S2
42
42
#include "esp32s2/rom/rtc.h"
43
+ #include "driver/temp_sensor.h"
43
44
#elif CONFIG_IDF_TARGET_ESP32C3
44
45
#include "esp32c3/rom/rtc.h"
46
+ #include "driver/temp_sensor.h"
45
47
#else
46
48
#error Target CONFIG_IDF_TARGET is not supported
47
49
#endif
51
53
52
54
//Undocumented!!! Get chip temperature in Farenheit
53
55
//Source: https://github.com/pcbreflux/espressif/blob/master/esp32/arduino/sketchbook/ESP32_int_temp_sensor/ESP32_int_temp_sensor.ino
56
+ #ifdef CONFIG_IDF_TARGET_ESP32
54
57
uint8_t temprature_sens_read ();
55
58
56
59
float temperatureRead ()
57
60
{
58
61
return (temprature_sens_read () - 32 ) / 1.8 ;
59
62
}
63
+ #else
64
+ float temperatureRead ()
65
+ {
66
+ float result = NAN ;
67
+ temp_sensor_config_t tsens = TSENS_CONFIG_DEFAULT ();
68
+ temp_sensor_set_config (tsens );
69
+ temp_sensor_start ();
70
+ temp_sensor_read_celsius (& result );
71
+ temp_sensor_stop ();
72
+ return result ;
73
+ }
74
+ #endif
60
75
61
76
void __yield ()
62
77
{
You can’t perform that action at this time.
0 commit comments