/* Process function helper. Updates the ADC read register on the update timer interrupt. */
static int32_t cn0414_process_update_adc(struct cn0414_dev *dev)
/* Process function helper. Updates the ADC read register on the update timer interrupt. */
static int32_t cn0414_process_update_adc(struct cn0414_dev *dev)
{
	int32_t ret;
	NVIC_DisableIRQ(TMR0_INT);
	NVIC_DisableIRQ(HART_CD_INT);
	ret = cn0414_read_channel(dev, dev->channel_index);
	if(ret != CN0414_SUCCESS)
		goto finish;
	if(dev->channel_index == IIN4)
		dev->channel_index = VIN1;
	else
		dev->channel_index++;
	adc_channel_flag = 0;
	adc_sw_prescaler = 0;
finish:
	NVIC_EnableIRQ(TMR0_INT);
	NVIC_EnableIRQ(HART_CD_INT);
	return ret;
}