mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-10-31 23:17:11 -04:00
49 lines
2.0 KiB
C++
49 lines
2.0 KiB
C++
|
///////////////////////////////////////////////////////////////////////////////////
|
||
|
// Copyright (C) 2022 F4EXB //
|
||
|
// written by Edouard Griffiths //
|
||
|
// //
|
||
|
// 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 as version 3 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 V3 for more details. //
|
||
|
// //
|
||
|
// You should have received a copy of the GNU General Public License //
|
||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||
|
///////////////////////////////////////////////////////////////////////////////////
|
||
|
|
||
|
#include "m17demodbaudrates.h"
|
||
|
|
||
|
unsigned int M17DemodBaudRates::m_rates[] = {4800};
|
||
|
unsigned int M17DemodBaudRates::m_nb_rates = 1;
|
||
|
unsigned int M17DemodBaudRates::m_defaultRateIndex = 0; // 4800 bauds
|
||
|
|
||
|
unsigned int M17DemodBaudRates::getRate(unsigned int rate_index)
|
||
|
{
|
||
|
if (rate_index < m_nb_rates)
|
||
|
{
|
||
|
return m_rates[rate_index];
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return m_rates[m_defaultRateIndex];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
unsigned int M17DemodBaudRates::getRateIndex(unsigned int rate)
|
||
|
{
|
||
|
for (unsigned int i=0; i < m_nb_rates; i++)
|
||
|
{
|
||
|
if (rate == m_rates[i])
|
||
|
{
|
||
|
return i;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return m_defaultRateIndex;
|
||
|
}
|