1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-30 03:38:55 -05:00
sdrangel/plugins/samplesource/perseus/perseusworker.h

65 lines
3.0 KiB
C
Raw Normal View History

2018-02-07 13:56:39 -05:00
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
// //
// 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. //
2018-02-07 13:56:39 -05:00
// //
// 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/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef PLUGINS_SAMPLESOURCE_PERSEUS_PERSEUSWORKER_H_
#define PLUGINS_SAMPLESOURCE_PERSEUS_PERSEUSWORKER_H_
2018-02-07 13:56:39 -05:00
#include <QObject>
2018-02-07 13:56:39 -05:00
#include "perseus-sdr.h"
2018-02-07 17:44:20 -05:00
#include "dsp/samplesinkfifo.h"
#include "dsp/decimators.h"
2018-02-09 23:42:37 -05:00
#define PERSEUS_NBSAMPLES 2048 // Number of I/Q samples in each callback from Perseus
2018-02-07 17:44:20 -05:00
#define PERSEUS_BLOCKSIZE 6*PERSEUS_NBSAMPLES // Perseus sends 2*3 bytes samples
2018-02-07 13:56:39 -05:00
class PerseusWorker : public QObject {
2018-02-07 13:56:39 -05:00
Q_OBJECT
public:
PerseusWorker(perseus_descr* dev, SampleSinkFifo* sampleFifo, QObject* parent = 0);
~PerseusWorker();
2018-02-07 13:56:39 -05:00
void startWork();
void stopWork();
void setLog2Decimation(unsigned int log2_decim);
void setIQOrder(bool iqOrder) { m_iqOrder = iqOrder; }
2018-02-07 13:56:39 -05:00
private:
volatile bool m_running;
2018-02-07 13:56:39 -05:00
perseus_descr* m_dev;
2018-02-07 17:44:20 -05:00
qint32 m_buf[2*PERSEUS_NBSAMPLES];
2018-02-07 13:56:39 -05:00
SampleVector m_convertBuffer;
SampleSinkFifo* m_sampleFifo;
unsigned int m_log2Decim;
bool m_iqOrder;
static PerseusWorker *m_this;
2018-02-07 13:56:39 -05:00
Decimators<qint32, TripleByteLE<qint32>, SDR_RX_SAMP_SZ, 24, true> m_decimators32IQ; // for no decimation (accumulator is int32)
Decimators<qint32, TripleByteLE<qint64>, SDR_RX_SAMP_SZ, 24, true> m_decimators64IQ; // for actual decimation (accumulator is int64)
Decimators<qint32, TripleByteLE<qint32>, SDR_RX_SAMP_SZ, 24, false> m_decimators32QI; // for no decimation (accumulator is int32)
Decimators<qint32, TripleByteLE<qint64>, SDR_RX_SAMP_SZ, 24, false> m_decimators64QI; // for actual decimation (accumulator is int64)
2018-02-07 13:56:39 -05:00
void callbackIQ(const uint8_t* buf, qint32 len); // inner call back
void callbackQI(const uint8_t* buf, qint32 len);
2018-02-07 13:56:39 -05:00
static int rx_callback(void *buf, int buf_size, void *extra); // call back from Perseus
};
#endif /* PLUGINS_SAMPLESOURCE_PERSEUS_PERSEUSWORKER_H_ */