7
#include <avr/interrupt.h>
10
#include "touchscreen.h"
11
#include "adc_sampling.h"
16
volatile unsigned char adcCurrChan=0;
17
volatile unsigned char adc_delay=0;
19
////////////////////////////////////////////////
20
//This is our 128uS time base from timer 0
22
////////////////////////////////////////////////
23
SIGNAL (SIG_OVERFLOW0) //every 128us
27
if (adc_delay == ADC_DELAY_MAX)
30
adc_delay = 0; //reset the counter
31
adcCurrChan++; //next channel
32
if (adcCurrChan == ADC_TOTAL_CHANNELS)
33
adcCurrChan = 0; //loop back around to the first channel
40
touchscreen_setup_x();
41
SETBIT(ADCSRA,ADSC); //start conversion!
48
touchscreen_setup_y();
49
SETBIT(ADCSRA,ADSC); //start conversion!
61
adc_delay++; //increment the counter
71
////////////////////////////////////////////////
72
//ADC sample complete!
73
/////////////////////////////////////////////////
81
touchscreen_process_x(ADCH);
85
touchscreen_process_y(ADCH);