Allow the modem to host serial displays.

This commit is contained in:
Jonathan Naylor 2016-10-06 18:40:43 +01:00
parent 02c90e3f7f
commit f8d9c881ff
2 changed files with 22 additions and 1 deletions

View File

@ -22,7 +22,7 @@
// Allow for the use of high quality external clock oscillators // Allow for the use of high quality external clock oscillators
// The number is the frequency of the oscillator in Hertz. // The number is the frequency of the oscillator in Hertz.
// For 12 MHz // For 12 MHz
// #define EXTERNAL_OSC 12000000 #define EXTERNAL_OSC 12000000
// For 14.4 MHz // For 14.4 MHz
// #define EXTERNAL_OSC 14400000 // #define EXTERNAL_OSC 14400000
// For 19.2 MHz // For 19.2 MHz
@ -51,5 +51,8 @@
// Pass RSSI information to the host // Pass RSSI information to the host
// #define SEND_RSSI_DATA // #define SEND_RSSI_DATA
// Use the modem as a serial repeater for Nextion displays
// #define SERIAL_REPEATER
#endif #endif

View File

@ -59,6 +59,8 @@ const uint8_t MMDVM_P25_LOST = 0x32U;
const uint8_t MMDVM_ACK = 0x70U; const uint8_t MMDVM_ACK = 0x70U;
const uint8_t MMDVM_NAK = 0x7FU; const uint8_t MMDVM_NAK = 0x7FU;
const uint8_t MMDVM_SERIAL = 0x80U;
const uint8_t MMDVM_DEBUG1 = 0xF1U; const uint8_t MMDVM_DEBUG1 = 0xF1U;
const uint8_t MMDVM_DEBUG2 = 0xF2U; const uint8_t MMDVM_DEBUG2 = 0xF2U;
const uint8_t MMDVM_DEBUG3 = 0xF3U; const uint8_t MMDVM_DEBUG3 = 0xF3U;
@ -386,6 +388,10 @@ void CSerialPort::start()
m_serial.baud(115200); m_serial.baud(115200);
#else #else
Serial.begin(115200); Serial.begin(115200);
#if defined(SERIAL_REPEATER)
Serial3.begin(9600);
#endif
#endif #endif
} }
@ -632,6 +638,12 @@ void CSerialPort::process()
} }
break; break;
#if defined(SERIAL_REPEATER)
case MMDVM_SERIAL:
Serial3.write(m_buffer + 3U, m_len - 3U);
break;
#endif
default: default:
// Handle this, send a NAK back // Handle this, send a NAK back
sendNAK(1U); 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) void CSerialPort::writeDStarHeader(const uint8_t* header, uint8_t length)