From 4593f1d44c41d72d3dce5d3deac4dcb849d84b06 Mon Sep 17 00:00:00 2001 From: morgan Date: Tue, 27 Dec 2016 12:08:28 -0800 Subject: [PATCH] fix KISS example --- examples/KISS/KISS.ino | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/examples/KISS/KISS.ino b/examples/KISS/KISS.ino index fffab37..cd74f82 100644 --- a/examples/KISS/KISS.ino +++ b/examples/KISS/KISS.ino @@ -11,12 +11,14 @@ #include #include +#include #include +#include HamShield radio; DDS dds; -KISS kiss(&Serial, &radio, &dds); AFSK afsk; +KISS kiss(&Serial, &radio, &dds, &afsk); #define PWM_PIN 3 #define RESET_PIN A3 @@ -32,27 +34,44 @@ void setup() { // set up the reset control pin pinMode(RESET_PIN, OUTPUT); - digitalWrite(RESET_PIN, LOW); + digitalWrite(RESET_PIN, HIGH); Serial.begin(9600); - while (digitalRead(SWITCH_PIN)); - - // let the AU ot of reset - digitalWrite(RESET_PIN, HIGH); - radio.initialize(); - radio.setSQOff(); + //radio.setSQOff(); + radio.setVolume1(0xFF); + radio.setVolume2(0xFF); + radio.setSQHiThresh(-100); + radio.setSQLoThresh(-100); + radio.setSQOn(); radio.frequency(144390); dds.start(); afsk.start(&dds); + delay(100); + radio.setModeReceive(); } void loop() { kiss.loop(); } -ISR(ADC_vect) { - kiss.isr(); +ISR(TIMER2_OVF_vect) { + TIFR2 = _BV(TOV2); + static uint8_t tcnt = 0; + if(++tcnt == 8) { + dds.clockTick(); + tcnt = 0; + } } + +ISR(ADC_vect) { + static uint8_t tcnt = 0; + TIFR1 = _BV(ICF1); // Clear the timer flag + dds.clockTick(); + if(++tcnt == 1) { + afsk.timer(); + tcnt = 0; + } +} \ No newline at end of file