let HSTone be generated by HamShield itself
This commit is contained in:
parent
1d0eb281e2
commit
12fd074aed
|
@ -74,6 +74,7 @@ void loop() {
|
||||||
//Serial.println(messagebuff);
|
//Serial.println(messagebuff);
|
||||||
prepMessage();
|
prepMessage();
|
||||||
msgptr = 0;
|
msgptr = 0;
|
||||||
|
messagebuff = "";
|
||||||
Serial.print("!!");
|
Serial.print("!!");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -140,7 +141,6 @@ void prepMessage() {
|
||||||
}
|
}
|
||||||
Serial.println("Done sending");
|
Serial.println("Done sending");
|
||||||
radio.setModeReceive();
|
radio.setModeReceive();
|
||||||
messagebuff = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1062,6 +1062,24 @@ void HamShield::setDTMFCode(uint16_t code){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tone Transmission
|
||||||
|
|
||||||
|
|
||||||
|
void HamShield::HStone(uint8_t pin, unsigned int frequency) {
|
||||||
|
HSwriteBitsW(devAddr, 0x79, 15, 2, 0x3); // transmit single tone (not dtmf)
|
||||||
|
HSwriteBitsW(devAddr, A1846S_DTMF_ENABLE_REG, 15, 2, 0x1); // transmit single tone (not dtmf)
|
||||||
|
|
||||||
|
// bypass pre/de-emphasis
|
||||||
|
HSwriteBitsW(devAddr, A1846S_FILTER_REG, A1846S_EMPH_FILTER_EN, 1, 1);
|
||||||
|
|
||||||
|
HSwriteWord(devAddr, A1846S_TONE1_FREQ, frequency*10);
|
||||||
|
setTxSourceTone1();
|
||||||
|
}
|
||||||
|
void HamShield::HSnoTone(uint8_t pin) {
|
||||||
|
HSwriteBitsW(devAddr, A1846S_DTMF_ENABLE_REG, 15, 2, 0x0); // disable tone and dtmf
|
||||||
|
setTxSourceMic();
|
||||||
|
}
|
||||||
|
|
||||||
// Tone detection
|
// Tone detection
|
||||||
void HamShield::lookForTone(uint16_t t_hz) {
|
void HamShield::lookForTone(uint16_t t_hz) {
|
||||||
float tone_hz = (float) t_hz;
|
float tone_hz = (float) t_hz;
|
||||||
|
|
|
@ -398,6 +398,8 @@ class HamShield {
|
||||||
void setDTMFCode(uint16_t code);
|
void setDTMFCode(uint16_t code);
|
||||||
|
|
||||||
// Tone
|
// Tone
|
||||||
|
void HStone(uint8_t pin, unsigned int frequency);
|
||||||
|
void HSnoTone(uint8_t pin);
|
||||||
void lookForTone(uint16_t tone_hz);
|
void lookForTone(uint16_t tone_hz);
|
||||||
uint8_t toneDetected();
|
uint8_t toneDetected();
|
||||||
|
|
||||||
|
|
|
@ -145,23 +145,3 @@ void HSdelay(unsigned long ms) {
|
||||||
void HSdelayMicroseconds(unsigned int us) {
|
void HSdelayMicroseconds(unsigned int us) {
|
||||||
delayMicroseconds(us);
|
delayMicroseconds(us);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HStone(uint8_t pin, unsigned int frequency) {
|
|
||||||
#if defined(ARDUINO_ARCH_NRF52)
|
|
||||||
//TODO
|
|
||||||
#elif defined(ARDUINO)
|
|
||||||
tone(pin, frequency);
|
|
||||||
#else
|
|
||||||
softToneCreate(pin);
|
|
||||||
softToneWrite(pin, frequency);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
void HSnoTone(uint8_t pin) {
|
|
||||||
#if defined(ARDUINO_ARCH_NRF52)
|
|
||||||
//TODO
|
|
||||||
#elif defined(ARDUINO)
|
|
||||||
noTone(pin);
|
|
||||||
#else
|
|
||||||
softToneWrite(pin, 0);
|
|
||||||
#endif
|
|
||||||
}
|
|
|
@ -41,8 +41,5 @@ unsigned long HSmillis();
|
||||||
void HSdelay(unsigned long ms);
|
void HSdelay(unsigned long ms);
|
||||||
void HSdelayMicroseconds(unsigned int us);
|
void HSdelayMicroseconds(unsigned int us);
|
||||||
|
|
||||||
void HStone(uint8_t pin, unsigned int frequency);
|
|
||||||
void HSnoTone(uint8_t pin);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* _HAMSHIELD_COMMS_H_ */
|
#endif /* _HAMSHIELD_COMMS_H_ */
|
||||||
|
|
Loading…
Reference in New Issue