58 lines
1.7 KiB
C++
58 lines
1.7 KiB
C++
//======================================================================
|
|
// TR.cpp
|
|
//======================================================================
|
|
|
|
#include <Arduino.h>
|
|
#include "TR.h"
|
|
|
|
UBitxTR TR(DSP);
|
|
|
|
void UBitxTR::update(bool cw, bool extKey) {
|
|
updateLinePTT();
|
|
|
|
if (cw) {
|
|
if ((keyEnable && keyDown) || extKey) {
|
|
setTX();
|
|
} else {
|
|
setRX();
|
|
}
|
|
return;
|
|
}
|
|
|
|
updateMicPTT();
|
|
updateMicVOX();
|
|
updateDataVOX();
|
|
|
|
if (isTX) {
|
|
// If we are currently transmitting, then ANY T/R release (key
|
|
// release) will result in exiting transmit... except for VOX
|
|
// and CAT which can only function as a release if it was enabled.
|
|
if (micPTTReleased() || linePTTReleased() ||
|
|
(micVOXEnabled() && micVOXDeactivated()) ||
|
|
(catEnabled() && catDeactivated()) ||
|
|
(dataVOXEnabled() && dataVOXDeactivated())) {
|
|
// first, stop transmitting; then, setup RX audio
|
|
DBGCMD( setRX() );
|
|
DBGCMD( dsp.rx() );
|
|
}
|
|
} else {
|
|
if ((micPTTEnabled() && micPTTPressed()) || (micVOXEnabled() && micVOXActivated())) {
|
|
// first, setup TX audio; then, start transmitting (from Mic)
|
|
DBGCMD( dsp.tx(MIC_IN) );
|
|
DBGCMD( setTX() );
|
|
} else if ((linePTTEnabled() && linePTTPressed())) {
|
|
// first, setup TX audio; then, start transmitting (from Line In)
|
|
DBGCMD( dsp.tx(LINE_IN) );
|
|
DBGCMD( setTX() );
|
|
} else if (catEnable && catActivated()) {
|
|
// first, setup TX audio; then, start transmitting (USB)
|
|
DBGCMD( dsp.tx(USB_IN) );
|
|
DBGCMD( setTX() );
|
|
}
|
|
}
|
|
}
|
|
|
|
//======================================================================
|
|
// EOF
|
|
//======================================================================
|