48 lines
1.3 KiB
C++
48 lines
1.3 KiB
C++
void tx(repeater* myrpt) {
|
|
if (myrpt->state > 1 && !myrpt->transmitter.tx) {
|
|
myrpt->transmitter.tx = true;
|
|
digitalWrite(PTT,LOW);
|
|
delay(100);
|
|
return;
|
|
}
|
|
|
|
if (!myrpt->transmitter.tx)
|
|
return;
|
|
|
|
myrpt->transmitter.tx = false;
|
|
digitalWrite(PTT,HIGH);
|
|
}
|
|
|
|
void rx(repeater* myrpt) {
|
|
myrpt->receiver.rx = digitalRead(COS);
|
|
myrpt->gateway.receiver.rx = digitalRead(GW_COS);
|
|
|
|
if (!myrpt->receiver.rx && !myrpt->gateway.transmitter.tx) {
|
|
digitalWrite(GWPTT, true);
|
|
myrpt->gateway.transmitter.tx = true;
|
|
return;
|
|
}
|
|
|
|
if (myrpt->gateway.transmitter.tx) {
|
|
digitalWrite(GWPTT, false);
|
|
myrpt->gateway.transmitter.tx = false;
|
|
}
|
|
}
|
|
|
|
bool busy(repeater* myrpt) {
|
|
rx(myrpt);
|
|
return (!myrpt->receiver.rx || !myrpt->gateway.receiver.rx);
|
|
}
|
|
|
|
void courtesyTone(repeater* myrpt) {
|
|
switch(myrpt->params.courtesy) {
|
|
case TONE:
|
|
myrpt->last == TT ? tone(3, myrpt->params.pip_pitch, myrpt->params.pip_length) : tone(3, myrpt->params.pip_gw_pitch, myrpt->params.pip_gw_length);
|
|
if (TAILPIPS)
|
|
delay(150);
|
|
break;
|
|
case CW:
|
|
myrpt->last == TT ? sendChar(myrpt->params.pip_speed,myrpt->params.pip_pitch,myrpt->params.pip_letter) : sendChar(myrpt->params.pip_speed,myrpt->params.pip_gw_pitch, myrpt->params.pip_gw_letter);
|
|
break;
|
|
}
|
|
} |