Move rrc filter into separate compilation unit

By moving the rrc filter into a separate compilation unit with its own
header file, we can use it both in the modulator and in the demodulator.
pull/68/head
Niccolò Izzo 2021-11-08 10:28:11 +01:00 zatwierdzone przez Silvano Seva
rodzic c648ffe377
commit 876cb87d57
4 zmienionych plików z 111 dodań i 40 usunięć

Wyświetl plik

@ -39,6 +39,7 @@ openrtx_src = ['openrtx/src/core/state.c',
'openrtx/src/rtx/rtx.cpp',
'openrtx/src/rtx/OpMode_FM.cpp',
'openrtx/src/rtx/OpMode_M17.cpp',
'openrtx/src/protocols/M17/M17DSP.cpp',
'openrtx/src/protocols/M17/M17Callsign.cpp',
'openrtx/src/protocols/M17/M17Modulator.cpp',
'openrtx/src/protocols/M17/M17Transmitter.cpp',

Wyświetl plik

@ -0,0 +1,48 @@
/***************************************************************************
* Copyright (C) 2021 by Federico Amedeo Izzo IU2NUO, *
* Niccolò Izzo IU2KIN *
* Wojciech Kaczmarski SP5WWP *
* Frederik Saraci IU2NRO *
* Silvano Seva IU2KWO *
* *
* *
* 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 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 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/> *
***************************************************************************/
#ifndef M17_DSP_H
#define M17_DSP_H
#ifndef __cplusplus
#error This header is C++ only!
#endif
#include <dsp.h>
#include <array>
namespace M17
{
/*
* Coefficients for M17 RRC filter
*/
extern const std::array<float, 79> rrc_taps;
/*
* FIR implementation of the RRC filter for baseband audio generation.
*/
extern Fir< std::tuple_size< decltype(rrc_taps) >::value > rrc;
} /* M17 */
#endif /* M17_DSP_H */

Wyświetl plik

@ -0,0 +1,61 @@
/***************************************************************************
* Copyright (C) 2021 by Federico Amedeo Izzo IU2NUO, *
* Niccolò Izzo IU2KIN *
* Frederik Saraci IU2NRO *
* Silvano Seva IU2KWO *
* *
* 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 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 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 <M17/M17DSP.h>
namespace M17
{
/*
* Coefficients for M17 RRC filter
*/
const std::array<float, 79> rrc_taps = {
-0.009265784007800534, -0.006136551625729697, -0.001125978562075172,
0.004891777252042491, 0.01071805138282269, 0.01505751553351295,
0.01679337935001369, 0.015256245142156299, 0.01042830577908502,
0.003031522725559901, -0.0055333532968188165, -0.013403099825723372,
-0.018598682349642525, -0.01944761739590459, -0.015005271935951746,
-0.0053887880354343935, 0.008056525910253532, 0.022816244158307273,
0.035513467692208076, 0.04244131815783876, 0.04025481153629372,
0.02671818654865632, 0.0013810216516704976, -0.03394615682795165,
-0.07502635967975885, -0.11540977897637611, -0.14703962203941534,
-0.16119995609538576, -0.14969512896336504, -0.10610329539459686,
-0.026921412469634916, 0.08757875030779196, 0.23293327870303457,
0.4006012210123992, 0.5786324696325503, 0.7528286479934068,
0.908262741447522, 1.0309661131633199, 1.1095611856548013,
1.1366197723675815, 1.1095611856548013, 1.0309661131633199,
0.908262741447522, 0.7528286479934068, 0.5786324696325503,
0.4006012210123992, 0.23293327870303457, 0.08757875030779196,
-0.026921412469634916, -0.10610329539459686, -0.14969512896336504,
-0.16119995609538576, -0.14703962203941534, -0.11540977897637611,
-0.07502635967975885, -0.03394615682795165, 0.0013810216516704976,
0.02671818654865632, 0.04025481153629372, 0.04244131815783876,
0.035513467692208076, 0.022816244158307273, 0.008056525910253532,
-0.0053887880354343935, -0.015005271935951746, -0.01944761739590459,
-0.018598682349642525, -0.013403099825723372, -0.0055333532968188165,
0.003031522725559901, 0.01042830577908502, 0.015256245142156299,
0.01679337935001369, 0.01505751553351295, 0.01071805138282269,
0.004891777252042491, -0.001125978562075172, -0.006136551625729697,
-0.009265784007800534
};
Fir< std::tuple_size< decltype(rrc_taps) >::value > rrc(rrc_taps);
} /* M17 */

Wyświetl plik

@ -23,6 +23,7 @@
#include <cstddef>
#include <experimental/array>
#include <M17/M17Modulator.h>
#include <M17/M17DSP.h>
#if defined(PLATFORM_MD3x0) || defined(PLATFORM_MDUV3x0)
#include <toneGenerator_MDx.h>
@ -30,46 +31,6 @@
#include <stdio.h>
#endif
/*
* Coefficients for M17 RRC filter
*/
const auto rrc_taps = std::experimental::make_array<float>
(
-0.009265784007800534, -0.006136551625729697, -0.001125978562075172,
0.004891777252042491, 0.01071805138282269, 0.01505751553351295,
0.01679337935001369, 0.015256245142156299, 0.01042830577908502,
0.003031522725559901, -0.0055333532968188165, -0.013403099825723372,
-0.018598682349642525, -0.01944761739590459, -0.015005271935951746,
-0.0053887880354343935, 0.008056525910253532, 0.022816244158307273,
0.035513467692208076, 0.04244131815783876, 0.04025481153629372,
0.02671818654865632, 0.0013810216516704976, -0.03394615682795165,
-0.07502635967975885, -0.11540977897637611, -0.14703962203941534,
-0.16119995609538576, -0.14969512896336504, -0.10610329539459686,
-0.026921412469634916, 0.08757875030779196, 0.23293327870303457,
0.4006012210123992, 0.5786324696325503, 0.7528286479934068,
0.908262741447522, 1.0309661131633199, 1.1095611856548013,
1.1366197723675815, 1.1095611856548013, 1.0309661131633199,
0.908262741447522, 0.7528286479934068, 0.5786324696325503,
0.4006012210123992, 0.23293327870303457, 0.08757875030779196,
-0.026921412469634916, -0.10610329539459686, -0.14969512896336504,
-0.16119995609538576, -0.14703962203941534, -0.11540977897637611,
-0.07502635967975885, -0.03394615682795165, 0.0013810216516704976,
0.02671818654865632, 0.04025481153629372, 0.04244131815783876,
0.035513467692208076, 0.022816244158307273, 0.008056525910253532,
-0.0053887880354343935, -0.015005271935951746, -0.01944761739590459,
-0.018598682349642525, -0.013403099825723372, -0.0055333532968188165,
0.003031522725559901, 0.01042830577908502, 0.015256245142156299,
0.01679337935001369, 0.01505751553351295, 0.01071805138282269,
0.004891777252042491, -0.001125978562075172, -0.006136551625729697,
-0.009265784007800534
);
/*
* FIR implementation of the RRC filter for baseband audio generation.
*/
static Fir< std::tuple_size< decltype(rrc_taps) >::value > rrc(rrc_taps);
M17Modulator::M17Modulator()
{