mirror of https://github.com/g4klx/MMDVM.git
Add the timeout tones.
This commit is contained in:
parent
a9a985182f
commit
ebd87584da
9
FM.cpp
9
FM.cpp
|
@ -56,11 +56,14 @@ void CFM::samples(q15_t* samples, uint8_t length)
|
||||||
samples[i] = 0;
|
samples[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_rfAck.getAudio(samples, length);
|
if (!m_callsign.isRunning())
|
||||||
|
m_rfAck.getAudio(samples, length);
|
||||||
|
|
||||||
m_callsign.getAudio(samples, length);
|
if (!m_rfAck.isRunning())
|
||||||
|
m_callsign.getAudio(samples, length);
|
||||||
|
|
||||||
m_timeoutTone.getAudio(samples, length);
|
if (!m_callsign.isRunning() && !m_rfAck.isRunning())
|
||||||
|
m_timeoutTone.getAudio(samples, length);
|
||||||
|
|
||||||
// Band-pass filter
|
// Band-pass filter
|
||||||
|
|
||||||
|
|
55
FMKeyer.cpp
55
FMKeyer.cpp
|
@ -20,6 +20,61 @@
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "FMKeyer.h"
|
#include "FMKeyer.h"
|
||||||
|
|
||||||
|
const struct {
|
||||||
|
uint8_t c;
|
||||||
|
uint32_t pattern;
|
||||||
|
uint8_t length;
|
||||||
|
} SYMBOL_LIST[] = {
|
||||||
|
{'A', 0xB8000000U, 8U},
|
||||||
|
{'B', 0xEA800000U, 12U},
|
||||||
|
{'C', 0xEBA00000U, 14U},
|
||||||
|
{'D', 0xEA000000U, 10U},
|
||||||
|
{'E', 0x80000000U, 4U},
|
||||||
|
{'F', 0xAE800000U, 12U},
|
||||||
|
{'G', 0xEE800000U, 12U},
|
||||||
|
{'H', 0xAA000000U, 10U},
|
||||||
|
{'I', 0xA0000000U, 6U},
|
||||||
|
{'J', 0xBBB80000U, 16U},
|
||||||
|
{'K', 0xEB800000U, 12U},
|
||||||
|
{'L', 0xBA800000U, 12U},
|
||||||
|
{'M', 0xEE000000U, 10U},
|
||||||
|
{'N', 0xE8000000U, 8U},
|
||||||
|
{'O', 0xEEE00000U, 14U},
|
||||||
|
{'P', 0xBBA00000U, 14U},
|
||||||
|
{'Q', 0xEEB80000U, 16U},
|
||||||
|
{'R', 0xBA000000U, 10U},
|
||||||
|
{'S', 0xA8000000U, 8U},
|
||||||
|
{'T', 0xE0000000U, 6U},
|
||||||
|
{'U', 0xAE000000U, 10U},
|
||||||
|
{'V', 0xAB800000U, 12U},
|
||||||
|
{'W', 0xBB800000U, 12U},
|
||||||
|
{'X', 0xEAE00000U, 14U},
|
||||||
|
{'Y', 0xEBB80000U, 16U},
|
||||||
|
{'Z', 0xEEA00000U, 14U},
|
||||||
|
{'1', 0xBBBB8000U, 20U},
|
||||||
|
{'2', 0xAEEE0000U, 18U},
|
||||||
|
{'3', 0xABB80000U, 16U},
|
||||||
|
{'4', 0xAAE00000U, 14U},
|
||||||
|
{'5', 0xAA800000U, 12U},
|
||||||
|
{'6', 0xEAA00000U, 14U},
|
||||||
|
{'7', 0xEEA80000U, 16U},
|
||||||
|
{'8', 0xEEEA0000U, 18U},
|
||||||
|
{'9', 0xEEEE8000U, 20U},
|
||||||
|
{'0', 0xEEEEE000U, 22U},
|
||||||
|
{'/', 0xEAE80000U, 16U},
|
||||||
|
{'?', 0xAEEA0000U, 18U},
|
||||||
|
{',', 0xEEAEE000U, 22U},
|
||||||
|
{'-', 0xEAAE0000U, 18U},
|
||||||
|
{'=', 0xEAB80000U, 16U},
|
||||||
|
{' ', 0x00000000U, 4U},
|
||||||
|
{0U, 0x00000000U, 0U}
|
||||||
|
};
|
||||||
|
|
||||||
|
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])
|
||||||
|
|
||||||
CFMKeyer::CFMKeyer() :
|
CFMKeyer::CFMKeyer() :
|
||||||
m_level(128 * 128),
|
m_level(128 * 128),
|
||||||
m_wanted(false),
|
m_wanted(false),
|
||||||
|
|
|
@ -20,9 +20,17 @@
|
||||||
#include "Globals.h"
|
#include "Globals.h"
|
||||||
#include "FMTimeout.h"
|
#include "FMTimeout.h"
|
||||||
|
|
||||||
|
// 400 Hz sine wave at 24000 Hz sample rate
|
||||||
|
const q15_t BUSY_AUDIO[] = {0, 3426, 6813, 10126, 13328, 16384, 19261, 21926, 24351, 26510, 28378, 29935, 31164, 32052, 32588, 32768, 32588, 32052, 31164, 29935, 28378, 26510, 24351,
|
||||||
|
21926, 19261, 16384, 13328, 10126, 6813, 3425, 0, -3425, -6813, -10126, -13328, -16384, -19261, -21926, -24351, -26510, -28378, -29935, -31164, -32052,
|
||||||
|
-32588, -32768, -32588, -32052, -31164, -29935, -28378, -26510, -24351, -21926, -19261, -16384, -13328, -10126, -6813, -3425};
|
||||||
|
const uint8_t BUSY_AUDIO_LEN = 60U;
|
||||||
|
|
||||||
CFMTimeout::CFMTimeout() :
|
CFMTimeout::CFMTimeout() :
|
||||||
m_level(128 * 128),
|
m_level(128 * 128),
|
||||||
m_running(false)
|
m_running(false),
|
||||||
|
m_pos(0U),
|
||||||
|
m_n(0U)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,11 +41,32 @@ void CFMTimeout::setParams(uint8_t level)
|
||||||
|
|
||||||
void CFMTimeout::getAudio(q15_t* samples, uint8_t length)
|
void CFMTimeout::getAudio(q15_t* samples, uint8_t length)
|
||||||
{
|
{
|
||||||
|
if (!m_running)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (uint8_t i = 0U; i < length; i++) {
|
||||||
|
if (m_pos > 12000U) {
|
||||||
|
q31_t sample = BUSY_AUDIO[m_n] * m_level;
|
||||||
|
samples[i] = q15_t(__SSAT((sample >> 15), 16));
|
||||||
|
|
||||||
|
m_n++;
|
||||||
|
if (m_n >= BUSY_AUDIO_LEN)
|
||||||
|
m_n = 0U;
|
||||||
|
} else {
|
||||||
|
samples[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pos++;
|
||||||
|
if (m_pos >= 24000U)
|
||||||
|
m_pos = 0U;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFMTimeout::start()
|
void CFMTimeout::start()
|
||||||
{
|
{
|
||||||
m_running = true;
|
m_running = true;
|
||||||
|
m_pos = 0U;
|
||||||
|
m_n = 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFMTimeout::stop()
|
void CFMTimeout::stop()
|
||||||
|
|
|
@ -33,8 +33,10 @@ public:
|
||||||
void getAudio(q15_t* samples, uint8_t length);
|
void getAudio(q15_t* samples, uint8_t length);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
q15_t m_level;
|
q15_t m_level;
|
||||||
bool m_running;
|
bool m_running;
|
||||||
|
uint32_t m_pos;
|
||||||
|
uint8_t m_n;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue