Hello,
I am working with S110 stack and the custom application. I wanted to use the ADC driver with blocking and interrupts enabled. But the application is blocking and it blocked the ISR thereby I am not getting ADC interrupt too. This is the configuration snippet:
void adc_init(void)
{
NRF_ADC->CONFIG = (ADC_CONFIG_EXTREFSEL_None << ADC_CONFIG_EXTREFSEL_Pos) |
(ADC_CONFIG_PSEL_AnalogInput3 << ADC_CONFIG_PSEL_Pos) |
(ADC_CONFIG_REFSEL_VBG << ADC_CONFIG_REFSEL_Pos) |
(ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling << ADC_CONFIG_INPSEL_Pos) |
(ADC_CONFIG_RES_10bit << ADC_CONFIG_RES_Pos);
NRF_ADC->ENABLE = ADC_ENABLE_ENABLE_Enabled;
NRF_ADC->INTENSET = ADC_INTENSET_END_Msk;
NVIC_SetPriority(ADC_IRQn, NRF_APP_PRIORITY_LOW);
NVIC_EnableIRQ(ADC_IRQn);
}
Blocking function is:
Conv_Completed = false;
NRF_ADC->TASKS_START = 1;
while(Conv_Completed == false);
ADC ISR is:
void ADC_IRQHandler(void)
{
uint32_t ADC_result;
NRF_ADC->EVENTS_END = 0;
NRF_ADC->TASKS_STOP = 1;
ADC_result = NRF_ADC->RESULT;
NRF_ADC->ENABLE = ADC_ENABLE_ENABLE_Disabled;
Conv_Completed = true;
}
Can any one tell hoe to use blocking code ? I am not interested in using Scheduler since it will block the application events until the scheduler tasks are complete.
Regards,
Sowmya