firmware/greatfet_usb/rhododendron/configuration.c
static uint32_t read_vdd18_voltage(void)
{
	const uint32_t vcc_mv = 3300;

	uint16_t sample;

	// Read from ADC 0_0.
	set_up_onboard_adc(0, 1 << 0, 10);

	// Start a conversion, and then wait for it to complete.
	ADC0_CR |= ADC_CR_START(1);
	while(!(ADC0_DR0 & ADC_DR_DONE));

	// Read the ADC value, and send it
	sample = (ADC0_DR0 >> 6) & 0x3ff;

	return (sample * vcc_mv) / 1024;
}
/**
 * Diagnostic functionality for reading the voltage of VDD18 on Rhododendrons with it brought to ADC0_0.
 *

 */
Diagnostic functionality for reading the voltage of VDD18 on Rhododendrons with it brought to ADC0_0.
Diagnostic functionality for reading the voltage of VDD18 on Rhododendrons with it brought to ADC0_0 .
static uint32_t read_vdd18_voltage(void)
{
	const uint32_t vcc_mv = 3300;
	uint16_t sample;
	set_up_onboard_adc(0, 1 << 0, 10);
	ADC0_CR |= ADC_CR_START(1);
	while(!(ADC0_DR0 & ADC_DR_DONE));
	sample = (ADC0_DR0 >> 6) & 0x3ff;
	return (sample * vcc_mv) / 1024;
}
static uint32_t read_vdd18_voltage ( void ) { const uint32_t vcc_mv = 3300 ; uint16_t sample ; set_up_onboard_adc ( 0 , 1 << 0 , 10 ) ; ADC0_CR |= ADC_CR_START ( 1 ) ; while ( ! ( ADC0_DR0 & ADC_DR_DONE ) ) ; sample = ( ADC0_DR0 >> 6 ) & 0x3ff ; return ( sample * vcc_mv ) / 1024 ; }
Diagnostic functionality for reading the voltage of VDD18 on Rhododendrons with it brought to ADC0_0.
Diagnostic functionality for reading the voltage of VDD18 on Rhododendrons with it brought to ADC0_0 .
// Read from ADC 0_0. // Start a conversion, and then wait for it to complete. // Read the ADC value, and send it