mimxrt10xx: Fix cpu.temperature crash

Fixes #2514
This commit is contained in:
arturo182 2020-05-18 22:29:31 +02:00
parent 2314f988b1
commit 058a73128c
1 changed files with 2 additions and 0 deletions

View File

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