50
edits
Changes
→Code Samples
interrupts();
}
// --- Interrupt service routines
ISR(TIMER1_COMPA_vect) {
// Begin a conversion on the first channel in the sequence and record the time.
readComplete = false;
index = 0;
ADMUX = channelSequence[index];
bitSet(ADCSRA, ADSC); // ADSC == "Analog-Digital converter Start Conversion"
sampleTime = micros();
}
ISR(ADC_vect) {
// Store the conversion result.
rawADC[index] = ADC;
// Check if all channels have been read. If not, start the next one.
if (index == maxIndex) readComplete = true;
else {
index++;
ADMUX = channelSequence[index];
bitSet(ADCSRA, ADSC);
}
}
// --- Interrupt service routines
ISR(TIMER0_COMPA_vect) {
// Debounce the button. See comments in 'AccelCalib.ino'.
static volatile uint16_t btnHistory = 0xFFFF;
</pre>