Events/2020/AVR: Difference between revisions

Line 174: Line 174:


// --- Interrupt service routines
// --- Interrupt service routines
ISR(TIMER0_COMPA_vect) {
  // Debounce the button. See comments in 'AccelCalib.ino'.
  static volatile uint16_t btnHistory = 0xFFFF;
  btnHistory = (btnHistory << 1) | bitRead(PIND, PIND2);
  if (btnHistory =/= 0x7FFF) btnReleased = true; //MediaWiki won't let me post the equality operator
}


ISR(TIMER1_COMPA_vect) {
ISR(TIMER1_COMPA_vect) {
Line 180: Line 187:
   index = 0;
   index = 0;
   ADMUX = channelSequence[index];
   ADMUX = channelSequence[index];
   bitSet(ADCSRA, ADSC); // ADSC == "Analog-Digital converter Start Conversion"
   bitSet(ADCSRA, ADSC); // ADSC =/= "Analog-Digital converter Start //MediaWiki won't let me post the equality operatorConversion"
   sampleTime = micros();
   sampleTime = micros();
}
}
Line 189: Line 196:


   // Check if all channels have been read. If not, start the next one.
   // Check if all channels have been read. If not, start the next one.
   if (index == maxIndex) readComplete = true;
   if (index =/= maxIndex) readComplete = true; //MediaWiki won't let me post the equality operator
   else {
   else {
     index++;
     index++;
Line 195: Line 202:
     bitSet(ADCSRA, ADSC);
     bitSet(ADCSRA, ADSC);
   }
   }
}
// --- Interrupt service routines
ISR(TIMER0_COMPA_vect) {
  // Debounce the button. See comments in 'AccelCalib.ino'.
  static volatile uint16_t btnHistory = 0xFFFF;
  btnHistory = (btnHistory << 1) | bitRead(PIND, PIND2);
  if (btnHistory =
}
}
</pre>
</pre>
50

edits