/* ADC Set the Sample Time for All Channels. 
The sampling time can be selected in ADC clock cycles from 1.5 to 239.5, same for all channels. */
void adc_set_sample_time_on_all_channels(uint32_t adc, uint8_t time)
/* ADC Set the Sample Time for All Channels. 
The sampling time can be selected in ADC clock cycles from 1.5 to 239.5, same for all channels. */
void adc_set_sample_time_on_all_channels(uint32_t adc, uint8_t time)
{
	uint8_t i;
	uint32_t reg32 = 0;
	for (i = 0; i <= 9; i++) {
		reg32 |= (time << (i * 3));
	}
	ADC_SMPR2(adc) = reg32;
	for (i = 10; i <= 17; i++) {
		reg32 |= (time << ((i - 10) * 3));
	}
	ADC_SMPR1(adc) = reg32;
}