/* Initialises an ADC interface, Prepares an ADC hardware interface for sampling */
int32_t hal_adc_init(adc_dev_t *adc)
/* Initialises an ADC interface, Prepares an ADC hardware interface for sampling */
int32_t hal_adc_init(adc_dev_t *adc)
{
	if (adc->config.sampling_cycle) {
		hal_gpadc_open(__hal_adc_port2chan(adc->port), HAL_GPADC_ATP_NULL, NULL);
	} else {
		hal_gpadc_open(__hal_adc_port2chan(adc->port), HAL_GPADC_ATP_ONESHOT, __hal_adc_irqhandler);
	}
	return 0;
}