Updated examples/DDS/DDS.ino to include the ISRs for the Arduino Zero.
NOTE: this sample won't really work for the HamShield ont he Ardiuno Zero as it will Besides the logic voltage issue, it will be playing its tones out of AO, rather than D3 or D11. Hook up your oscilloscope to A0 to see the waveform.
This commit is contained in:
parent
a581404e04
commit
11f5e8b733
|
@ -2,6 +2,12 @@
|
||||||
#include <HamShield.h>
|
#include <HamShield.h>
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
|
|
||||||
|
#ifdef __SAMD21G18A__
|
||||||
|
// NOTE: this won't really work for the Ardiuno Zero, as it will be playing its tones
|
||||||
|
// out of AO, rather than D3 or D11. Hook up your oscilloscope to A0 to see the waveform.
|
||||||
|
#warning Hamshield may not be compatible with the Arduino Zero.
|
||||||
|
#endif
|
||||||
|
|
||||||
HamShield radio;
|
HamShield radio;
|
||||||
DDS dds;
|
DDS dds;
|
||||||
|
|
||||||
|
@ -28,6 +34,31 @@ void loop() {
|
||||||
delay(1000);
|
delay(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __SAMD21G18A__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ISR for the Arduino Zero Timer/Counter 5
|
||||||
|
// DDS configures this to run at 44100 (default)
|
||||||
|
void DDS_Handler (void) {
|
||||||
|
// Do the thing
|
||||||
|
dds.clockTick();
|
||||||
|
|
||||||
|
// Clear the interrupt
|
||||||
|
TC5->COUNT16.INTFLAG.bit.MC0 = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TC5_Handler (void) __attribute__ ((weak, alias("DDS_Handler")));
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
// Standard AVR ISRs
|
||||||
|
|
||||||
#ifdef DDS_USE_ONLY_TIMER2
|
#ifdef DDS_USE_ONLY_TIMER2
|
||||||
ISR(TIMER2_OVF_vect) {
|
ISR(TIMER2_OVF_vect) {
|
||||||
dds.clockTick();
|
dds.clockTick();
|
||||||
|
@ -43,4 +74,7 @@ ISR(ADC_vect) {
|
||||||
dds.clockTick();
|
dds.clockTick();
|
||||||
digitalWrite(2, LOW);
|
digitalWrite(2, LOW);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* DDS_USE_ONLY_TIMER2 */
|
||||||
|
|
||||||
|
#endif /* __SAMD21G18A__ */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue