busy wait maximum 72 us (typically 36 us) for taking a measurement from the on-chip temperature sensor

This commit is contained in:
Zhitao He 2019-01-10 18:56:27 +01:00
parent f5a258c6a6
commit d0a0a2a568
1 changed files with 2 additions and 1 deletions

View File

@ -67,7 +67,8 @@ value(int type)
int32_t volatile temp;
NRF_TEMP->TASKS_START = 1;
while(NRF_TEMP->EVENTS_DATARDY == 0);
/* nRF52832 datasheet: one temperature measurement takes typically 36 us */
RTIMER_BUSYWAIT_UNTIL(NRF_TEMP->EVENTS_DATARDY, RTIMER_SECOND * 72 / 1000000);
NRF_TEMP->EVENTS_DATARDY = 0;
temp = nrf_temp_read();
NRF_TEMP->TASKS_STOP = 1;