Merge pull request #3382 from microDev1/tempSense

Add esp32s2 internal temp sensor support
This commit is contained in:
hierophect 2020-09-09 12:05:10 -04:00 committed by GitHub
commit 66cf6c46c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -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) {