Fix compilation issues.

This commit is contained in:
Jonathan Naylor 2020-05-02 15:46:36 +01:00
parent baa4f7aa4c
commit edddbedd4b
3 changed files with 13 additions and 23 deletions

2
FM.cpp
View File

@ -57,7 +57,7 @@ void CFM::samples(bool cos, q15_t* samples, uint8_t length)
for (; i < length; i++) { for (; i < length; i++) {
q15_t currentSample = samples[i];//save to a local variable to avoid indirection on every access q15_t currentSample = samples[i];//save to a local variable to avoid indirection on every access
CTCSSState ctcssState = m_ctcssRX.process(currentSample); uint8_t ctcssState = m_ctcssRX.process(currentSample);
if (CTCSS_NOT_READY(ctcssState) && m_modemState != STATE_FM) { if (CTCSS_NOT_READY(ctcssState) && m_modemState != STATE_FM) {
//Not enough samples to determine if you have CTCSS, just carry on //Not enough samples to determine if you have CTCSS, just carry on

View File

@ -112,7 +112,7 @@ uint8_t CFMCTCSSRX::setParams(uint8_t frequency, uint8_t threshold, uint8_t leve
return 0U; return 0U;
} }
CTCSSState CFMCTCSSRX::process(q15_t sample) uint8_t CFMCTCSSRX::process(q15_t sample)
{ {
q31_t sample31 = q31_t(sample) * m_rxLevelInverse; q31_t sample31 = q31_t(sample) * m_rxLevelInverse;
@ -167,11 +167,6 @@ CTCSSState CFMCTCSSRX::process(q15_t sample)
return m_result; return m_result;
} }
CTCSSState CFMCTCSSRX::getState()
{
return m_result;
}
void CFMCTCSSRX::reset() void CFMCTCSSRX::reset()
{ {
m_q0 = 0; m_q0 = 0;

View File

@ -21,12 +21,9 @@
#include "Config.h" #include "Config.h"
enum CTCSSState const uint8_t CTS_NONE = 0U;
{ const uint8_t CTS_READY = 1U;
CTS_NONE, const uint8_t CTS_VALID = 2U;
CTS_READY,
CTS_VALID
};
#define CTCSS_READY(a) ((a & CTS_READY) != 0) #define CTCSS_READY(a) ((a & CTS_READY) != 0)
#define CTCSS_NOT_READY(a) ((a & CTS_READY) == 0) #define CTCSS_NOT_READY(a) ((a & CTS_READY) == 0)
@ -39,20 +36,18 @@ public:
uint8_t setParams(uint8_t frequency, uint8_t threshold, uint8_t level); uint8_t setParams(uint8_t frequency, uint8_t threshold, uint8_t level);
CTCSSState process(q15_t sample); uint8_t process(q15_t sample);
CTCSSState getState();
void reset(); void reset();
private: private:
q63_t m_coeffDivTwo; q63_t m_coeffDivTwo;
q31_t m_threshold; q31_t m_threshold;
uint16_t m_count; uint16_t m_count;
q31_t m_q0; q31_t m_q0;
q31_t m_q1; q31_t m_q1;
CTCSSState m_result; uint8_t m_result;
q15_t m_rxLevelInverse; q15_t m_rxLevelInverse;
q15_t q15Division(q15_t a, q15_t divisor); q15_t q15Division(q15_t a, q15_t divisor);
}; };