Makes sense! I searched other drivers for where they called the detach but didn't think to see where those other drivers called the attach!
Thanks :) >-----Original Message----- >From: Michal Lenc <michall...@seznam.cz> >Subject: Re: ADC device close and IRQ > >Hi, > >> The easy option is to comment out the two calls, but I don't know if that' >s >> deemed acceptable, especially as other adc drivers do the same? > > >I do not think this is correct since it is better to disable and detach the >interrupt > >when we close the device. > > >Instead I think the the enabling and attaching should be moved >from sam_adc_ >initialize() > >to sam_adc_setup() which is called every time the driver is opened from the >application. > >Similar to SAMv7 ADC driver: > >https://github.com/apache/incubator- >nuttx/blob/master/arch/arm/src/samv7/sam >_afec.c#L845 > > > > > >This would ensure the interrupt is enabled and attached when the driver is >opened > > >and disabled and detached when it is closed. > > > > >Best regards, > >Michal Lenc