Merge branch 'FM' into dstar_correlator_fm

This commit is contained in:
Jonathan Naylor 2020-05-06 11:35:06 +01:00
commit 6769a6a0d7
3 changed files with 15 additions and 6 deletions

13
FM.cpp
View File

@ -44,6 +44,7 @@ m_preemphasis(32768, 13967, 0, 32768, -18801, 0),//75µS 24kHz sampling rate
m_deemphasis (32768, -18801, 0, 32768, 13967, 0),//75µS 24kHz sampling rate m_deemphasis (32768, -18801, 0, 32768, 13967, 0),//75µS 24kHz sampling rate
m_blanking(), m_blanking(),
m_useCOS(true), m_useCOS(true),
m_cosInvert(false),
m_rfAudioBoost(1U), m_rfAudioBoost(1U),
m_downsampler(128)//Size might need adjustement m_downsampler(128)//Size might need adjustement
{ {
@ -51,8 +52,12 @@ m_downsampler(128)//Size might need adjustement
void CFM::samples(bool cos, q15_t* samples, uint8_t length) void CFM::samples(bool cos, q15_t* samples, uint8_t length)
{ {
if (!m_useCOS) if (m_useCOS) {
if (m_cosInvert)
cos = !cos;
} else {
cos = true; cos = true;
}
clock(length); clock(length);
@ -169,9 +174,11 @@ uint8_t CFM::setAck(const char* rfAck, uint8_t speed, uint16_t frequency, uint8_
return m_rfAck.setParams(rfAck, speed, frequency, level, level); return m_rfAck.setParams(rfAck, speed, frequency, level, level);
} }
uint8_t CFM::setMisc(uint16_t timeout, uint8_t timeoutLevel, uint8_t ctcssFrequency, uint8_t ctcssThreshold, uint8_t ctcssLevel, uint8_t kerchunkTime, uint8_t hangTime, bool useCOS, uint8_t rfAudioBoost, uint8_t maxDev, uint8_t rxLevel) uint8_t CFM::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)
{ {
m_useCOS = useCOS; m_useCOS = useCOS;
m_cosInvert = cosInvert;
m_rfAudioBoost = q15_t(rfAudioBoost); m_rfAudioBoost = q15_t(rfAudioBoost);
m_timeoutTimer.setTimeout(timeout, 0U); m_timeoutTimer.setTimeout(timeout, 0U);

3
FM.h
View File

@ -55,7 +55,7 @@ public:
uint8_t setCallsign(const char* callsign, uint8_t speed, uint16_t frequency, uint8_t time, uint8_t holdoff, uint8_t highLevel, uint8_t lowLevel, bool callsignAtStart, bool callsignAtEnd, bool callsignAtLatch); uint8_t setCallsign(const char* callsign, uint8_t speed, uint16_t frequency, uint8_t time, uint8_t holdoff, uint8_t highLevel, uint8_t lowLevel, bool callsignAtStart, bool callsignAtEnd, bool callsignAtLatch);
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, 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);
private: private:
CFMKeyer m_callsign; CFMKeyer m_callsign;
@ -81,6 +81,7 @@ private:
CFMDirectFormI m_deemphasis; CFMDirectFormI m_deemphasis;
CFMBlanking m_blanking; CFMBlanking m_blanking;
bool m_useCOS; bool m_useCOS;
bool m_cosInvert;
q15_t m_rfAudioBoost; q15_t m_rfAudioBoost;
CFMDownsampler m_downsampler; CFMDownsampler m_downsampler;

View File

@ -101,7 +101,7 @@ const uint8_t MMDVM_DEBUG5 = 0xF5U;
#define HW_TYPE "MMDVM" #define HW_TYPE "MMDVM"
#endif #endif
#define DESCRIPTION "20200504 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM)" #define DESCRIPTION "20200506 (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 ""
@ -423,12 +423,13 @@ uint8_t CSerialPort::setFMParams3(const uint8_t* data, uint8_t length)
uint8_t hangTime = data[6U]; uint8_t hangTime = data[6U];
bool useCOS = (data[7U] & 0x01U) == 0x01U; bool useCOS = (data[7U] & 0x01U) == 0x01U;
bool cosInvert = (data[7U] & 0x02U) == 0x02U;
uint8_t rfAudioBoost = data[8U]; uint8_t rfAudioBoost = data[8U];
uint8_t maxDev = data[9U]; uint8_t maxDev = data[9U];
uint8_t rxLevel = data[10U]; uint8_t rxLevel = data[10U];
return fm.setMisc(timeout, timeoutLevel, ctcssFrequency, ctcssThreshold, ctcssLevel, kerchunkTime, hangTime, useCOS, rfAudioBoost, maxDev, rxLevel); return fm.setMisc(timeout, timeoutLevel, ctcssFrequency, ctcssThreshold, ctcssLevel, kerchunkTime, hangTime, useCOS, cosInvert, rfAudioBoost, maxDev, rxLevel);
} }
uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length) uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length)