m0zah/GB3TX/repeater.ino

43 lines
1.2 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;
}
}
void courtesyTone(repeater* myrpt) {
switch(myrpt->params.courtesy) {
case 0:
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);
break;
case 1:
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;
}
if (TAILPIPS)
delay(150);
}