Update dds example for dds library changes
This commit is contained in:
parent
3e3b0daeab
commit
2edaac6fca
|
@ -18,6 +18,8 @@
|
||||||
#define RESET_PIN A3
|
#define RESET_PIN A3
|
||||||
#define SWITCH_PIN 2
|
#define SWITCH_PIN 2
|
||||||
|
|
||||||
|
#define TIMER2_PHASE_ADVANCE 24
|
||||||
|
|
||||||
HamShield radio;
|
HamShield radio;
|
||||||
DDS dds;
|
DDS dds;
|
||||||
|
|
||||||
|
@ -39,6 +41,7 @@ void setup() {
|
||||||
radio.frequency(438000);
|
radio.frequency(438000);
|
||||||
radio.setModeTransmit();
|
radio.setModeTransmit();
|
||||||
dds.start();
|
dds.start();
|
||||||
|
dds.startPhaseAccumulator(false);
|
||||||
dds.playWait(600, 3000);
|
dds.playWait(600, 3000);
|
||||||
dds.on();
|
dds.on();
|
||||||
//dds.setAmplitude(31);
|
//dds.setAmplitude(31);
|
||||||
|
@ -51,17 +54,24 @@ void loop() {
|
||||||
delay(1000);
|
delay(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
#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();
|
dds.clockTick();
|
||||||
}
|
}
|
||||||
#else // Use the ADC timer instead
|
}*/
|
||||||
|
|
||||||
|
//Comment if using dds.startPhaseAccumulator(true);
|
||||||
ISR(ADC_vect) {
|
ISR(ADC_vect) {
|
||||||
|
if(false){
|
||||||
static unsigned char tcnt = 0;
|
static unsigned char tcnt = 0;
|
||||||
TIFR1 = _BV(ICF1); // Clear the timer flag
|
TIFR1 = _BV(ICF1); // Clear the timer flag
|
||||||
if(++tcnt == 4) {
|
if(++tcnt == 4) {
|
||||||
tcnt = 0;
|
tcnt = 0;
|
||||||
}
|
}
|
||||||
dds.clockTick();
|
dds.clockTick();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
Loading…
Reference in New Issue