Skip to content

Commit

Permalink
Merge pull request #3382 from microDev1/tempSense
Browse files Browse the repository at this point in the history
Add esp32s2 internal temp sensor support
  • Loading branch information
hierophect authored Sep 9, 2020
2 parents bbd8029 + 14af8e4 commit 66cf6c4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ports/esp32s2/common-hal/microcontroller/Processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,16 @@

#include "soc/efuse_reg.h"

#include "esp-idf/components/driver/esp32s2/include/driver/temp_sensor.h"

float common_hal_mcu_processor_get_temperature(void) {
return NAN;
float tsens_out;
temp_sensor_config_t temp_sensor = TSENS_CONFIG_DEFAULT(); // DEFAULT: range:-10℃ ~ 80℃, error < 1℃.
temp_sensor_set_config(temp_sensor);
temp_sensor_start();
temp_sensor_read_celsius(&tsens_out);
temp_sensor_stop();
return tsens_out;
}

float common_hal_mcu_processor_get_voltage(void) {
Expand Down

0 comments on commit 66cf6c4

Please sign in to comment.