mirror of https://github.com/g4klx/MMDVM.git
Begin AX.25 development.
This commit is contained in:
parent
598d32287d
commit
a2e2853241
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "Globals.h"
|
||||||
|
#include "AX25RX.h"
|
||||||
|
|
||||||
|
CAX25RX::CAX25RX()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAX25RX::samples(const q15_t* samples, uint8_t length)
|
||||||
|
{
|
||||||
|
for (uint8_t i = 0U; i < length; i++) {
|
||||||
|
q15_t sample = samples[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(AX25RX_H)
|
||||||
|
#define AX25RX_H
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
|
class CAX25RX {
|
||||||
|
public:
|
||||||
|
CAX25RX();
|
||||||
|
|
||||||
|
void samples(const q15_t* samples, uint8_t length);
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
2
Config.h
2
Config.h
|
@ -39,7 +39,7 @@
|
||||||
// #define USE_COS_AS_LOCKOUT
|
// #define USE_COS_AS_LOCKOUT
|
||||||
|
|
||||||
// Use pins to output the current mode via LEDs
|
// Use pins to output the current mode via LEDs
|
||||||
// #define MODE_LEDS
|
#define MODE_LEDS
|
||||||
|
|
||||||
// For the original Arduino Due pin layout
|
// For the original Arduino Due pin layout
|
||||||
// #define ARDUINO_DUE_PAPA
|
// #define ARDUINO_DUE_PAPA
|
||||||
|
|
|
@ -51,6 +51,7 @@ enum MMDVM_STATE {
|
||||||
STATE_NXDN = 5,
|
STATE_NXDN = 5,
|
||||||
STATE_POCSAG = 6,
|
STATE_POCSAG = 6,
|
||||||
STATE_FM = 10,
|
STATE_FM = 10,
|
||||||
|
STATE_AX25 = 11,
|
||||||
|
|
||||||
// Dummy states start at 90
|
// Dummy states start at 90
|
||||||
STATE_NXDNCAL1K = 91,
|
STATE_NXDNCAL1K = 91,
|
||||||
|
@ -96,6 +97,7 @@ enum MMDVM_STATE {
|
||||||
#include "CalPOCSAG.h"
|
#include "CalPOCSAG.h"
|
||||||
#include "CalRSSI.h"
|
#include "CalRSSI.h"
|
||||||
#include "CWIdTX.h"
|
#include "CWIdTX.h"
|
||||||
|
#include "AX25RX.h"
|
||||||
#include "Debug.h"
|
#include "Debug.h"
|
||||||
#include "IO.h"
|
#include "IO.h"
|
||||||
#include "FM.h"
|
#include "FM.h"
|
||||||
|
@ -124,6 +126,7 @@ extern bool m_p25Enable;
|
||||||
extern bool m_nxdnEnable;
|
extern bool m_nxdnEnable;
|
||||||
extern bool m_pocsagEnable;
|
extern bool m_pocsagEnable;
|
||||||
extern bool m_fmEnable;
|
extern bool m_fmEnable;
|
||||||
|
extern bool m_ax25Enable;
|
||||||
|
|
||||||
extern bool m_duplex;
|
extern bool m_duplex;
|
||||||
|
|
||||||
|
@ -154,7 +157,8 @@ extern CNXDNTX nxdnTX;
|
||||||
|
|
||||||
extern CPOCSAGTX pocsagTX;
|
extern CPOCSAGTX pocsagTX;
|
||||||
|
|
||||||
extern CFM fm;
|
extern CFM fm;
|
||||||
|
extern CAX25RX ax25RX;
|
||||||
|
|
||||||
extern CCalDStarRX calDStarRX;
|
extern CCalDStarRX calDStarRX;
|
||||||
extern CCalDStarTX calDStarTX;
|
extern CCalDStarTX calDStarTX;
|
||||||
|
@ -168,3 +172,4 @@ extern CCalRSSI calRSSI;
|
||||||
extern CCWIdTX cwIdTX;
|
extern CCWIdTX cwIdTX;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
12
IO.cpp
12
IO.cpp
|
@ -362,6 +362,14 @@ void CIO::process()
|
||||||
fm.samples(cos, dcSamples, RX_BLOCK_SIZE);
|
fm.samples(cos, dcSamples, RX_BLOCK_SIZE);
|
||||||
#else
|
#else
|
||||||
fm.samples(cos, samples, RX_BLOCK_SIZE);
|
fm.samples(cos, samples, RX_BLOCK_SIZE);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_ax25Enable) {
|
||||||
|
#if defined(USE_DCBLOCKER)
|
||||||
|
ax25RX.samples(dcSamples, RX_BLOCK_SIZE);
|
||||||
|
#else
|
||||||
|
ax25RX.samples(samples, RX_BLOCK_SIZE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} else if (m_modemState == STATE_DSTAR) {
|
} else if (m_modemState == STATE_DSTAR) {
|
||||||
|
@ -426,8 +434,12 @@ void CIO::process()
|
||||||
bool cos = getCOSInt();
|
bool cos = getCOSInt();
|
||||||
#if defined(USE_DCBLOCKER)
|
#if defined(USE_DCBLOCKER)
|
||||||
fm.samples(cos, dcSamples, RX_BLOCK_SIZE);
|
fm.samples(cos, dcSamples, RX_BLOCK_SIZE);
|
||||||
|
if (m_ax25Enable)
|
||||||
|
ax25RX.samples(dcSamples, RX_BLOCK_SIZE);
|
||||||
#else
|
#else
|
||||||
fm.samples(cos, samples, RX_BLOCK_SIZE);
|
fm.samples(cos, samples, RX_BLOCK_SIZE);
|
||||||
|
if (m_ax25Enable)
|
||||||
|
ax25RX.samples(samples, RX_BLOCK_SIZE);
|
||||||
#endif
|
#endif
|
||||||
} else if (m_modemState == STATE_DSTARCAL) {
|
} else if (m_modemState == STATE_DSTARCAL) {
|
||||||
q15_t GMSKVals[RX_BLOCK_SIZE];
|
q15_t GMSKVals[RX_BLOCK_SIZE];
|
||||||
|
|
|
@ -33,6 +33,7 @@ bool m_p25Enable = true;
|
||||||
bool m_nxdnEnable = true;
|
bool m_nxdnEnable = true;
|
||||||
bool m_pocsagEnable = true;
|
bool m_pocsagEnable = true;
|
||||||
bool m_fmEnable = true;
|
bool m_fmEnable = true;
|
||||||
|
bool m_ax25Enable = true;
|
||||||
|
|
||||||
bool m_duplex = true;
|
bool m_duplex = true;
|
||||||
|
|
||||||
|
@ -61,6 +62,7 @@ CNXDNTX nxdnTX;
|
||||||
CPOCSAGTX pocsagTX;
|
CPOCSAGTX pocsagTX;
|
||||||
|
|
||||||
CFM fm;
|
CFM fm;
|
||||||
|
CAX25RX ax25RX;
|
||||||
|
|
||||||
CCalDStarRX calDStarRX;
|
CCalDStarRX calDStarRX;
|
||||||
CCalDStarTX calDStarTX;
|
CCalDStarTX calDStarTX;
|
||||||
|
|
|
@ -30,6 +30,7 @@ bool m_p25Enable = true;
|
||||||
bool m_nxdnEnable = true;
|
bool m_nxdnEnable = true;
|
||||||
bool m_pocsagEnable = true;
|
bool m_pocsagEnable = true;
|
||||||
bool m_fmEnable = true;
|
bool m_fmEnable = true;
|
||||||
|
bool m_ax25Enable = true;
|
||||||
|
|
||||||
bool m_duplex = true;
|
bool m_duplex = true;
|
||||||
|
|
||||||
|
@ -58,6 +59,7 @@ CNXDNTX nxdnTX;
|
||||||
CPOCSAGTX pocsagTX;
|
CPOCSAGTX pocsagTX;
|
||||||
|
|
||||||
CFM fm;
|
CFM fm;
|
||||||
|
CAX25RX ax25RX;
|
||||||
|
|
||||||
CCalDStarRX calDStarRX;
|
CCalDStarRX calDStarRX;
|
||||||
CCalDStarTX calDStarTX;
|
CCalDStarTX calDStarTX;
|
||||||
|
|
|
@ -65,6 +65,8 @@ const uint8_t MMDVM_NXDN_LOST = 0x41U;
|
||||||
|
|
||||||
const uint8_t MMDVM_POCSAG_DATA = 0x50U;
|
const uint8_t MMDVM_POCSAG_DATA = 0x50U;
|
||||||
|
|
||||||
|
const uint8_t MMDVM_AX25_DATA = 0x55U;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -103,7 +105,7 @@ const uint8_t MMDVM_DEBUG5 = 0xF5U;
|
||||||
#define HW_TYPE "MMDVM"
|
#define HW_TYPE "MMDVM"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DESCRIPTION "20200520 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM)"
|
#define DESCRIPTION "20200608 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM/AX.25)"
|
||||||
|
|
||||||
#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 ""
|
||||||
|
@ -176,6 +178,8 @@ void CSerialPort::getStatus()
|
||||||
reply[3U] |= 0x20U;
|
reply[3U] |= 0x20U;
|
||||||
if (m_fmEnable)
|
if (m_fmEnable)
|
||||||
reply[3U] |= 0x40U;
|
reply[3U] |= 0x40U;
|
||||||
|
if (m_ax25Enable)
|
||||||
|
reply[3U] |= 0x80U;
|
||||||
|
|
||||||
reply[4U] = uint8_t(m_modemState);
|
reply[4U] = uint8_t(m_modemState);
|
||||||
|
|
||||||
|
@ -282,6 +286,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
||||||
bool nxdnEnable = (data[1U] & 0x10U) == 0x10U;
|
bool nxdnEnable = (data[1U] & 0x10U) == 0x10U;
|
||||||
bool pocsagEnable = (data[1U] & 0x20U) == 0x20U;
|
bool pocsagEnable = (data[1U] & 0x20U) == 0x20U;
|
||||||
bool fmEnable = (data[1U] & 0x40U) == 0x40U;
|
bool fmEnable = (data[1U] & 0x40U) == 0x40U;
|
||||||
|
bool ax25Enable = (data[1U] & 0x80U) == 0x80U;
|
||||||
|
|
||||||
uint8_t txDelay = data[2U];
|
uint8_t txDelay = data[2U];
|
||||||
if (txDelay > 50U)
|
if (txDelay > 50U)
|
||||||
|
@ -344,6 +349,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
||||||
m_nxdnEnable = nxdnEnable;
|
m_nxdnEnable = nxdnEnable;
|
||||||
m_pocsagEnable = pocsagEnable;
|
m_pocsagEnable = pocsagEnable;
|
||||||
m_fmEnable = fmEnable;
|
m_fmEnable = fmEnable;
|
||||||
|
m_ax25Enable = ax25Enable;
|
||||||
m_duplex = !simplex;
|
m_duplex = !simplex;
|
||||||
|
|
||||||
dstarTX.setTXDelay(txDelay);
|
dstarTX.setTXDelay(txDelay);
|
||||||
|
@ -1197,6 +1203,29 @@ void CSerialPort::writeNXDNLost()
|
||||||
writeInt(1U, reply, 3);
|
writeInt(1U, reply, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSerialPort::writeAX25Data(const uint8_t* data, uint8_t length)
|
||||||
|
{
|
||||||
|
if (m_modemState != STATE_FM && m_modemState != STATE_IDLE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!m_ax25Enable)
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint8_t reply[300U];
|
||||||
|
|
||||||
|
reply[0U] = MMDVM_FRAME_START;
|
||||||
|
reply[1U] = 0U;
|
||||||
|
reply[2U] = MMDVM_AX25_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 writeAX25Data(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