SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
hackrfoutputthread.h
Go to the documentation of this file.
1 // Copyright (C) 2017 Edouard Griffiths, F4EXB //
3 // //
4 // This program is free software; you can redistribute it and/or modify //
5 // it under the terms of the GNU General Public License as published by //
6 // the Free Software Foundation as version 3 of the License, or //
7 // (at your option) any later version. //
8 // //
9 // This program is distributed in the hope that it will be useful, //
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
12 // GNU General Public License V3 for more details. //
13 // //
14 // You should have received a copy of the GNU General Public License //
15 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
17 
18 #ifndef INCLUDE_HACKRFOUTPUTTHREAD_H
19 #define INCLUDE_HACKRFOUTPUTTHREAD_H
20 
21 #include <QThread>
22 #include <QMutex>
23 #include <QWaitCondition>
24 #include <libhackrf/hackrf.h>
25 
26 #include "dsp/samplesourcefifo.h"
27 #include "dsp/interpolators.h"
28 
29 #define HACKRF_BLOCKSIZE (1<<17)
30 
31 class HackRFOutputThread : public QThread {
32  Q_OBJECT
33 
34 public:
35  HackRFOutputThread(hackrf_device* dev, SampleSourceFifo* sampleFifo, QObject* parent = NULL);
37 
38  void startWork();
39  void stopWork();
40  void setLog2Interpolation(unsigned int log2_interp);
41  void setFcPos(int fcPos);
42 
43 private:
45  QWaitCondition m_startWaiter;
46  bool m_running;
47 
48  hackrf_device* m_dev;
51 
52  unsigned int m_log2Interp;
53  int m_fcPos;
54 
56 
57  void run();
58  void callback(qint8* buf, qint32 len);
59  static int tx_callback(hackrf_transfer* transfer);
60 };
61 
62 #endif // INCLUDE_HACKRFOUTPUTTHREAD_H
Interpolators< qint8, SDR_TX_SAMP_SZ, 8 > m_interpolators
unsigned int m_log2Interp
hackrf_device * m_dev
QWaitCondition m_startWaiter
void setLog2Interpolation(unsigned int log2_interp)
SampleSourceFifo * m_sampleFifo
HackRFOutputThread(hackrf_device *dev, SampleSourceFifo *sampleFifo, QObject *parent=NULL)
static int tx_callback(hackrf_transfer *transfer)
#define HACKRF_BLOCKSIZE
void callback(qint8 *buf, qint32 len)
qint8 m_buf[2 *HACKRF_BLOCKSIZE]
void setFcPos(int fcPos)