dtmf timing, sub-khz frequency resolution
This commit is contained in:
		
							parent
							
								
									176814bc98
								
							
						
					
					
						commit
						45527b826f
					
				| 
						 | 
					@ -47,6 +47,7 @@ void setup() {
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  // let the AU ot of reset
 | 
					  // let the AU ot of reset
 | 
				
			||||||
  digitalWrite(RESET_PIN, HIGH);
 | 
					  digitalWrite(RESET_PIN, HIGH);
 | 
				
			||||||
 | 
					  delay(5); // wait for device to come up
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  Serial.println("beginning radio setup");
 | 
					  Serial.println("beginning radio setup");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,6 +74,8 @@ void setup() {
 | 
				
			||||||
  Serial.println("changing frequency");
 | 
					  Serial.println("changing frequency");
 | 
				
			||||||
  freq = 420000;
 | 
					  freq = 420000;
 | 
				
			||||||
  radio.frequency(freq);
 | 
					  radio.frequency(freq);
 | 
				
			||||||
 | 
					  Serial.print("new frequency: ");
 | 
				
			||||||
 | 
					  Serial.println(radio.getFrequency());
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  // set RX volume to minimum to reduce false positives on DTMF rx
 | 
					  // set RX volume to minimum to reduce false positives on DTMF rx
 | 
				
			||||||
  radio.setVolume1(6);
 | 
					  radio.setVolume1(6);
 | 
				
			||||||
| 
						 | 
					@ -88,6 +91,16 @@ void setup() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // set up DTMF
 | 
					  // set up DTMF
 | 
				
			||||||
  radio.enableDTMFReceive();
 | 
					  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");
 | 
					  Serial.println("ready");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -145,7 +158,6 @@ void loop() {
 | 
				
			||||||
        dtmf_to_tx = false;
 | 
					        dtmf_to_tx = false;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    delay(20); // make sure the last code is done
 | 
					 | 
				
			||||||
    // done with tone
 | 
					    // done with tone
 | 
				
			||||||
    radio.setModeReceive();
 | 
					    radio.setModeReceive();
 | 
				
			||||||
    radio.setTxSourceMic();
 | 
					    radio.setTxSourceMic();
 | 
				
			||||||
| 
						 | 
					@ -185,4 +197,4 @@ char code2char(uint16_t code) {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
  return c;
 | 
					  return c;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
					@ -240,7 +240,9 @@ class HamShield {
 | 
				
			||||||
        void safeMode();
 | 
					        void safeMode();
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		bool frequency(uint32_t freq_khz);
 | 
							bool frequency(uint32_t freq_khz);
 | 
				
			||||||
 | 
					        bool frequency(float freq_khz);
 | 
				
			||||||
		uint32_t getFrequency();
 | 
							uint32_t getFrequency();
 | 
				
			||||||
 | 
							float getFrequency_float();
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
		// channel mode
 | 
							// channel mode
 | 
				
			||||||
		// 11 - 25kHz channel
 | 
							// 11 - 25kHz channel
 | 
				
			||||||
| 
						 | 
					@ -392,6 +394,12 @@ class HamShield {
 | 
				
			||||||
        //   Writing a single DTMF code:
 | 
					        //   Writing a single DTMF code:
 | 
				
			||||||
        //     setDTMFCode(code); // code is a uint16_t from 0x0 to 0xF
 | 
					        //     setDTMFCode(code); // code is a uint16_t from 0x0 to 0xF
 | 
				
			||||||
		void enableDTMFReceive();
 | 
							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 disableDTMF();
 | 
				
			||||||
		uint16_t getDTMFSample();
 | 
							uint16_t getDTMFSample();
 | 
				
			||||||
		uint16_t getDTMFCode();
 | 
							uint16_t getDTMFCode();
 | 
				
			||||||
| 
						 | 
					@ -480,7 +488,7 @@ class HamShield {
 | 
				
			||||||
        uint16_t radio_i2c_buf[4];
 | 
					        uint16_t radio_i2c_buf[4];
 | 
				
			||||||
		bool tx_active;
 | 
							bool tx_active;
 | 
				
			||||||
		bool rx_active;
 | 
							bool rx_active;
 | 
				
			||||||
        uint32_t radio_frequency;
 | 
					        float radio_frequency;
 | 
				
			||||||
/*        uint32_t FRS[];
 | 
					/*        uint32_t FRS[];
 | 
				
			||||||
        uint32_t GMRS[];
 | 
					        uint32_t GMRS[];
 | 
				
			||||||
        uint32_t MURS[];
 | 
					        uint32_t MURS[];
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue