Rename FMDownsampler to FMDownSampler.

This commit is contained in:
Jonathan Naylor 2020-06-30 12:44:02 +01:00
parent 52a351d0f1
commit 14d5098018
5 changed files with 24 additions and 19 deletions

12
FM.cpp
View File

@ -54,7 +54,7 @@ m_useCOS(true),
m_cosInvert(false),
m_rfAudioBoost(1U),
m_extAudioBoost(1U),
m_downsampler(400U),// 100 ms of audio
m_downSampler(400U),// 100 ms of audio
m_extEnabled(false),
m_rxLevel(1),
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) {
currentSample = m_blanking.process(currentSample);
if (m_extEnabled && (m_state == FS_RELAYING_RF || m_state == FS_KERCHUNK_RF))
m_downsampler.addSample(currentSample);
m_downSampler.addSample(currentSample);
currentSample *= currentBoost;
} else {
@ -177,7 +177,7 @@ void CFM::process()
}
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)
@ -186,7 +186,7 @@ void CFM::process()
TSamplePairPack serialSamples[FM_SERIAL_BLOCK_SIZE];
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));
}
@ -214,7 +214,7 @@ void CFM::reset()
m_outputRFRB.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)
@ -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()) {
m_outputRFRB.reset();
m_downsampler.reset();
m_downSampler.reset();
}
}

4
FM.h
View File

@ -29,7 +29,7 @@
#include "FMTimer.h"
#include "RingBuffer.h"
#include "FMDirectForm1.h"
#include "FMDownsampler.h"
#include "FMDownSampler.h"
#include "FMUpSampler.h"
enum FM_STATE {
@ -95,7 +95,7 @@ private:
bool m_cosInvert;
q15_t m_rfAudioBoost;
q15_t m_extAudioBoost;
CFMDownsampler m_downsampler;
CFMDownSampler m_downSampler;
bool m_extEnabled;
q15_t m_rxLevel;
CRingBuffer<q15_t> m_inputRFRB;

View File

@ -18,9 +18,9 @@
*/
#include "Config.h"
#include "FMDownsampler.h"
#include "FMDownSampler.h"
CFMDownsampler::CFMDownsampler(uint16_t length) :
CFMDownSampler::CFMDownSampler(uint16_t length) :
m_ringBuffer(length),
m_samplePack(0U),
m_samplePackPointer(NULL),
@ -29,7 +29,7 @@ m_sampleIndex(0U)
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);
//only take one of three samples
@ -54,21 +54,21 @@ void CFMDownsampler::addSample(q15_t sample)
}
m_sampleIndex++;
if(m_sampleIndex >= 6U)//did we pack two samples ?
if (m_sampleIndex >= 6U)//did we pack two samples ?
m_sampleIndex = 0U;
}
bool CFMDownsampler::getPackedData(TSamplePairPack& data)
bool CFMDownSampler::getPackedData(TSamplePairPack& data)
{
return m_ringBuffer.get(data);
}
uint16_t CFMDownsampler::getData()
uint16_t CFMDownSampler::getData()
{
return m_ringBuffer.getData();
}
void CFMDownsampler::reset()
void CFMDownSampler::reset()
{
m_sampleIndex = 0U;
}

View File

@ -24,12 +24,16 @@
#include "RingBuffer.h"
#include "FMSamplePairPack.h"
class CFMDownsampler {
class CFMDownSampler {
public:
CFMDownsampler(uint16_t length);
CFMDownSampler(uint16_t length);
void addSample(q15_t sample);
bool getPackedData(TSamplePairPack& data);
uint16_t getData();
void reset();
private:
@ -40,3 +44,4 @@ private:
};
#endif

View File

@ -109,7 +109,7 @@ const uint8_t MMDVM_DEBUG5 = 0xF5U;
#define HW_TYPE "MMDVM"
#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)
#define concat(h, a, b, c) h " " a " " b " GitID #" c ""