mirror of
https://github.com/g4klx/MMDVM.git
synced 2026-08-21 14:36:21 +02:00
Simplify the calculations.
This commit is contained in:
+2
-14
@@ -53,7 +53,7 @@ class CFMCTCSSRX {
|
||||
public:
|
||||
CFMCTCSSRX();
|
||||
|
||||
uint8_t setParams(uint8_t frequency, uint8_t threshold, q15_t rxLevel);
|
||||
uint8_t setParams(uint8_t frequency, uint8_t threshold, uint8_t level);
|
||||
|
||||
CTCSSState process(q15_t sample);
|
||||
|
||||
@@ -62,25 +62,13 @@ public:
|
||||
void reset();
|
||||
|
||||
private:
|
||||
static inline q15_t q15Division(q15_t a, q15_t divisor)
|
||||
{
|
||||
q31_t a31 = q31_t(a) << 16;
|
||||
|
||||
if (((a >> 31) & 1) == ((divisor >> 15) & 1))
|
||||
a31 += divisor >> 1;
|
||||
else
|
||||
a31 -= divisor >> 1;
|
||||
|
||||
return a31 / divisor;
|
||||
}
|
||||
|
||||
q63_t m_coeffDivTwo;
|
||||
q31_t m_threshold;
|
||||
uint16_t m_count;
|
||||
q31_t m_q0;
|
||||
q31_t m_q1;
|
||||
CTCSSState m_result;
|
||||
q31_t m_rxLevelInverse;
|
||||
q15_t m_rxLevelInverse;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user