diff --git a/examples/AFSK_SerialMessenger/AFSK_SerialMessenger.ino b/examples/AFSK_SerialMessenger/AFSK_SerialMessenger.ino index 8ac3cc4..9f3143c 100644 --- a/examples/AFSK_SerialMessenger/AFSK_SerialMessenger.ino +++ b/examples/AFSK_SerialMessenger/AFSK_SerialMessenger.ino @@ -22,7 +22,7 @@ #include #include -#define PWM_PIN 3 +#define MIC_PIN 3 #define RESET_PIN A3 #define SWITCH_PIN 2 @@ -37,8 +37,8 @@ int msgptr = 0; void setup() { // NOTE: if not using PWM out, it should be held low to avoid tx noise - pinMode(PWM_PIN, OUTPUT); - digitalWrite(PWM_PIN, LOW); + pinMode(MIC_PIN, OUTPUT); + digitalWrite(MIC_PIN, LOW); // prep the switch pinMode(SWITCH_PIN, INPUT_PULLUP); diff --git a/examples/AppSerialController/AppSerialController.ino b/examples/AppSerialController/AppSerialController.ino index aefe09e..b20a511 100644 --- a/examples/AppSerialController/AppSerialController.ino +++ b/examples/AppSerialController/AppSerialController.ino @@ -5,7 +5,7 @@ #include -#define PWM_PIN 3 +#define MIC_PIN 3 #define RESET_PIN A3 #define SWITCH_PIN 2 @@ -17,8 +17,8 @@ uint8_t pl_rx_buffer[32]; void setup() { // NOTE: if not using PWM out, it should be held low to avoid tx noise - pinMode(PWM_PIN, OUTPUT); - digitalWrite(PWM_PIN, LOW); + pinMode(MIC_PIN, OUTPUT); + digitalWrite(MIC_PIN, LOW); // prep the switch pinMode(SWITCH_PIN, INPUT_PULLUP); diff --git a/examples/CTCSS/CTCSS.ino b/examples/CTCSS/CTCSS.ino index d2729be..0bd03c3 100644 --- a/examples/CTCSS/CTCSS.ino +++ b/examples/CTCSS/CTCSS.ino @@ -29,7 +29,7 @@ HamShield radio; #define LED_PIN 13 #define RSSI_REPORT_RATE_MS 5000 -#define PWM_PIN 3 +#define MIC_PIN 3 #define RESET_PIN A3 #define SWITCH_PIN 2 @@ -43,8 +43,8 @@ unsigned long rssi_timeout; void setup() { // NOTE: if not using PWM out, it should be held low to avoid tx noise - pinMode(PWM_PIN, OUTPUT); - digitalWrite(PWM_PIN, LOW); + pinMode(MIC_PIN, OUTPUT); + digitalWrite(MIC_PIN, LOW); // prep the switch pinMode(SWITCH_PIN, INPUT_PULLUP); diff --git a/examples/DDS/DDS.ino b/examples/DDS/DDS.ino index 353a7d4..4bb6fd4 100644 --- a/examples/DDS/DDS.ino +++ b/examples/DDS/DDS.ino @@ -14,7 +14,7 @@ #include #include -#define PWM_PIN 3 +#define MIC_PIN 3 #define RESET_PIN A3 #define SWITCH_PIN 2 @@ -26,8 +26,8 @@ DDS dds; void setup() { // NOTE: if not using PWM out, it should be held low to avoid tx noise - pinMode(PWM_PIN, OUTPUT); - digitalWrite(PWM_PIN, LOW); + pinMode(MIC_PIN, OUTPUT); + digitalWrite(MIC_PIN, LOW); // prep the switch pinMode(SWITCH_PIN, INPUT_PULLUP); diff --git a/examples/DTMF/DTMF.ino b/examples/DTMF/DTMF.ino index 9cc709f..824327d 100644 --- a/examples/DTMF/DTMF.ino +++ b/examples/DTMF/DTMF.ino @@ -20,7 +20,7 @@ HamShield radio; #define LED_PIN 13 -#define PWM_PIN 3 +#define MIC_PIN 3 #define RESET_PIN A3 #define SWITCH_PIN 2 @@ -28,8 +28,8 @@ uint32_t freq; void setup() { // NOTE: if not using PWM out, it should be held low to avoid tx noise - pinMode(PWM_PIN, OUTPUT); - digitalWrite(PWM_PIN, LOW); + pinMode(MIC_PIN, OUTPUT); + digitalWrite(MIC_PIN, LOW); // prep the switch pinMode(SWITCH_PIN, INPUT_PULLUP); diff --git a/examples/FMBeacon/FMBeacon.ino b/examples/FMBeacon/FMBeacon.ino index 89ab0c2..8f125fe 100644 --- a/examples/FMBeacon/FMBeacon.ino +++ b/examples/FMBeacon/FMBeacon.ino @@ -16,7 +16,7 @@ #define DDS_REFCLK_DEFAULT 9600 #include -#define PWM_PIN 3 +#define MIC_PIN 3 #define RESET_PIN A3 #define SWITCH_PIN 2 @@ -25,8 +25,8 @@ HamShield radio; // Run our start up things here void setup() { // NOTE: if not using PWM out, it should be held low to avoid tx noise - pinMode(PWM_PIN, OUTPUT); - digitalWrite(PWM_PIN, LOW); + pinMode(MIC_PIN, OUTPUT); + digitalWrite(MIC_PIN, LOW); // prep the switch pinMode(SWITCH_PIN, INPUT_PULLUP); diff --git a/examples/FoxHunt/FoxHunt.ino b/examples/FoxHunt/FoxHunt.ino index 640a62b..51e2e8c 100755 --- a/examples/FoxHunt/FoxHunt.ino +++ b/examples/FoxHunt/FoxHunt.ino @@ -15,7 +15,7 @@ #include -#define PWM_PIN 3 +#define MIC_PIN 3 #define RESET_PIN A3 #define SWITCH_PIN 2 @@ -29,8 +29,8 @@ HamShield radio; void setup() { // NOTE: if not using PWM out, it should be held low to avoid tx noise - pinMode(PWM_PIN, OUTPUT); - digitalWrite(PWM_PIN, LOW); + pinMode(MIC_PIN, OUTPUT); + digitalWrite(MIC_PIN, LOW); // prep the switch pinMode(SWITCH_PIN, INPUT_PULLUP); @@ -79,7 +79,7 @@ void loop() { radio.setModeTransmit(); // Generate a 600Hz tone for TRANSMITLENGTH time - tone(PWM_PIN, 600, TRANSMITLENGTH); + tone(MIC_PIN, 600, TRANSMITLENGTH); delay(TRANSMITLENGTH); // Identify the transmitter diff --git a/examples/HandyTalkie/HandyTalkie.ino b/examples/HandyTalkie/HandyTalkie.ino index 0186b1e..99bb1a3 100644 --- a/examples/HandyTalkie/HandyTalkie.ino +++ b/examples/HandyTalkie/HandyTalkie.ino @@ -26,7 +26,7 @@ HamShield radio; #define LED_PIN 13 #define RSSI_REPORT_RATE_MS 5000 -#define PWM_PIN 3 +#define MIC_PIN 3 #define RESET_PIN A3 #define SWITCH_PIN 2 @@ -39,8 +39,8 @@ unsigned long rssi_timeout; void setup() { // NOTE: if not using PWM out, it should be held low to avoid tx noise - pinMode(PWM_PIN, OUTPUT); - digitalWrite(PWM_PIN, LOW); + pinMode(MIC_PIN, OUTPUT); + digitalWrite(MIC_PIN, LOW); // prep the switch pinMode(SWITCH_PIN, INPUT_PULLUP); diff --git a/examples/KISS/KISS.ino b/examples/KISS/KISS.ino index 3ade1b7..980f43f 100644 --- a/examples/KISS/KISS.ino +++ b/examples/KISS/KISS.ino @@ -35,14 +35,14 @@ DDS dds; AFSK afsk; KISS kiss(&Serial, &radio, &dds, &afsk); -#define PWM_PIN 3 +#define MIC_PIN 3 #define RESET_PIN A3 #define SWITCH_PIN 2 void setup() { // NOTE: if not using PWM out, it should be held low to avoid tx noise - pinMode(PWM_PIN, OUTPUT); - digitalWrite(PWM_PIN, LOW); + pinMode(MIC_PIN, OUTPUT); + digitalWrite(MIC_PIN, LOW); // prep the switch pinMode(SWITCH_PIN, INPUT_PULLUP); diff --git a/examples/Morse/Morse.ino b/examples/Morse/Morse.ino index e80738a..e3134e0 100644 --- a/examples/Morse/Morse.ino +++ b/examples/Morse/Morse.ino @@ -15,7 +15,7 @@ #define DDS_REFCLK_DEFAULT 9600 #include -#define PWM_PIN 3 +#define MIC_PIN 3 #define RESET_PIN A3 #define SWITCH_PIN 2 @@ -48,8 +48,8 @@ uint8_t rx_idx; // Run our start up things here void setup() { // NOTE: if not using PWM out, it should be held low to avoid tx noise - pinMode(PWM_PIN, OUTPUT); - digitalWrite(PWM_PIN, LOW); + pinMode(MIC_PIN, OUTPUT); + digitalWrite(MIC_PIN, LOW); // prep the switch pinMode(SWITCH_PIN, INPUT_PULLUP); diff --git a/examples/SSTV/SSTV.ino b/examples/SSTV/SSTV.ino index 77ec250..389e15f 100755 --- a/examples/SSTV/SSTV.ino +++ b/examples/SSTV/SSTV.ino @@ -10,7 +10,7 @@ * 446MHz to receive the image output. */ -#define PWM_PIN 3 +#define MIC_PIN 3 #define RESET_PIN A3 #define SWITCH_PIN 2 @@ -28,8 +28,8 @@ int16_t rssi; void setup() { // NOTE: if not using PWM out, it should be held low to avoid tx noise - pinMode(PWM_PIN, OUTPUT); - digitalWrite(PWM_PIN, LOW); + pinMode(MIC_PIN, OUTPUT); + digitalWrite(MIC_PIN, LOW); // prep the switch pinMode(SWITCH_PIN, INPUT_PULLUP); diff --git a/examples/SSTV_M1_Static/SSTV_M1_Static.ino b/examples/SSTV_M1_Static/SSTV_M1_Static.ino index 5c4a03a..990674c 100644 --- a/examples/SSTV_M1_Static/SSTV_M1_Static.ino +++ b/examples/SSTV_M1_Static/SSTV_M1_Static.ino @@ -16,7 +16,7 @@ #include #include -#define PWM_PIN 3 +#define MIC_PIN 3 #define RESET_PIN A3 #define SWITCH_PIN 2 @@ -32,8 +32,8 @@ ddsAccumulator_t freqTable[3]; void setup() { // NOTE: if not using PWM out, it should be held low to avoid tx noise - pinMode(PWM_PIN, OUTPUT); - digitalWrite(PWM_PIN, LOW); + pinMode(MIC_PIN, OUTPUT); + digitalWrite(MIC_PIN, LOW); // prep the switch pinMode(SWITCH_PIN, INPUT_PULLUP); diff --git a/examples/SerialTransceiver/SerialTransceiver.ino b/examples/SerialTransceiver/SerialTransceiver.ino index 473ac6a..2ce2601 100644 --- a/examples/SerialTransceiver/SerialTransceiver.ino +++ b/examples/SerialTransceiver/SerialTransceiver.ino @@ -47,7 +47,7 @@ Debug Msg @; 32 character debug message #include "HamShield.h" -#define PWM_PIN 3 +#define MIC_PIN 3 #define RESET_PIN A3 #define SWITCH_PIN 2 @@ -71,8 +71,8 @@ HamShield radio; void setup() { // NOTE: if not using PWM out, it should be held low to avoid tx noise - pinMode(PWM_PIN, OUTPUT); - digitalWrite(PWM_PIN, LOW); + pinMode(MIC_PIN, OUTPUT); + digitalWrite(MIC_PIN, LOW); // prep the switch pinMode(SWITCH_PIN, INPUT_PULLUP); diff --git a/examples/SignalTest/SignalTest.ino b/examples/SignalTest/SignalTest.ino index 9fa8530..ed6d440 100755 --- a/examples/SignalTest/SignalTest.ino +++ b/examples/SignalTest/SignalTest.ino @@ -25,7 +25,7 @@ char CALLSIGN[] = "1ZZ9ZZ/B"; #include #include -#define PWM_PIN 3 +#define MIC_PIN 3 #define RESET_PIN A3 #define SWITCH_PIN 2 @@ -90,8 +90,8 @@ const unsigned char dbm[] PROGMEM = { void setup() { // NOTE: if not using PWM out, it should be held low to avoid tx noise - pinMode(PWM_PIN, OUTPUT); - digitalWrite(PWM_PIN, LOW); + pinMode(MIC_PIN, OUTPUT); + digitalWrite(MIC_PIN, LOW); // prep the switch pinMode(SWITCH_PIN, INPUT_PULLUP); diff --git a/examples/SpeechTX/SpeechTX.ino b/examples/SpeechTX/SpeechTX.ino index fc7bcfd..9067883 100644 --- a/examples/SpeechTX/SpeechTX.ino +++ b/examples/SpeechTX/SpeechTX.ino @@ -12,7 +12,7 @@ #include -#define PWM_PIN 3 +#define MIC_PIN 3 #define RESET_PIN A3 #define SWITCH_PIN 2 @@ -230,8 +230,8 @@ const uint8_t spYELLOW[] PROGMEM = {0x69,0xBD,0x56,0x15,0xAC,0x67,0xE5,0x void setup() { // NOTE: if not using PWM out, it should be held low to avoid tx noise - pinMode(PWM_PIN, OUTPUT); - digitalWrite(PWM_PIN, HIGH); + pinMode(MIC_PIN, OUTPUT); + digitalWrite(MIC_PIN, HIGH); // prep the switch pinMode(SWITCH_PIN, INPUT_PULLUP); diff --git a/src/HamShield.cpp b/src/HamShield.cpp index 1757601..fab6e16 100644 --- a/src/HamShield.cpp +++ b/src/HamShield.cpp @@ -125,11 +125,11 @@ const unsigned char AFSK_space[] PROGMEM = { 140, 228, 250, 166, 53, 0, 53, 166, * @see A1846S_ADDRESS_AD0_LOW * @see A1846S_ADDRESS_AD0_HIGH */ -HamShield::HamShield(uint8_t cs_pin = nSEN, uint8_t clk_pin = CLK, uint8_t dat_pin = DAT, uint8_t pwm_pin = HAMSHIELD_PWM_PIN) { - devAddr = cs_pin; - hs_pwm_pin = pwm_pin; +HamShield::HamShield(uint8_t ncs_pin = nSEN, uint8_t clk_pin = CLK, uint8_t dat_pin = DAT, uint8_t mic_pin = MIC) { + devAddr = ncs_pin; + hs_mic_pin = mic_pin; - HSsetPins(cs_pin, clk_pin, dat_pin); + HSsetPins(ncs_pin, clk_pin, dat_pin); } @@ -1598,12 +1598,12 @@ void HamShield::morseOut(char buffer[HAMSHIELD_MORSE_BUFFER_SIZE]) { // We delay by 4 here, if we previously sent a symbol. Otherwise 7. // This could probably just be always 7 and go relatively unnoticed. if(prev == 0 || prev == ' '){ - //tone(hs_pwm_pin, 6000, morse_dot_millis * 7); - HSnoTone(hs_pwm_pin); + //tone(hs_mic_pin, 6000, morse_dot_millis * 7); + HSnoTone(hs_mic_pin); HSdelay(morse_dot_millis*7); } else { - //tone(hs_pwm_pin, 6000, morse_dot_millis * 4); - HSnoTone(hs_pwm_pin); + //tone(hs_mic_pin, 6000, morse_dot_millis * 4); + HSnoTone(hs_mic_pin); HSdelay(morse_dot_millis*4); } continue; @@ -1613,23 +1613,23 @@ void HamShield::morseOut(char buffer[HAMSHIELD_MORSE_BUFFER_SIZE]) { if(bits) { // If it is a valid character... do { if(bits & 1) { - HStone(hs_pwm_pin, morse_freq);//, morse_dot_millis * 3); + HStone(hs_mic_pin, morse_freq);//, morse_dot_millis * 3); HSdelay(morse_dot_millis*3); - HSnoTone(hs_pwm_pin); + HSnoTone(hs_mic_pin); } else { - HStone(hs_pwm_pin, morse_freq);//, morse_dot_millis); + HStone(hs_mic_pin, morse_freq);//, morse_dot_millis); HSdelay(morse_dot_millis); - HSnoTone(hs_pwm_pin); + HSnoTone(hs_mic_pin); } - //tone(hs_pwm_pin, 6000, morse_dot_millis); - HSnoTone(hs_pwm_pin); + //tone(hs_mic_pin, 6000, morse_dot_millis); + HSnoTone(hs_mic_pin); HSdelay(morse_dot_millis); bits >>= 1; // Shift into the next symbol } while(bits != 1); // Wait for 1 termination to be all we have left } // End of character - //tone(hs_pwm_pin, 6000, morse_dot_millis * 3); - HSnoTone(hs_pwm_pin); + //tone(hs_mic_pin, 6000, morse_dot_millis * 3); + HSnoTone(hs_mic_pin); HSdelay(morse_dot_millis * 3); } return; @@ -1760,20 +1760,20 @@ void HamShield::SSTVTestPattern(int code) { /* wait for tone to complete */ void HamShield::toneWait(uint16_t freq, long timer) { - HStone(hs_pwm_pin,freq);//,timer); + HStone(hs_mic_pin,freq);//,timer); HSdelay(timer); - HSnoTone(hs_pwm_pin); + HSnoTone(hs_mic_pin); } /* wait microseconds for tone to complete */ void HamShield::toneWaitU(uint16_t freq, long timer) { if(freq < 16383) { - HStone(hs_pwm_pin,freq); - HSdelayMicroseconds(timer); HSnoTone(hs_pwm_pin); return; + HStone(hs_mic_pin,freq); + HSdelayMicroseconds(timer); HSnoTone(hs_mic_pin); return; } - HStone(hs_pwm_pin,freq); - HSdelay(timer / 1000); HSnoTone(hs_pwm_pin); return; + HStone(hs_mic_pin,freq); + HSdelay(timer / 1000); HSnoTone(hs_mic_pin); return; } diff --git a/src/HamShield.h b/src/HamShield.h index 5cfdd7e..c7fe0eb 100644 --- a/src/HamShield.h +++ b/src/HamShield.h @@ -220,7 +220,7 @@ class HamShield { public: - HamShield(uint8_t cs_pin = nSEN, uint8_t clk_pin = CLK, uint8_t dat_pin = DAT, uint8_t pwm_pin = HAMSHIELD_PWM_PIN); + HamShield(uint8_t ncs_pin = nCS, uint8_t clk_pin = CLK, uint8_t dat_pin = DAT, uint8_t mic_pin = MIC); void initialize(); // defaults to 12.5kHz void initialize(bool narrowBand); // select 12.5kHz if true or 25kHz if false @@ -496,7 +496,7 @@ class HamShield { private: uint8_t devAddr; - uint8_t hs_pwm_pin; + uint8_t hs_mic_pin; uint16_t radio_i2c_buf[4]; bool tx_active; bool rx_active; diff --git a/src/HamShield_comms.cpp b/src/HamShield_comms.cpp index 9738d37..a9ace46 100644 --- a/src/HamShield_comms.cpp +++ b/src/HamShield_comms.cpp @@ -8,7 +8,7 @@ #include "Arduino.h" //#include "I2Cdev.h" -uint8_t ncs_pin = nSEN; +uint8_t ncs_pin = nCS; uint8_t clk_pin = CLK; uint8_t dat_pin = DAT; diff --git a/src/HamShield_comms.h b/src/HamShield_comms.h index 8993a28..43f57fc 100644 --- a/src/HamShield_comms.h +++ b/src/HamShield_comms.h @@ -7,10 +7,10 @@ #include "stdint.h" #include "Arduino.h" -#define nSEN A1 //15 // +#define nCS A1 //15 // #define CLK A5 //19 // #define DAT A4 //18 // -#define HAMSHIELD_PWM_PIN 3 // Pin assignment for PWM output +#define MIC 3 // Pin assignment for PWM output void HSsetPins(uint8_t ncs, uint8_t clk, uint8_t dat);