diff --git a/Config.h b/Config.h index 7a6877f..043f0db 100644 --- a/Config.h +++ b/Config.h @@ -22,7 +22,7 @@ // Allow for the use of high quality external clock oscillators // The number is the frequency of the oscillator in Hertz. // For 12 MHz -// #define EXTERNAL_OSC 12000000 +#define EXTERNAL_OSC 12000000 // For 14.4 MHz // #define EXTERNAL_OSC 14400000 // For 19.2 MHz @@ -51,5 +51,8 @@ // Pass RSSI information to the host // #define SEND_RSSI_DATA +// Use the modem as a serial repeater for Nextion displays +// #define SERIAL_REPEATER + #endif diff --git a/SerialPort.cpp b/SerialPort.cpp index 529f5dd..706536c 100644 --- a/SerialPort.cpp +++ b/SerialPort.cpp @@ -59,6 +59,8 @@ const uint8_t MMDVM_P25_LOST = 0x32U; const uint8_t MMDVM_ACK = 0x70U; const uint8_t MMDVM_NAK = 0x7FU; +const uint8_t MMDVM_SERIAL = 0x80U; + const uint8_t MMDVM_DEBUG1 = 0xF1U; const uint8_t MMDVM_DEBUG2 = 0xF2U; const uint8_t MMDVM_DEBUG3 = 0xF3U; @@ -386,6 +388,10 @@ void CSerialPort::start() m_serial.baud(115200); #else Serial.begin(115200); + +#if defined(SERIAL_REPEATER) + Serial3.begin(9600); +#endif #endif } @@ -632,6 +638,12 @@ void CSerialPort::process() } break; +#if defined(SERIAL_REPEATER) + case MMDVM_SERIAL: + Serial3.write(m_buffer + 3U, m_len - 3U); + break; +#endif + default: // Handle this, send a NAK back sendNAK(1U); @@ -643,6 +655,12 @@ void CSerialPort::process() } } } + +#if defined(SERIAL_REPEATER) + // Drain any incoming serial data + while (Serial3.available()) + Serial3.read(); +#endif } void CSerialPort::writeDStarHeader(const uint8_t* header, uint8_t length)