Merge pull request #814 from zhitaoh/fix-nrf-zero-temp-read
fix temperature sensor reading in nrf52dk platform, which was stuck a…
This commit is contained in:
commit
e2c0964091
@ -64,7 +64,16 @@ static int
|
||||
value(int type)
|
||||
{
|
||||
#ifndef SOFTDEVICE_PRESENT
|
||||
return nrf_temp_read();
|
||||
int32_t volatile temp;
|
||||
|
||||
NRF_TEMP->TASKS_START = 1;
|
||||
/* 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;
|
||||
|
||||
return temp;
|
||||
#else
|
||||
int32_t temp;
|
||||
sd_temp_get(&temp);
|
||||
|
Loading…
Reference in New Issue
Block a user