Dear reading IOTlers,
while trying to use some non-basic ADC features on the SAMD21 I realized that the adc_sample()
function of the periph/adc
driver of the sam0_common
implementation disable all interrupts:
Cheers Oleg
Dear reading IOTlers,
while trying to use some non-basic ADC features on the SAMD21 I realized that the adc_sample()
function of the periph/adc
driver of the sam0_common
implementation disable all interrupts:
Cheers Oleg
Well, if nothing is handling the interrupt, it needs to be disabled. Or what would you expect to happen if the ADC fires an ISR e.g., for the sampling-done event?
@maribu proposed a new ADC API that will also allow for conversions in the background.
Unfortunately it seems like nobody has time to look into that right now.
The current ADC API is indeed quite limited.
I think I found the reason in the mean time: interrupts must be disabled when polling for the result.
However, it is suboptimal to have this kind of side effect.
@kaspar, of course, interrupts should be disabled without a ISR defined, but this should be asserted during CPU initialization not in an API function.
Actually this line should not be necessary at all. As long as the ADC interrupt is no enabled in NVIC, setting which bits on the ADC may trigger such an interrupt should not be necessary.