Fix examples isr

This commit is contained in:
nick6x 2017-07-28 16:16:10 -07:00
parent 6f4d8a93c5
commit c4daa7941b
1 changed files with 19 additions and 10 deletions

View File

@ -9,6 +9,8 @@
#define PWM_PIN 3
#define TIMER2_PHASE_ADVANCE 24
DDS dds;
void setup() {
@ -26,12 +28,19 @@ void loop() {
dds.setFrequency(2200);
}
#ifdef DDS_USE_ONLY_TIMER2
ISR(TIMER2_OVF_vect) {
//Uncomment if using dds.startPhaseAccumulator(true);
/*ISR(TIMER2_OVF_vect) {
static unsigned char tcnt = 0;
if(++tcnt == TIMER2_PHASE_ADVANCE) {
tcnt = 0;
dds.clockTick();
}
#else // Use the ADC timer instead
}*/
//Comment if using dds.startPhaseAccumulator(true);
ISR(ADC_vect) {
if(false){
static unsigned char tcnt = 0;
TIFR1 = _BV(ICF1); // Clear the timer flag
if(++tcnt == 4) {
@ -39,4 +48,4 @@ ISR(ADC_vect) {
}
dds.clockTick();
}
#endif
}