added stuff idk

This commit is contained in:
Ryzerth
2020-06-10 18:52:07 +02:00
parent 8e1c6e9da6
commit 7120e848ef
13 changed files with 300 additions and 17 deletions

View File

@@ -16,11 +16,21 @@ namespace cdsp {
class Complex2HackRF {
public:
Complex2HackRF() {
}
Complex2HackRF(stream<complex_t>* in, int bufferSize) : output(bufferSize * 2) {
_input = in;
_bufferSize = bufferSize;
}
void init(stream<complex_t>* in, int bufferSize) {
output.init(bufferSize * 2);
_input = in;
_bufferSize = bufferSize;
}
stream<hackrf_sample_t> output;
void start() {
@@ -48,11 +58,21 @@ namespace cdsp {
class HackRF2Complex {
public:
HackRF2Complex() {
}
HackRF2Complex(stream<complex_t>* out, int bufferSize) : input(bufferSize * 2) {
_output = out;
_bufferSize = bufferSize;
}
void init(stream<complex_t>* out, int bufferSize) {
input.init(bufferSize * 2);
_output = out;
_bufferSize = bufferSize;
}
void start() {
_workerThread = std::thread(_worker, this);
}
@@ -81,12 +101,23 @@ namespace cdsp {
class HackRFSink {
public:
HackRFSink() {
}
HackRFSink(hackrf_device* dev, int bufferSize, stream<complex_t>* input) : gen(input, bufferSize) {
_input = input;
_dev = dev;
gen.start();
}
void init(hackrf_device* dev, int bufferSize, stream<complex_t>* input) {
gen.init(input, bufferSize);
_input = input;
_dev = dev;
gen.start();
}
void start() {
streaming = true;
hackrf_start_tx(_dev, _worker, this);
@@ -116,11 +147,22 @@ namespace cdsp {
class HackRFSource {
public:
HackRFSource() {
}
HackRFSource(hackrf_device* dev, int bufferSize) : output(bufferSize * 2), gen(&output, bufferSize) {
_dev = dev;
gen.start();
}
void init(hackrf_device* dev, int bufferSize) {
output.init(bufferSize * 2);
gen.init(&output, bufferSize);
_dev = dev;
gen.start();
}
void start() {
streaming = true;
hackrf_start_rx(_dev, _worker, this);