mirror of https://github.com/g4klx/MMDVM.git
Beginnings of external audio for the FM controller.
This commit is contained in:
parent
eb9c0dfd93
commit
a816818e3f
4
FM.h
4
FM.h
|
@ -57,6 +57,10 @@ public:
|
||||||
uint8_t setAck(const char* rfAck, uint8_t speed, uint16_t frequency, uint8_t minTime, uint16_t delay, uint8_t level);
|
uint8_t setAck(const char* rfAck, uint8_t speed, uint16_t frequency, uint8_t minTime, uint16_t delay, uint8_t level);
|
||||||
uint8_t setMisc(uint16_t timeout, uint8_t timeoutLevel, uint8_t ctcssFrequency, uint8_t ctcssThreshold, uint8_t ctcssLevel, uint8_t kerchunkTime, uint8_t hangTime, bool useCOS, bool cosInvert, uint8_t rfAudioBoost, uint8_t maxDev, uint8_t rxLevel);
|
uint8_t setMisc(uint16_t timeout, uint8_t timeoutLevel, uint8_t ctcssFrequency, uint8_t ctcssThreshold, uint8_t ctcssLevel, uint8_t kerchunkTime, uint8_t hangTime, bool useCOS, bool cosInvert, uint8_t rfAudioBoost, uint8_t maxDev, uint8_t rxLevel);
|
||||||
|
|
||||||
|
uint8_t getSpace() const;
|
||||||
|
|
||||||
|
uint8_t writeData(const uint8_t* data, uint8_t length);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CFMKeyer m_callsign;
|
CFMKeyer m_callsign;
|
||||||
CFMKeyer m_rfAck;
|
CFMKeyer m_rfAck;
|
||||||
|
|
|
@ -68,6 +68,7 @@ const uint8_t MMDVM_POCSAG_DATA = 0x50U;
|
||||||
const uint8_t MMDVM_FM_PARAMS1 = 0x60U;
|
const uint8_t MMDVM_FM_PARAMS1 = 0x60U;
|
||||||
const uint8_t MMDVM_FM_PARAMS2 = 0x61U;
|
const uint8_t MMDVM_FM_PARAMS2 = 0x61U;
|
||||||
const uint8_t MMDVM_FM_PARAMS3 = 0x62U;
|
const uint8_t MMDVM_FM_PARAMS3 = 0x62U;
|
||||||
|
const uint8_t MMDVM_FM_DATA = 0x65U;
|
||||||
|
|
||||||
const uint8_t MMDVM_ACK = 0x70U;
|
const uint8_t MMDVM_ACK = 0x70U;
|
||||||
const uint8_t MMDVM_NAK = 0x7FU;
|
const uint8_t MMDVM_NAK = 0x7FU;
|
||||||
|
@ -101,7 +102,7 @@ const uint8_t MMDVM_DEBUG5 = 0xF5U;
|
||||||
#define HW_TYPE "MMDVM"
|
#define HW_TYPE "MMDVM"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DESCRIPTION "20200506 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM)"
|
#define DESCRIPTION "20200507 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM)"
|
||||||
|
|
||||||
#if defined(GITVERSION)
|
#if defined(GITVERSION)
|
||||||
#define concat(h, a, b, c) h " " a " " b " GitID #" c ""
|
#define concat(h, a, b, c) h " " a " " b " GitID #" c ""
|
||||||
|
@ -156,7 +157,7 @@ void CSerialPort::getStatus()
|
||||||
|
|
||||||
// Send all sorts of interesting internal values
|
// Send all sorts of interesting internal values
|
||||||
reply[0U] = MMDVM_FRAME_START;
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
reply[1U] = 13U;
|
reply[1U] = 14U;
|
||||||
reply[2U] = MMDVM_GET_STATUS;
|
reply[2U] = MMDVM_GET_STATUS;
|
||||||
|
|
||||||
reply[3U] = 0x00U;
|
reply[3U] = 0x00U;
|
||||||
|
@ -238,7 +239,12 @@ void CSerialPort::getStatus()
|
||||||
else
|
else
|
||||||
reply[12U] = 0U;
|
reply[12U] = 0U;
|
||||||
|
|
||||||
writeInt(1U, reply, 13);
|
if (m_fmEnable)
|
||||||
|
reply[13U] = fm.getSpace();
|
||||||
|
else
|
||||||
|
reply[13U] = 0U;
|
||||||
|
|
||||||
|
writeInt(1U, reply, 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSerialPort::getVersion()
|
void CSerialPort::getVersion()
|
||||||
|
@ -876,6 +882,20 @@ void CSerialPort::process()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MMDVM_FM_DATA:
|
||||||
|
if (m_fmEnable) {
|
||||||
|
if (m_modemState == STATE_IDLE || m_modemState == STATE_FM)
|
||||||
|
err = fm.writeData(m_buffer + 3U, m_len - 3U);
|
||||||
|
}
|
||||||
|
if (err == 0U) {
|
||||||
|
if (m_modemState == STATE_IDLE)
|
||||||
|
setMode(STATE_FM);
|
||||||
|
} else {
|
||||||
|
DEBUG2("Received invalid FM data", err);
|
||||||
|
sendNAK(err);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case MMDVM_TRANSPARENT:
|
case MMDVM_TRANSPARENT:
|
||||||
case MMDVM_QSO_INFO:
|
case MMDVM_QSO_INFO:
|
||||||
// Do nothing on the MMDVM.
|
// Do nothing on the MMDVM.
|
||||||
|
@ -1188,6 +1208,29 @@ void CSerialPort::writeNXDNLost()
|
||||||
writeInt(1U, reply, 3);
|
writeInt(1U, reply, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSerialPort::writeFMData(const uint8_t* data, uint8_t length)
|
||||||
|
{
|
||||||
|
if (m_modemState != STATE_FM && m_modemState != STATE_IDLE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!m_fmEnable)
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint8_t reply[130U];
|
||||||
|
|
||||||
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
|
reply[1U] = 0U;
|
||||||
|
reply[2U] = MMDVM_FM_DATA;
|
||||||
|
|
||||||
|
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::writeCalData(const uint8_t* data, uint8_t length)
|
void CSerialPort::writeCalData(const uint8_t* data, uint8_t length)
|
||||||
{
|
{
|
||||||
if (m_modemState != STATE_DSTARCAL)
|
if (m_modemState != STATE_DSTARCAL)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2017,2018,2020 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -50,6 +50,8 @@ public:
|
||||||
void writeNXDNData(const uint8_t* data, uint8_t length);
|
void writeNXDNData(const uint8_t* data, uint8_t length);
|
||||||
void writeNXDNLost();
|
void writeNXDNLost();
|
||||||
|
|
||||||
|
void writeFMData(const uint8_t* data, uint8_t length);
|
||||||
|
|
||||||
void writeCalData(const uint8_t* data, uint8_t length);
|
void writeCalData(const uint8_t* data, uint8_t length);
|
||||||
void writeRSSIData(const uint8_t* data, uint8_t length);
|
void writeRSSIData(const uint8_t* data, uint8_t length);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue