Merge pull request #2926 from arturo182/imx-temperature-fix

mimxrt10xx: Fix cpu.temperature crash
This commit is contained in:
Scott Shawcroft 2020-05-18 15:20:21 -07:00 committed by GitHub
commit ebfc1f2599
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,11 +37,13 @@ float common_hal_mcu_processor_get_temperature(void) {
tempmon_config_t config; tempmon_config_t config;
TEMPMON_GetDefaultConfig(&config); TEMPMON_GetDefaultConfig(&config);
OCOTP_Init(OCOTP, CLOCK_GetFreq(kCLOCK_IpgClk));
TEMPMON_Init(TEMPMON, &config); TEMPMON_Init(TEMPMON, &config);
TEMPMON_StartMeasure(TEMPMON); TEMPMON_StartMeasure(TEMPMON);
const float temp = TEMPMON_GetCurrentTemperature(TEMPMON); const float temp = TEMPMON_GetCurrentTemperature(TEMPMON);
TEMPMON_Deinit(TEMPMON); TEMPMON_Deinit(TEMPMON);
OCOTP_Deinit(OCOTP);
return temp; return temp;
} }