void platform_adc_stop( unsigned id ) { elua_adc_ch_state *s = adc_get_ch_state( id ); elua_adc_dev_state *d = adc_get_dev_state( 0 ); s->op_pending = 0; INACTIVATE_CHANNEL( d, id ); AD1CSSLCLR = (1 << id); AD1PCFGSET = (1 << id); // If there are no more active channels, stop the sequencer if( d->ch_active == 0 ) d->running = 0; }
void platform_adc_stop( unsigned id ) { elua_adc_ch_state *s = adc_get_ch_state( id ); elua_adc_dev_state *d = adc_get_dev_state( 0 ); s->op_pending = 0; INACTIVATE_CHANNEL( d, id ); // If there are no more active channels, stop the sequencer if( d->ch_active == 0 && d->running == 1 ) { d->running = 0; AD0CR &= 0xF8FFFF00; // stop ADC, disable channels } }
void platform_adc_stop( unsigned id ) { elua_adc_ch_state *s = adc_get_ch_state( id ); elua_adc_dev_state *d = adc_get_dev_state( 0 ); s->op_pending = 0; INACTIVATE_CHANNEL( d, id ); // If there are no more active channels, stop the sequencer if( d->ch_active == 0 && d->running == 1 ) { d->running = 0; NVIC_DisableIRQ( ADC_IRQn ); } }