Add getData

This commit is contained in:
Geoffrey Merck 2020-05-11 19:01:05 +02:00
parent 5d4df6ffd9
commit 86ffc69b30
2 changed files with 8 additions and 2 deletions

View File

@ -28,7 +28,7 @@ m_samplePackPointer(NULL),
m_packIndex(0U), m_packIndex(0U),
m_downSampleIndex(0U) m_downSampleIndex(0U)
{ {
m_samplePackPointer = &m_samplePack; m_samplePackPointer = &m_samplePack;
} }
void CFMDownsampler::addSample(q15_t sample) void CFMDownsampler::addSample(q15_t sample)
@ -55,7 +55,7 @@ void CFMDownsampler::addSample(q15_t sample)
break; break;
} }
m_packIndex++; m_packIndex++;
if(m_packIndex >= 2U)//did we pack to samples ? if(m_packIndex >= 2U)//did we pack two samples ?
m_packIndex = 0U; m_packIndex = 0U;
} }
@ -69,6 +69,11 @@ bool CFMDownsampler::getPackedData(uint8_t& data)
return m_ringBuffer.get(data); return m_ringBuffer.get(data);
} }
uint16_t CFMDownsampler::getData()
{
return m_ringBuffer.getData();
}
void CFMDownsampler::reset() void CFMDownsampler::reset()
{ {
m_downSampleIndex = 0; m_downSampleIndex = 0;

View File

@ -28,6 +28,7 @@ public:
CFMDownsampler(uint16_t length); CFMDownsampler(uint16_t length);
void addSample(q15_t sample); void addSample(q15_t sample);
bool getPackedData(uint8_t& data); bool getPackedData(uint8_t& data);
uint16_t getData();
void reset(); void reset();
private: private: