Determine ISR on #define
This commit is contained in:
parent
c4daa7941b
commit
7ebe201f96
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#define PWM_PIN 3
|
#define PWM_PIN 3
|
||||||
|
|
||||||
|
#define DDS_USE_ONLY_TIMER2 false
|
||||||
#define TIMER2_PHASE_ADVANCE 24
|
#define TIMER2_PHASE_ADVANCE 24
|
||||||
|
|
||||||
DDS dds;
|
DDS dds;
|
||||||
|
@ -18,7 +19,7 @@ void setup() {
|
||||||
digitalWrite(PWM_PIN, LOW);
|
digitalWrite(PWM_PIN, LOW);
|
||||||
|
|
||||||
dds.start();
|
dds.start();
|
||||||
dds.startPhaseAccumulator(false);
|
dds.startPhaseAccumulator(DDS_USE_ONLY_TIMER2);
|
||||||
dds.playWait(600, 3000);
|
dds.playWait(600, 3000);
|
||||||
dds.on();
|
dds.on();
|
||||||
//dds.setAmplitude(31);
|
//dds.setAmplitude(31);
|
||||||
|
@ -29,16 +30,15 @@ void loop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Uncomment if using dds.startPhaseAccumulator(true);
|
#if DDS_USE_ONLY_TIMER2
|
||||||
/*ISR(TIMER2_OVF_vect) {
|
ISR(TIMER2_OVF_vect) {
|
||||||
static unsigned char tcnt = 0;
|
static unsigned char tcnt = 0;
|
||||||
if(++tcnt == TIMER2_PHASE_ADVANCE) {
|
if(++tcnt == TIMER2_PHASE_ADVANCE) {
|
||||||
tcnt = 0;
|
tcnt = 0;
|
||||||
dds.clockTick();
|
dds.clockTick();
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
#else // Use the ADC timer instead
|
||||||
//Comment if using dds.startPhaseAccumulator(true);
|
|
||||||
ISR(ADC_vect) {
|
ISR(ADC_vect) {
|
||||||
if(false){
|
if(false){
|
||||||
static unsigned char tcnt = 0;
|
static unsigned char tcnt = 0;
|
||||||
|
@ -49,3 +49,4 @@ ISR(ADC_vect) {
|
||||||
dds.clockTick();
|
dds.clockTick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
Loading…
Reference in New Issue