updating all examples for new library
This commit is contained in:
parent
3a209d8db4
commit
5f363f1537
|
@ -142,6 +142,11 @@ void HamShield::initialize() {
|
|||
|
||||
uint16_t tx_data;
|
||||
|
||||
pinMode(A1, OUTPUT);
|
||||
digitalWrite(A1, HIGH);
|
||||
pinMode(A4, OUTPUT);
|
||||
pinMode(A5, OUTPUT);
|
||||
|
||||
// reset all registers in A1846S
|
||||
softReset();
|
||||
|
||||
|
@ -990,7 +995,7 @@ bool HamShield::getPreDeEmphEnabled(){
|
|||
int16_t HamShield::readRSSI(){
|
||||
HSreadBitsW(devAddr, A1846S_RSSI_REG, A1846S_RSSI_BIT, A1846S_RSSI_LENGTH, radio_i2c_buf);
|
||||
|
||||
int16_t rssi = (radio_i2c_buf[0] & 0x3FF) - 137;
|
||||
int16_t rssi = (radio_i2c_buf[0] & 0xFF); // - 137;
|
||||
return rssi;
|
||||
}
|
||||
uint16_t HamShield::readVSSI(){
|
||||
|
|
|
@ -188,7 +188,7 @@
|
|||
#define A1846S_VOX_FLAG_BIT 0 // vox out from dsp
|
||||
|
||||
// Bitfields for A1846S_RSSI_REG
|
||||
#define A1846S_RSSI_BIT 15 // RSSI readings <9:0>
|
||||
#define A1846S_RSSI_BIT 15 // RSSI readings <7:0>
|
||||
#define A1846S_RSSI_LENGTH 8
|
||||
|
||||
// Bitfields for A1846S_VSSI_REG
|
||||
|
|
|
@ -8,10 +8,8 @@
|
|||
#define DDS_REFCLK_DEFAULT 9600
|
||||
|
||||
#include <HamShield.h>
|
||||
#include <Wire.h>
|
||||
#include <avr/wdt.h>
|
||||
|
||||
//TODO: move these into library
|
||||
#define PWM_PIN 3
|
||||
#define RESET_PIN A3
|
||||
#define SWITCH_PIN 2
|
||||
|
@ -39,8 +37,6 @@ void setup() {
|
|||
digitalWrite(RESET_PIN, HIGH);
|
||||
|
||||
Serial.begin(115200);
|
||||
Wire.begin();
|
||||
|
||||
|
||||
radio.initialize();
|
||||
radio.frequency(144390);
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#define DDS_REFCLK_DEFAULT 9600
|
||||
|
||||
#include <HamShield.h>
|
||||
#include <Wire.h>
|
||||
#include <avr/wdt.h>
|
||||
|
||||
#define PWM_PIN 3
|
||||
|
@ -37,7 +36,7 @@ void setup() {
|
|||
digitalWrite(RESET_PIN, HIGH);
|
||||
|
||||
Serial.begin(115200);
|
||||
Wire.begin();
|
||||
|
||||
radio.initialize();
|
||||
radio.frequency(145570);
|
||||
radio.setRfPower(0);
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include <HamShield.h>
|
||||
#include <Wire.h>
|
||||
|
||||
HamShield radio;
|
||||
DDS dds;
|
||||
|
@ -13,7 +12,7 @@ DDS dds;
|
|||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
Wire.begin();
|
||||
|
||||
pinMode(4, OUTPUT);
|
||||
pinMode(5, OUTPUT);
|
||||
pinMode(6, OUTPUT);
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include <HamShield.h>
|
||||
#include <Wire.h>
|
||||
|
||||
#define PWM_PIN 3
|
||||
#define RESET_PIN A3
|
||||
|
@ -22,7 +21,7 @@ void setup() {
|
|||
digitalWrite(RESET_PIN, HIGH);
|
||||
|
||||
Serial.begin(9600);
|
||||
Wire.begin();
|
||||
|
||||
Serial.println(F("Radio test connection"));
|
||||
Serial.println(radio.testConnection(), DEC);
|
||||
Serial.println(F("Initialize"));
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#define DDS_DEBUG_SERIAL
|
||||
|
||||
#include <HamShield.h>
|
||||
#include <Wire.h>
|
||||
|
||||
#define PWM_PIN 3
|
||||
#define RESET_PIN A3
|
||||
|
@ -26,7 +25,7 @@ void setup() {
|
|||
digitalWrite(RESET_PIN, HIGH);
|
||||
|
||||
Serial.begin(9600);
|
||||
Wire.begin();
|
||||
|
||||
radio.initialize();
|
||||
radio.setRfPower(0);
|
||||
radio.setFrequency(145050);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#define DDS_REFCLK_DEFAULT 9600
|
||||
#include <HamShield.h>
|
||||
#include <Wire.h>
|
||||
|
||||
|
||||
#define PWM_PIN 3
|
||||
|
@ -23,7 +22,6 @@ void setup() {
|
|||
// turn on radio
|
||||
digitalWrite(RESET_PIN, HIGH);
|
||||
|
||||
Wire.begin();
|
||||
radio.initialize();
|
||||
radio.setRfPower(0);
|
||||
radio.setFrequency(145060);
|
||||
|
|
|
@ -5,9 +5,8 @@ Test beacon will transmit and wait 30 seconds.
|
|||
Beacon will check to see if the channel is clear before it will transmit.
|
||||
*/
|
||||
|
||||
// Include the HamSheild and Wire (I2C) libraries
|
||||
// Include the HamSheild
|
||||
#include <HamShield.h>
|
||||
#include <Wire.h>
|
||||
|
||||
#define PWM_PIN 3
|
||||
#define RESET_PIN A3
|
||||
|
@ -35,9 +34,6 @@ void setup() {
|
|||
// Send a quick serial string
|
||||
Serial.println("HamShield FM Beacon Example Sketch");
|
||||
|
||||
// Start the Wire (I2C) library
|
||||
Wire.begin();
|
||||
|
||||
// Query the HamShield for status information
|
||||
Serial.print("Radio status: ");
|
||||
int result = radio.testConnection();
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/* Fox Hunt */
|
||||
|
||||
#include <HamShield.h>
|
||||
//#include <Wire.h>
|
||||
|
||||
#define PWM_PIN 3
|
||||
#define RESET_PIN A3
|
||||
|
@ -27,7 +26,6 @@ void setup() {
|
|||
pinMode(RESET_PIN, OUTPUT);
|
||||
digitalWrite(RESET_PIN, HIGH);
|
||||
|
||||
//Wire.begin();
|
||||
radio.initialize();
|
||||
radio.frequency(145510);
|
||||
radio.setModeReceive();
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/* HamShield Functional Test */
|
||||
|
||||
#include <HamShield.h>
|
||||
#include <Wire.h>
|
||||
|
||||
#define PWM_PIN 3
|
||||
#define RESET_PIN A3
|
||||
|
@ -21,7 +20,6 @@ void setup() {
|
|||
pinMode(RESET_PIN, OUTPUT);
|
||||
digitalWrite(RESET_PIN, HIGH);
|
||||
|
||||
Wire.begin();
|
||||
Serial.begin(9600);
|
||||
Serial.println("If the sketch freezes at radio status, there is something wrong with power or the shield");
|
||||
Serial.print("Radio status: ");
|
||||
|
|
|
@ -7,14 +7,13 @@ Simple gauges for the radio receiver.
|
|||
|
||||
*/
|
||||
|
||||
#include <HAMShield.h>
|
||||
#include <Wire.h>
|
||||
#include <HamShield.h>
|
||||
|
||||
#define PWM_PIN 3
|
||||
#define RESET_PIN A3
|
||||
#define SWITCH_PIN 2
|
||||
|
||||
HAMShield radio;
|
||||
HamShield radio;
|
||||
|
||||
void clr() {
|
||||
/* Serial.write(27);
|
||||
|
@ -37,7 +36,7 @@ void setup() {
|
|||
|
||||
analogReference(DEFAULT);
|
||||
Serial.begin(115200);
|
||||
Wire.begin();
|
||||
|
||||
Serial.print("Radio status: ");
|
||||
int result = radio.testConnection();
|
||||
Serial.println(result,DEC);
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
/* Simple DTMF controlled HAM Radio Robot */
|
||||
|
||||
#include <ArduinoRobot.h> // include the robot library
|
||||
#include <HAMShield.h>
|
||||
#include <Wire.h>
|
||||
#include <HamShield.h>
|
||||
#include <SPI.h>
|
||||
|
||||
#define PWM_PIN 3
|
||||
#define RESET_PIN A3
|
||||
#define SWITCH_PIN 2
|
||||
|
||||
HAMShield radio;
|
||||
HamShield radio;
|
||||
|
||||
void setup() {
|
||||
// NOTE: if not using PWM out, it should be held low to avoid tx noise
|
||||
|
@ -24,7 +23,7 @@ void setup() {
|
|||
digitalWrite(RESET_PIN, HIGH);
|
||||
|
||||
Robot.begin();
|
||||
Wire.begin();
|
||||
|
||||
radio.initialize();
|
||||
radio.frequency(145510);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
// Hamshield
|
||||
|
||||
// Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation
|
||||
// is used in I2Cdev.h
|
||||
#include "Wire.h"
|
||||
|
||||
#include <HamShield.h>
|
||||
|
||||
// create object for radio
|
||||
|
@ -48,9 +44,6 @@ void setup() {
|
|||
|
||||
Serial.println("beginning radio setup");
|
||||
|
||||
// join I2C bus (I2Cdev library doesn't do this automatically)
|
||||
Wire.begin();
|
||||
|
||||
// verify connection
|
||||
Serial.println("Testing device connections...");
|
||||
Serial.println(radio.testConnection() ? "RDA radio connection successful" : "RDA radio connection failed");
|
||||
|
|
|
@ -7,8 +7,7 @@ Arduino audio overlay example
|
|||
*/
|
||||
|
||||
|
||||
#include <HAMShield.h>
|
||||
#include <Wire.h>
|
||||
#include <HamShield.h>
|
||||
|
||||
#define DOT 100
|
||||
|
||||
|
@ -16,7 +15,7 @@ Arduino audio overlay example
|
|||
#define RESET_PIN A3
|
||||
#define SWITCH_PIN 2
|
||||
|
||||
HAMShield radio;
|
||||
HamShield radio;
|
||||
|
||||
const char *bascii = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,?'!/()&:;=+-_\"$@",
|
||||
*bitu[] = { ".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--..","-----",".----","..---","...--","....-",".....","-....","--...","---..","----.",".-.-.-","--..--","..--..",".----.","-.-.--","-..-.","-.--.","-.--.-",".-...","---...","-.-.-.","-...-",".-.-.","-....-","..--.-",".-..-.","...-..-",".--.-."
|
||||
|
@ -40,7 +39,7 @@ void setup() {
|
|||
|
||||
Serial.begin(9600);
|
||||
Serial.println("starting up..");
|
||||
Wire.begin();
|
||||
|
||||
Serial.print("Radio status: ");
|
||||
int result = radio.testConnection();
|
||||
Serial.println(result,DEC);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/* Just Transmit */
|
||||
|
||||
#include <HamShield.h>
|
||||
#include <Wire.h>
|
||||
|
||||
#define PWM_PIN 3
|
||||
#define RESET_PIN A3
|
||||
|
@ -21,7 +20,6 @@ void setup() {
|
|||
pinMode(RESET_PIN, OUTPUT);
|
||||
digitalWrite(RESET_PIN, HIGH);
|
||||
|
||||
Wire.begin();
|
||||
Serial.begin(9600);
|
||||
Serial.println("If the sketch freezes at radio status, there is something wrong with power or the shield");
|
||||
Serial.print("Radio status: ");
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include <HamShield.h>
|
||||
#include <Wire.h>
|
||||
#include <KISS.h>
|
||||
|
||||
HamShield radio;
|
||||
|
@ -30,7 +29,6 @@ void setup() {
|
|||
// let the AU ot of reset
|
||||
digitalWrite(RESET_PIN, HIGH);
|
||||
|
||||
Wire.begin();
|
||||
radio.initialize();
|
||||
radio.setSQOff();
|
||||
radio.setFrequency(144390);
|
||||
|
|
|
@ -6,8 +6,7 @@ A bit robotic and weird
|
|||
|
||||
*/
|
||||
|
||||
#include <HAMShield.h>
|
||||
#include <Wire.h>
|
||||
#include <HamShield.h>
|
||||
|
||||
#define PWM_PIN 3
|
||||
#define RESET_PIN A3
|
||||
|
@ -16,7 +15,7 @@ A bit robotic and weird
|
|||
#define RATE 500
|
||||
#define SIZE 1500
|
||||
|
||||
HAMShield radio;
|
||||
HamShield radio;
|
||||
|
||||
char sound[SIZE];
|
||||
unsigned int sample1;
|
||||
|
@ -36,7 +35,6 @@ void setup() {
|
|||
pinMode(RESET_PIN, OUTPUT);
|
||||
digitalWrite(RESET_PIN, HIGH);
|
||||
|
||||
Wire.begin();
|
||||
// int result = radio.testConnection();
|
||||
radio.initialize();
|
||||
radio.setFrequency(446000);
|
||||
|
|
|
@ -13,10 +13,9 @@ Sends an SSTV test pattern
|
|||
|
||||
/* Standard libraries and variable init */
|
||||
|
||||
#include <HAMShield.h>
|
||||
#include <Wire.h>
|
||||
#include <HamShield.h>
|
||||
|
||||
HAMShield radio;
|
||||
HamShield radio;
|
||||
int16_t rssi;
|
||||
|
||||
/* get our radio ready */
|
||||
|
@ -33,7 +32,6 @@ void setup() {
|
|||
pinMode(RESET_PIN, OUTPUT);
|
||||
digitalWrite(RESET_PIN, HIGH);
|
||||
|
||||
Wire.begin();
|
||||
Serial.begin(9600);
|
||||
Serial.print("Radio status: ");
|
||||
int result = radio.testConnection();
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#define DDS_REFCLK_DEFAULT (34965/2)
|
||||
|
||||
#include <HamShield.h>
|
||||
#include <Wire.h>
|
||||
|
||||
#define PWM_PIN 3
|
||||
#define RESET_PIN A3
|
||||
|
@ -31,8 +30,8 @@ void setup() {
|
|||
digitalWrite(RESET_PIN, HIGH);
|
||||
|
||||
Serial.begin(9600);
|
||||
Wire.begin();
|
||||
// Query the HamShield for status information
|
||||
|
||||
// Query the HamShield for status information
|
||||
Serial.print("Radio status: ");
|
||||
int result = 0;
|
||||
result = radio.testConnection();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
|
||||
SerialTransceiver is TTL Serial port "glue" to allow desktop or laptop control of the HAMShield
|
||||
SerialTransceiver is TTL Serial port "glue" to allow desktop or laptop control of the HamShield
|
||||
|
||||
Commands:
|
||||
|
||||
|
@ -46,7 +46,6 @@ Debug Msg @<text>; 32 character debug message
|
|||
|
||||
*/
|
||||
|
||||
#include "Wire.h"
|
||||
#include "HamShield.h"
|
||||
|
||||
#define PWM_PIN 3
|
||||
|
@ -85,7 +84,7 @@ void setup() {
|
|||
|
||||
Serial.begin(115200);
|
||||
Serial.print(";;;;;;;;;;;;;;;;;;;;;;;;;;");
|
||||
Wire.begin();
|
||||
|
||||
int result = radio.testConnection();
|
||||
Serial.print("*");
|
||||
Serial.print(result,DEC);
|
||||
|
|
|
@ -10,15 +10,14 @@ Plays back the current signal strength level and morses out it's call sign at th
|
|||
|
||||
/* Standard libraries and variable init */
|
||||
|
||||
#include <HAMShield.h>
|
||||
#include <Wire.h>
|
||||
#include <HamShield.h>
|
||||
#include <PCM.h>
|
||||
|
||||
#define PWM_PIN 3
|
||||
#define RESET_PIN A3
|
||||
#define SWITCH_PIN 2
|
||||
|
||||
HAMShield radio;
|
||||
HamShield radio;
|
||||
int16_t rssi;
|
||||
int peak = -150;
|
||||
char sig[8];
|
||||
|
@ -89,7 +88,6 @@ void setup() {
|
|||
pinMode(RESET_PIN, OUTPUT);
|
||||
digitalWrite(RESET_PIN, HIGH);
|
||||
|
||||
Wire.begin();
|
||||
Serial.begin(9600);
|
||||
Serial.print("Radio status: ");
|
||||
int result = radio.testConnection();
|
||||
|
|
Loading…
Reference in New Issue