mirror of https://github.com/g4klx/MMDVM.git
Rename FMDownsampler to FMDownSampler.
This commit is contained in:
parent
52a351d0f1
commit
14d5098018
12
FM.cpp
12
FM.cpp
|
@ -54,7 +54,7 @@ m_useCOS(true),
|
||||||
m_cosInvert(false),
|
m_cosInvert(false),
|
||||||
m_rfAudioBoost(1U),
|
m_rfAudioBoost(1U),
|
||||||
m_extAudioBoost(1U),
|
m_extAudioBoost(1U),
|
||||||
m_downsampler(400U),// 100 ms of audio
|
m_downSampler(400U),// 100 ms of audio
|
||||||
m_extEnabled(false),
|
m_extEnabled(false),
|
||||||
m_rxLevel(1),
|
m_rxLevel(1),
|
||||||
m_inputRFRB(2401U), // 100ms of audio + 1 sample
|
m_inputRFRB(2401U), // 100ms of audio + 1 sample
|
||||||
|
@ -120,7 +120,7 @@ void CFM::samples(bool cos, q15_t* samples, uint8_t length)
|
||||||
if (m_state == FS_RELAYING_RF || m_state == FS_KERCHUNK_RF || m_state == FS_RELAYING_EXT || m_state == FS_KERCHUNK_EXT) {
|
if (m_state == FS_RELAYING_RF || m_state == FS_KERCHUNK_RF || m_state == FS_RELAYING_EXT || m_state == FS_KERCHUNK_EXT) {
|
||||||
currentSample = m_blanking.process(currentSample);
|
currentSample = m_blanking.process(currentSample);
|
||||||
if (m_extEnabled && (m_state == FS_RELAYING_RF || m_state == FS_KERCHUNK_RF))
|
if (m_extEnabled && (m_state == FS_RELAYING_RF || m_state == FS_KERCHUNK_RF))
|
||||||
m_downsampler.addSample(currentSample);
|
m_downSampler.addSample(currentSample);
|
||||||
|
|
||||||
currentSample *= currentBoost;
|
currentSample *= currentBoost;
|
||||||
} else {
|
} else {
|
||||||
|
@ -177,7 +177,7 @@ void CFM::process()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_extEnabled) {
|
if (m_extEnabled) {
|
||||||
uint16_t length = m_downsampler.getData();
|
uint16_t length = m_downSampler.getData();
|
||||||
|
|
||||||
if (length >= FM_SERIAL_BLOCK_SIZE) {
|
if (length >= FM_SERIAL_BLOCK_SIZE) {
|
||||||
if (length > FM_SERIAL_BLOCK_SIZE)
|
if (length > FM_SERIAL_BLOCK_SIZE)
|
||||||
|
@ -186,7 +186,7 @@ void CFM::process()
|
||||||
TSamplePairPack serialSamples[FM_SERIAL_BLOCK_SIZE];
|
TSamplePairPack serialSamples[FM_SERIAL_BLOCK_SIZE];
|
||||||
|
|
||||||
for (uint16_t j = 0U; j < length; j++)
|
for (uint16_t j = 0U; j < length; j++)
|
||||||
m_downsampler.getPackedData(serialSamples[j]);
|
m_downSampler.getPackedData(serialSamples[j]);
|
||||||
|
|
||||||
serial.writeFMData((uint8_t*)serialSamples, length * sizeof(TSamplePairPack));
|
serial.writeFMData((uint8_t*)serialSamples, length * sizeof(TSamplePairPack));
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ void CFM::reset()
|
||||||
m_outputRFRB.reset();
|
m_outputRFRB.reset();
|
||||||
m_inputExtRB.reset();
|
m_inputExtRB.reset();
|
||||||
|
|
||||||
m_downsampler.reset();
|
m_downSampler.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t CFM::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 CFM::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)
|
||||||
|
@ -325,7 +325,7 @@ void CFM::stateMachine(bool validRFSignal, bool validExtSignal)
|
||||||
|
|
||||||
if (m_state == FS_LISTENING && !m_rfAck.isWanted() && !m_extAck.isWanted() && !m_callsign.isWanted()) {
|
if (m_state == FS_LISTENING && !m_rfAck.isWanted() && !m_extAck.isWanted() && !m_callsign.isWanted()) {
|
||||||
m_outputRFRB.reset();
|
m_outputRFRB.reset();
|
||||||
m_downsampler.reset();
|
m_downSampler.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
FM.h
4
FM.h
|
@ -29,7 +29,7 @@
|
||||||
#include "FMTimer.h"
|
#include "FMTimer.h"
|
||||||
#include "RingBuffer.h"
|
#include "RingBuffer.h"
|
||||||
#include "FMDirectForm1.h"
|
#include "FMDirectForm1.h"
|
||||||
#include "FMDownsampler.h"
|
#include "FMDownSampler.h"
|
||||||
#include "FMUpSampler.h"
|
#include "FMUpSampler.h"
|
||||||
|
|
||||||
enum FM_STATE {
|
enum FM_STATE {
|
||||||
|
@ -95,7 +95,7 @@ private:
|
||||||
bool m_cosInvert;
|
bool m_cosInvert;
|
||||||
q15_t m_rfAudioBoost;
|
q15_t m_rfAudioBoost;
|
||||||
q15_t m_extAudioBoost;
|
q15_t m_extAudioBoost;
|
||||||
CFMDownsampler m_downsampler;
|
CFMDownSampler m_downSampler;
|
||||||
bool m_extEnabled;
|
bool m_extEnabled;
|
||||||
q15_t m_rxLevel;
|
q15_t m_rxLevel;
|
||||||
CRingBuffer<q15_t> m_inputRFRB;
|
CRingBuffer<q15_t> m_inputRFRB;
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "FMDownsampler.h"
|
#include "FMDownSampler.h"
|
||||||
|
|
||||||
CFMDownsampler::CFMDownsampler(uint16_t length) :
|
CFMDownSampler::CFMDownSampler(uint16_t length) :
|
||||||
m_ringBuffer(length),
|
m_ringBuffer(length),
|
||||||
m_samplePack(0U),
|
m_samplePack(0U),
|
||||||
m_samplePackPointer(NULL),
|
m_samplePackPointer(NULL),
|
||||||
|
@ -29,7 +29,7 @@ m_sampleIndex(0U)
|
||||||
m_samplePackPointer = (uint8_t*)&m_samplePack;
|
m_samplePackPointer = (uint8_t*)&m_samplePack;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFMDownsampler::addSample(q15_t sample)
|
void CFMDownSampler::addSample(q15_t sample)
|
||||||
{
|
{
|
||||||
uint32_t usample = uint32_t(int32_t(sample) + 2048);
|
uint32_t usample = uint32_t(int32_t(sample) + 2048);
|
||||||
//only take one of three samples
|
//only take one of three samples
|
||||||
|
@ -54,21 +54,21 @@ void CFMDownsampler::addSample(q15_t sample)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sampleIndex++;
|
m_sampleIndex++;
|
||||||
if(m_sampleIndex >= 6U)//did we pack two samples ?
|
if (m_sampleIndex >= 6U)//did we pack two samples ?
|
||||||
m_sampleIndex = 0U;
|
m_sampleIndex = 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFMDownsampler::getPackedData(TSamplePairPack& data)
|
bool CFMDownSampler::getPackedData(TSamplePairPack& data)
|
||||||
{
|
{
|
||||||
return m_ringBuffer.get(data);
|
return m_ringBuffer.get(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t CFMDownsampler::getData()
|
uint16_t CFMDownSampler::getData()
|
||||||
{
|
{
|
||||||
return m_ringBuffer.getData();
|
return m_ringBuffer.getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFMDownsampler::reset()
|
void CFMDownSampler::reset()
|
||||||
{
|
{
|
||||||
m_sampleIndex = 0U;
|
m_sampleIndex = 0U;
|
||||||
}
|
}
|
|
@ -24,12 +24,16 @@
|
||||||
#include "RingBuffer.h"
|
#include "RingBuffer.h"
|
||||||
#include "FMSamplePairPack.h"
|
#include "FMSamplePairPack.h"
|
||||||
|
|
||||||
class CFMDownsampler {
|
class CFMDownSampler {
|
||||||
public:
|
public:
|
||||||
CFMDownsampler(uint16_t length);
|
CFMDownSampler(uint16_t length);
|
||||||
|
|
||||||
void addSample(q15_t sample);
|
void addSample(q15_t sample);
|
||||||
|
|
||||||
bool getPackedData(TSamplePairPack& data);
|
bool getPackedData(TSamplePairPack& data);
|
||||||
|
|
||||||
uint16_t getData();
|
uint16_t getData();
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -40,3 +44,4 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -109,7 +109,7 @@ const uint8_t MMDVM_DEBUG5 = 0xF5U;
|
||||||
#define HW_TYPE "MMDVM"
|
#define HW_TYPE "MMDVM"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DESCRIPTION "20200629 (D-Star/DMR/System Fusion/P25/NXDN/POCSAG/FM/AX.25)"
|
#define DESCRIPTION "20200630 (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 ""
|
||||||
|
|
Loading…
Reference in New Issue