Beispiel #1
0
/***********************************************************************
* PURPOSE: Initialize all required modules for camera measurement
*
* INPUTS:
* RETURNS:
***********************************************************************/
void InitCamera(void)
{
	line = &buffer0[0];
	
	init_GPIO(); // For CLK and SI output on GPIO
	init_FTM2(); // To generate CLK, SI, and trigger ADC
	init_ADC0();
	init_PIT();	// To trigger camera read based on integration time
}
Beispiel #2
0
uint8_t get_adc_sample(uint8_t ADC_val)
{
	switch (ADC_val){
		case 0 : init_ADC0();
		case 1 : init_ADC1();
		case 7 : init_ADC7();
		default : init_ADC0();
	}

	//start the conversion
	ADC_start_single_conversion();

	//wait for the ADC to finish
	while((ADCSRA & (1<<ADSC))){};
	
	//return the ADC result
	return ADCH; 
}