/* ADC Enable an External Trigger for Regular Channels. 
This enables an external trigger for set of defined regular channels, and sets the polarity of the trigger event: rising or falling edge or both. Note that if the trigger polarity is zero, triggering is disabled. */
void adc_enable_external_trigger_regular(uint32_t adc, uint32_t trigger, uint32_t polarity)
/* ADC Enable an External Trigger for Regular Channels. 
This enables an external trigger for set of defined regular channels, and sets the polarity of the trigger event: rising or falling edge or both. Note that if the trigger polarity is zero, triggering is disabled. */
void adc_enable_external_trigger_regular(uint32_t adc, uint32_t trigger, uint32_t polarity)
{
	uint32_t reg32 = ADC_CR2(adc);
	reg32 &= ~(ADC_CR2_EXTSEL_MASK | ADC_CR2_EXTEN_MASK);
	reg32 |= (trigger | polarity);
	ADC_CR2(adc) = reg32;
}