Merge branch 'M17_AX25_FM' into I2C

This commit is contained in:
Jonathan Naylor
2020-11-26 10:05:13 +00:00
6 changed files with 140 additions and 21 deletions
+40 -2
View File
@@ -63,8 +63,9 @@ const uint8_t MMDVM_P25_LOST = 0x32U;
const uint8_t MMDVM_NXDN_DATA = 0x40U;
const uint8_t MMDVM_NXDN_LOST = 0x41U;
const uint8_t MMDVM_M17_DATA = 0x45U;
const uint8_t MMDVM_M17_LOST = 0x46U;
const uint8_t MMDVM_M17_HEADER = 0x45U;
const uint8_t MMDVM_M17_DATA = 0x46U;
const uint8_t MMDVM_M17_LOST = 0x47U;
const uint8_t MMDVM_POCSAG_DATA = 0x50U;
@@ -1238,6 +1239,20 @@ void CSerialPort::processMessage(uint8_t type, const uint8_t* buffer, uint16_t l
#endif
#if defined(MODE_M17)
case MMDVM_M17_HEADER:
if (m_m17Enable) {
if (m_modemState == STATE_IDLE || m_modemState == STATE_M17)
err = m17TX.writeData(buffer, length);
}
if (err == 0U) {
if (m_modemState == STATE_IDLE)
setMode(STATE_M17);
} else {
DEBUG2("Received invalid M17 header", err);
sendNAK(err);
}
break;
case MMDVM_M17_DATA:
if (m_m17Enable) {
if (m_modemState == STATE_IDLE || m_modemState == STATE_M17)
@@ -1605,6 +1620,29 @@ void CSerialPort::writeNXDNLost()
#endif
#if defined(MODE_M17)
void CSerialPort::writeM17Header(const uint8_t* data, uint8_t length)
{
if (m_modemState != STATE_M17 && m_modemState != STATE_IDLE)
return;
if (!m_m17Enable)
return;
uint8_t reply[130U];
reply[0U] = MMDVM_FRAME_START;
reply[1U] = 0U;
reply[2U] = MMDVM_M17_HEADER;
uint8_t count = 3U;
for (uint8_t i = 0U; i < length; i++, count++)
reply[count] = data[i];
reply[1U] = count;
writeInt(1U, reply, count);
}
void CSerialPort::writeM17Data(const uint8_t* data, uint8_t length)
{
if (m_modemState != STATE_M17 && m_modemState != STATE_IDLE)