1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-04 16:01:14 -05:00
sdrangel/plugins/samplesource/airspyhfi/airspyhfithread.h

68 lines
2.4 KiB
C
Raw Normal View History

2018-02-01 03:12:38 -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 //
// //
// 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/>. //
///////////////////////////////////////////////////////////////////////////////////
2018-02-05 02:38:47 -05:00
#ifndef INCLUDE_AIRSPYHFITHREAD_H
#define INCLUDE_AIRSPYHFITHREAD_H
2018-02-01 03:12:38 -05:00
#include <QThread>
#include <QMutex>
#include <QWaitCondition>
#include <libairspyhf/airspyhf.h>
#include "dsp/samplesinkfifo.h"
2018-02-05 02:38:47 -05:00
#include "dsp/decimators.h"
2018-02-01 03:12:38 -05:00
2018-02-05 02:38:47 -05:00
#define AIRSPYHFI_BLOCKSIZE (1<<17)
2018-02-01 03:12:38 -05:00
2018-02-05 02:38:47 -05:00
class AirspyHFIThread : public QThread {
2018-02-01 03:12:38 -05:00
Q_OBJECT
public:
2018-02-05 02:38:47 -05:00
AirspyHFIThread(airspyhf_device_t* dev, SampleSinkFifo* sampleFifo, QObject* parent = 0);
~AirspyHFIThread();
2018-02-01 03:12:38 -05:00
void startWork();
void stopWork();
void setSamplerate(uint32_t samplerate);
void setLog2Decimation(unsigned int log2_decim);
private:
QMutex m_startWaitMutex;
QWaitCondition m_startWaiter;
bool m_running;
airspyhf_device_t* m_dev;
2018-02-05 02:38:47 -05:00
qint16 m_buf[2*AIRSPYHFI_BLOCKSIZE];
2018-02-01 03:12:38 -05:00
SampleVector m_convertBuffer;
SampleSinkFifo* m_sampleFifo;
int m_samplerate;
unsigned int m_log2Decim;
2018-02-05 02:38:47 -05:00
static AirspyHFIThread *m_this;
2018-02-01 03:12:38 -05:00
2018-02-05 02:38:47 -05:00
#ifdef SDR_RX_SAMPLE_24BIT
Decimators<qint64, qint16, SDR_RX_SAMP_SZ, 16> m_decimators;
#else
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 16> m_decimators;
#endif
2018-02-01 03:12:38 -05:00
void run();
2018-02-05 02:38:47 -05:00
void callback(const qint16* buf, qint32 len);
2018-02-01 03:12:38 -05:00
static int rx_callback(airspyhf_transfer_t* transfer);
};
2018-02-05 02:38:47 -05:00
#endif // INCLUDE_AIRSPYHFITHREAD_H