Fix examples isr
This commit is contained in:
parent
6f4d8a93c5
commit
c4daa7941b
|
@ -9,6 +9,8 @@
|
|||
|
||||
#define PWM_PIN 3
|
||||
|
||||
#define TIMER2_PHASE_ADVANCE 24
|
||||
|
||||
DDS dds;
|
||||
|
||||
void setup() {
|
||||
|
@ -26,17 +28,24 @@ void loop() {
|
|||
dds.setFrequency(2200);
|
||||
}
|
||||
|
||||
#ifdef DDS_USE_ONLY_TIMER2
|
||||
ISR(TIMER2_OVF_vect) {
|
||||
dds.clockTick();
|
||||
}
|
||||
#else // Use the ADC timer instead
|
||||
ISR(ADC_vect) {
|
||||
|
||||
//Uncomment if using dds.startPhaseAccumulator(true);
|
||||
/*ISR(TIMER2_OVF_vect) {
|
||||
static unsigned char tcnt = 0;
|
||||
TIFR1 = _BV(ICF1); // Clear the timer flag
|
||||
if(++tcnt == 4) {
|
||||
if(++tcnt == TIMER2_PHASE_ADVANCE) {
|
||||
tcnt = 0;
|
||||
dds.clockTick();
|
||||
}
|
||||
}*/
|
||||
|
||||
//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) {
|
||||
tcnt = 0;
|
||||
}
|
||||
dds.clockTick();
|
||||
}
|
||||
dds.clockTick();
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue