#include "cw.h" void sendChar(int speed, int pitch, char c) { if (c < 47 || c > 90) { delay(speed * 3 * 2); return; } if (c > 57 && c < 65) { return; } int index = c - 47; if (c >= 65) { index = c - 54; } if (index >= sizeof morse/sizeof morse[0]) return; int dd = morse[index]; for (int i=0; i < 8; i++) { if (dd == 1) { return; } tone(PIP, pitch); if (dd&1) { delay(speed * 3); } else { delay(speed); } dd >>= 1; noTone(PIP); delay(speed); } } void sendID(repeater* myrpt) { if (myrpt->callsign == NULL) { return; } for (int i=0; i < sizeof ID/sizeof ID[0]; i++) { /* attenuate pips in active T/T * unless first ID from sleep */ if (busy(myrpt) && !digitalRead(PIP_ATT)) digitalWrite(PIP_ATT, HIGH); sendChar(myrpt->params.cw_speed, myrpt->params.cw_pitch, myrpt->callsign[i]); delay(myrpt->params.cw_speed * 3); } if (digitalRead(PIP_ATT)) digitalWrite(PIP_ATT, LOW); }