Merge pull request #1402 from GymTrack/fix_nrf_analogin

Fix analogin checking the wrong flag for completion
pull/1411/head
Martin Kojtal 2015-11-05 08:47:59 +00:00
commit c7fe39e4bc
1 changed files with 3 additions and 1 deletions

View File

@ -65,8 +65,10 @@ uint16_t analogin_read_u16(analogin_t *obj)
{
NRF_ADC->CONFIG &= ~ADC_CONFIG_PSEL_Msk;
NRF_ADC->CONFIG |= obj->adc_pin << ADC_CONFIG_PSEL_Pos;
NRF_ADC->EVENTS_END = 0;
NRF_ADC->TASKS_START = 1;
while (((NRF_ADC->BUSY & ADC_BUSY_BUSY_Msk) >> ADC_BUSY_BUSY_Pos) == ADC_BUSY_BUSY_Busy) {
while (!NRF_ADC->EVENTS_END) {
}
return (uint16_t)NRF_ADC->RESULT; // 10 bit