Merge branch 'FM' of https://github.com/g4klx/MMDVM into FM

This commit is contained in:
Jonathan Naylor 2020-04-25 15:17:53 +01:00
commit c638dbe55a
3 changed files with 14 additions and 14 deletions

View File

@ -20,10 +20,10 @@
#include "Globals.h"
#include "FMCTCSSRX.h"
const struct CTCSS_TABLE {
const struct RX_CTCSS_TABLE {
uint8_t frequency;
q63_t coeffDivTwo;
} CTCSS_TABLE_DATA[] = {
} RX_CTCSS_TABLE_DATA[] = {
{ 67U, 2147153298},
{ 69U, 2147130228},
{ 71U, 2147103212},
@ -93,8 +93,8 @@ m_result(CTS_NONE)
uint8_t CFMCTCSSRX::setParams(uint8_t frequency, uint8_t threshold)
{
for (uint8_t i = 0U; i < CTCSS_TABLE_DATA_LEN; i++) {
if (CTCSS_TABLE_DATA[i].frequency == frequency) {
m_coeffDivTwo = CTCSS_TABLE_DATA[i].coeffDivTwo;
if (RX_CTCSS_TABLE_DATA[i].frequency == frequency) {
m_coeffDivTwo = RX_CTCSS_TABLE_DATA[i].coeffDivTwo;
break;
}
}

View File

@ -20,11 +20,11 @@
#include "Globals.h"
#include "FMCTCSSTX.h"
const struct CTCSS_TABLE {
const struct TX_CTCSS_TABLE {
uint8_t frequency;
uint16_t length;
q15_t increment;
} CTCSS_TABLE_DATA[] = {
} TX_CTCSS_TABLE_DATA[] = {
{ 67U, 358U, 92},
{ 69U, 346U, 95},
{ 71U, 334U, 99},
@ -88,11 +88,11 @@ m_n(0U)
uint8_t CFMCTCSSTX::setParams(uint8_t frequency, uint8_t level)
{
const CTCSS_TABLE* entry = NULL;
const TX_CTCSS_TABLE* entry = NULL;
for (uint8_t i = 0U; i < CTCSS_TABLE_DATA_LEN; i++) {
if (CTCSS_TABLE_DATA[i].frequency == frequency) {
entry = CTCSS_TABLE_DATA + i;
if (TX_CTCSS_TABLE_DATA[i].frequency == frequency) {
entry = TX_CTCSS_TABLE_DATA + i;
break;
}
}

View File

@ -72,8 +72,8 @@ const struct {
const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U};
#define WRITE_BIT(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7])
#define READ_BIT(p,i) (p[(i)>>3] & BIT_MASK_TABLE[(i)&7])
#define WRITE_BIT_FM(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7])
#define READ_BIT_FM(p,i) (p[(i)>>3] & BIT_MASK_TABLE[(i)&7])
CFMKeyer::CFMKeyer() :
m_wanted(false),
@ -98,7 +98,7 @@ uint8_t CFMKeyer::setParams(const char* text, uint8_t speed, uint16_t frequency,
uint32_t MASK = 0x80000000U;
for (uint8_t k = 0U; k < SYMBOL_LIST[j].length; k++, m_poLen++, MASK >>= 1) {
bool b = (SYMBOL_LIST[j].pattern & MASK) == MASK;
WRITE_BIT(m_poBuffer, m_poLen, b);
WRITE_BIT_FM(m_poBuffer, m_poLen, b);
if (m_poLen >= 995U) {
m_poLen = 0U;
@ -136,7 +136,7 @@ q15_t CFMKeyer::getHighAudio()
if (!m_wanted)
return 0U;
bool b = READ_BIT(m_poBuffer, m_poPos);
bool b = READ_BIT_FM(m_poBuffer, m_poPos);
if (b)
output = m_audio[m_audioPos] ? m_highLevel : -m_highLevel;
@ -162,7 +162,7 @@ q15_t CFMKeyer::getLowAudio()
if (!m_wanted)
return 0U;
bool b = READ_BIT(m_poBuffer, m_poPos);
bool b = READ_BIT_FM(m_poBuffer, m_poPos);
if (b)
output = m_audio[m_audioPos] ? m_lowLevel : -m_lowLevel;