m0zah/GB3TX/repeater.ino

48 lines
1.3 KiB
Arduino
Raw Normal View History

2024-04-01 18:21:09 +01:00
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;
}
}
2024-04-02 14:50:06 +01:00
bool busy(repeater* myrpt) {
rx(myrpt);
return (!myrpt->receiver.rx || !myrpt->gateway.receiver.rx);
}
2024-04-01 18:21:09 +01:00
void courtesyTone(repeater* myrpt) {
switch(myrpt->params.courtesy) {
2024-04-02 16:54:27 +01:00
case TONE:
2024-04-01 18:21:09 +01:00
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);
2024-04-02 14:50:06 +01:00
if (TAILPIPS)
delay(150);
2024-04-01 18:21:09 +01:00
break;
2024-04-02 16:54:27 +01:00
case CW:
2024-04-01 18:21:09 +01:00
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;
}
}