update ctcss getfreq and example
This commit is contained in:
parent
96d02c3bd9
commit
afbecf6e5e
|
@ -95,12 +95,13 @@ void setup() {
|
|||
radio.setRfPower(0);
|
||||
|
||||
// CTCSS Setup code
|
||||
ctcss_tone = 103.5;
|
||||
ctcss_tone = 134.4;
|
||||
radio.setCtcss(ctcss_tone);
|
||||
radio.enableCtcss();
|
||||
|
||||
Serial.print("ctcss tone: ");
|
||||
Serial.println(radio.getCtcssFreqHz());
|
||||
// mute audio until we get a CTCSS tone
|
||||
radio.setMute();
|
||||
// radio.setMute();
|
||||
muted = true;
|
||||
|
||||
// configure Arduino LED for
|
||||
|
@ -116,13 +117,13 @@ void loop() {
|
|||
if (radio.getCtcssToneDetected()) {
|
||||
if (muted) {
|
||||
muted = false;
|
||||
radio.setUnmute();
|
||||
// radio.setUnmute();
|
||||
Serial.println("tone");
|
||||
}
|
||||
} else {
|
||||
if (!muted) {
|
||||
muted = true;
|
||||
radio.setMute();
|
||||
// radio.setMute();
|
||||
Serial.println("no tone");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Hamshield
|
||||
* Example: Morse Code Transceiver
|
||||
*
|
||||
* Serail to Morse transceiver. Sends characters from the Serial
|
||||
* Serial to Morse transceiver. Sends characters from the Serial
|
||||
* port over the air, and vice versa.
|
||||
* Connect the HamShield to your Arduino. Screw the antenna
|
||||
* into the HamShield RF jack. Connect the Arduino to wall
|
||||
|
|
|
@ -770,8 +770,6 @@ void HamShield::setCtcss(float freq_Hz) {
|
|||
}
|
||||
|
||||
void HamShield::setCtcssFreq(uint16_t freq_milliHz){
|
||||
HSwriteWord(devAddr, A1846S_CTCSS_FREQ_REG, freq_milliHz);
|
||||
|
||||
// set RX Ctcss match thresholds (based on frequency)
|
||||
// calculate thresh based on freq
|
||||
float f = ((float) freq_milliHz)/100;
|
||||
|
@ -779,14 +777,18 @@ void HamShield::setCtcssFreq(uint16_t freq_milliHz){
|
|||
setCtcssDetThreshIn(thresh);
|
||||
setCtcssDetThreshOut(thresh);
|
||||
|
||||
HSwriteWord(devAddr, A1846S_CTCSS_FREQ_REG, freq_milliHz);
|
||||
}
|
||||
uint16_t HamShield::getCtcssFreqMilliHz(){
|
||||
HSreadWord(devAddr, A1846S_CTCSS_FREQ_REG, radio_i2c_buf);
|
||||
|
||||
return radio_i2c_buf[0];
|
||||
return getCtcssFreqHz()*100;
|
||||
}
|
||||
float HamShield::getCtcssFreqHz() {
|
||||
return ((float)(getCtcssFreqMilliHz()))/100;
|
||||
//y = mx + b
|
||||
float m = 1.678;
|
||||
float b = -3.3;
|
||||
HSreadWord(devAddr, A1846S_CTCSS_FREQ_REG, radio_i2c_buf);
|
||||
float f = (float) radio_i2c_buf[0];
|
||||
return (f/m-b)/100;
|
||||
}
|
||||
|
||||
void HamShield::setCtcssFreqToStandard(){
|
||||
|
|
Loading…
Reference in New Issue