mirror of https://github.com/g4klx/MMDVM.git
More work on adding AX.25 decoding.
This commit is contained in:
parent
64fe59382f
commit
e1d1ac4a4d
|
@ -20,12 +20,22 @@
|
|||
#include "Globals.h"
|
||||
#include "AX25Demodulator.h"
|
||||
|
||||
CAX25Demodulator::CAX25Demodulator(uint16_t n) :
|
||||
m_n(n)
|
||||
CAX25Demodulator::CAX25Demodulator() :
|
||||
m_nrziState(false)
|
||||
{
|
||||
}
|
||||
|
||||
void CAX25Demodulator::process(q15_t sample)
|
||||
bool CAX25Demodulator::process(const q15_t* samples, uint8_t length, AX25Frame& frame)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CAX25Demodulator::NRZI(bool b)
|
||||
{
|
||||
bool result = (b == m_nrziState);
|
||||
|
||||
m_nrziState = b;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,14 +21,22 @@
|
|||
|
||||
#include "Config.h"
|
||||
|
||||
struct AX25Frame {
|
||||
uint8_t m_data[300U];
|
||||
uint16_t m_length;
|
||||
uint16_t m_fcs;
|
||||
};
|
||||
|
||||
class CAX25Demodulator {
|
||||
public:
|
||||
CAX25Demodulator(uint16_t n);
|
||||
CAX25Demodulator();
|
||||
|
||||
void process(q15_t sample);
|
||||
bool process(const q15_t* samples, uint8_t length, AX25Frame& frame);
|
||||
|
||||
private:
|
||||
uint16_t m_n;
|
||||
bool m_nrziState;
|
||||
|
||||
bool NRZI(bool b);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
38
AX25RX.cpp
38
AX25RX.cpp
|
@ -21,20 +21,42 @@
|
|||
#include "AX25RX.h"
|
||||
|
||||
CAX25RX::CAX25RX() :
|
||||
m_demod1(1U),
|
||||
m_demod2(2U),
|
||||
m_demod3(3U)
|
||||
m_demod1(),
|
||||
m_demod2(),
|
||||
m_demod3(),
|
||||
m_lastFCS(0U)
|
||||
{
|
||||
}
|
||||
|
||||
void CAX25RX::samples(const q15_t* samples, uint8_t length)
|
||||
{
|
||||
for (uint8_t i = 0U; i < length; i++) {
|
||||
q15_t sample = samples[i];
|
||||
AX25Frame frame;
|
||||
|
||||
m_demod1.process(sample);
|
||||
m_demod2.process(sample);
|
||||
m_demod3.process(sample);
|
||||
bool ret = m_demod1.process(samples, length, frame);
|
||||
if (ret) {
|
||||
if (m_lastFCS != frame.m_fcs) {
|
||||
DEBUG1("Decoder 1 reported");
|
||||
m_lastFCS = frame.m_fcs;
|
||||
serial.writeAX25Data(frame.m_data, frame.m_length);
|
||||
}
|
||||
}
|
||||
|
||||
ret = m_demod2.process(samples, length, frame);
|
||||
if (ret) {
|
||||
if (m_lastFCS != frame.m_fcs) {
|
||||
DEBUG1("Decoder 2 reported");
|
||||
m_lastFCS = frame.m_fcs;
|
||||
serial.writeAX25Data(frame.m_data, frame.m_length);
|
||||
}
|
||||
}
|
||||
|
||||
ret = m_demod3.process(samples, length, frame);
|
||||
if (ret) {
|
||||
if (m_lastFCS != frame.m_fcs) {
|
||||
DEBUG1("Decoder 3 reported");
|
||||
m_lastFCS = frame.m_fcs;
|
||||
serial.writeAX25Data(frame.m_data, frame.m_length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue