2015-07-14 00:55:07 +00:00
|
|
|
#include <HamShield.h>
|
|
|
|
#include <Wire.h>
|
|
|
|
#include <KISS.h>
|
|
|
|
|
|
|
|
HamShield radio;
|
|
|
|
DDS dds;
|
|
|
|
KISS kiss(&Serial, &radio, &dds);
|
|
|
|
|
2015-11-23 16:54:10 +00:00
|
|
|
//TODO: move these into library
|
|
|
|
#define PWM_PIN 3
|
|
|
|
#define RESET_PIN A3
|
|
|
|
#define SWITCH_PIN 2
|
|
|
|
|
2015-07-14 00:55:07 +00:00
|
|
|
void setup() {
|
2015-11-23 16:54:10 +00:00
|
|
|
// NOTE: if not using PWM out, it should be held low to avoid tx noise
|
|
|
|
pinMode(PWM_PIN, OUTPUT);
|
|
|
|
digitalWrite(PWM_PIN, LOW);
|
|
|
|
|
|
|
|
// prep the switch
|
|
|
|
pinMode(SWITCH_PIN, INPUT_PULLUP);
|
|
|
|
|
|
|
|
// set up the reset control pin
|
|
|
|
pinMode(RESET_PIN, OUTPUT);
|
|
|
|
digitalWrite(RESET_PIN, LOW);
|
2015-07-14 00:55:07 +00:00
|
|
|
|
|
|
|
Serial.begin(9600);
|
2015-11-23 16:54:10 +00:00
|
|
|
|
|
|
|
while (digitalRead(SWITCH_PIN));
|
|
|
|
|
|
|
|
// let the AU ot of reset
|
|
|
|
digitalWrite(RESET_PIN, HIGH);
|
|
|
|
|
2015-07-14 00:55:07 +00:00
|
|
|
Wire.begin();
|
|
|
|
radio.initialize();
|
|
|
|
radio.setSQOff();
|
2015-11-23 16:54:10 +00:00
|
|
|
radio.setFrequency(144390);
|
|
|
|
//I2Cdev::writeWord(A1846S_DEV_ADDR_SENLOW, 0x44, 0x05FF);
|
2015-07-14 00:55:07 +00:00
|
|
|
|
|
|
|
dds.start();
|
|
|
|
radio.afsk.start(&dds);
|
|
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
|
|
|
kiss.loop();
|
|
|
|
}
|
|
|
|
|
|
|
|
ISR(ADC_vect) {
|
|
|
|
kiss.isr();
|
|
|
|
}
|