Project

General

Profile

Revision 1692

creating an instance of the hunter prey demo

View differences:

analog.c
94 94
	// Bit 5 - Enable Auto Trigger (for free running mode) NOT DOING THIS RIGHT NOW
95 95
	// Bit 4 - ADC interrupt flag, 0
96 96
	// Bit 3 - Enable ADC Interrupt (required to run free-running mode)
97
	// Bits 2-0 - Set to create a clock divisor of 128, to make ADC clock = 8,000,000/64 = 125kHz
97
	// Bits 2-0 - Set to create a clock divisor of 128, to make ADC clock = 8,000,000/64 = 125kHz EDIT: changed to 8MHz
98 98
	ADCSRA = 0;
99
	ADCSRA |= _BV(ADEN) | _BV(ADPS2) | _BV(ADPS1) | _BV(ADPS0);
99
	ADCSRA |= _BV(ADEN) | _BV(ADPS0);
100 100
	
101 101
	// Set external mux lines to outputs
102 102
	DDRG |= 0x1C;
......
106 106
	adc_current_port = AN1;
107 107

  
108 108
	//Start the conversion loop if requested
109
	if (start_conversion)
110
		analog_start_loop();
109
	//if (start_conversion)
110
		//analog_start_loop();
111 111
		
112 112
	//Conversion loop disabled by default
113 113
}	
......
296 296
 * @see analog_init
297 297
 **/
298 298
int wheel(void) {
299
	return analog8(WHEEL_PORT);
299
	return analog_get8(WHEEL_PORT);
300 300
}
301 301

  
302 302

  
......
323 323

  
324 324

  
325 325
ISR(ADC_vect) {
326
	int adc_h = 0;
326
	/*int adc_h = 0;
327 327
	int adc_l = 0;
328 328
	
329 329
	if(adc_loop_status != ADC_LOOP_RUNNING) return;
......
366 366
	}
367 367
	
368 368
	//Start next conversion
369
	ADCSRA |= _BV(ADSC);
369
	ADCSRA |= _BV(ADSC);*/
370 370
}
371 371

  

Also available in: Unified diff