dtmf timing, sub-khz frequency resolution

This commit is contained in:
Morgan Redfield 2018-08-04 19:31:53 -07:00
parent 176814bc98
commit 45527b826f
3 changed files with 450 additions and 349 deletions

View File

@ -47,6 +47,7 @@ void setup() {
// let the AU ot of reset
digitalWrite(RESET_PIN, HIGH);
delay(5); // wait for device to come up
Serial.println("beginning radio setup");
@ -73,6 +74,8 @@ void setup() {
Serial.println("changing frequency");
freq = 420000;
radio.frequency(freq);
Serial.print("new frequency: ");
Serial.println(radio.getFrequency());
// set RX volume to minimum to reduce false positives on DTMF rx
radio.setVolume1(6);
@ -88,6 +91,16 @@ void setup() {
// set up DTMF
radio.enableDTMFReceive();
/* DTMF timing settings are optional.
* These times are set to default values when the device is started.
* You may want to change them if you're DTMF receiver isn't detecting
* codes from the HamShield (or vice versa).
*/
radio.setDTMFDetectTime(24); // time to detect a DTMF code, units are 2.5ms
radio.setDTMFIdleTime(50); // time between transmitted DTMF codes, units are 2.5ms
radio.setDTMFTxTime(60); // duration of transmitted DTMF codes, units are 2.5ms
Serial.println("ready");
}
@ -145,7 +158,6 @@ void loop() {
dtmf_to_tx = false;
}
}
delay(20); // make sure the last code is done
// done with tone
radio.setModeReceive();
radio.setTxSourceMic();

File diff suppressed because it is too large Load Diff

View File

@ -240,7 +240,9 @@ class HamShield {
void safeMode();
bool frequency(uint32_t freq_khz);
bool frequency(float freq_khz);
uint32_t getFrequency();
float getFrequency_float();
// channel mode
// 11 - 25kHz channel
@ -392,6 +394,12 @@ class HamShield {
// Writing a single DTMF code:
// setDTMFCode(code); // code is a uint16_t from 0x0 to 0xF
void enableDTMFReceive();
void setDTMFDetectTime(uint16_t detect_time);
uint16_t getDTMFDetectTime();
void setDTMFIdleTime(uint16_t idle_time); // idle time is time between DTMF Tone
uint16_t getDTMFIdleTime();
void setDTMFTxTime(uint16_t tx_time); // tx time is duration of DTMF Tone
uint16_t getDTMFTxTime();
uint16_t disableDTMF();
uint16_t getDTMFSample();
uint16_t getDTMFCode();
@ -480,7 +488,7 @@ class HamShield {
uint16_t radio_i2c_buf[4];
bool tx_active;
bool rx_active;
uint32_t radio_frequency;
float radio_frequency;
/* uint32_t FRS[];
uint32_t GMRS[];
uint32_t MURS[];