mirror of https://github.com/g4klx/MMDVM.git
107 lines
2.7 KiB
C++
107 lines
2.7 KiB
C++
/*
|
|
* Copyright (C) 2020 by Jonathan Naylor G4KLX
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
*/
|
|
|
|
#include "Config.h"
|
|
#include "Globals.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() :
|
|
m_level(128 * 128),
|
|
m_wanted(false),
|
|
m_running(false)
|
|
{
|
|
}
|
|
|
|
void CFMKeyer::setParams(const char* text, uint8_t speed, uint16_t frequency, uint8_t level)
|
|
{
|
|
m_level = q15_t(level * 128);
|
|
}
|
|
|
|
void CFMKeyer::getAudio(q15_t* samples, uint8_t length)
|
|
{
|
|
}
|
|
|
|
void CFMKeyer::start()
|
|
{
|
|
m_wanted = true;
|
|
}
|
|
|
|
void CFMKeyer::stop()
|
|
{
|
|
}
|
|
|
|
bool CFMKeyer::isRunning() const
|
|
{
|
|
return m_running;
|
|
}
|