Move capture start/stop into baseband API.

Hide more calls to baseband/shared memory.
This commit is contained in:
Jared Boone 2016-06-20 10:52:59 -07:00
parent 6bd191349a
commit 420adea180
3 changed files with 18 additions and 7 deletions

View File

@ -102,4 +102,16 @@ void spectrum_streaming_stop() {
);
}
void capture_start(CaptureConfig* const config) {
shared_memory.baseband_queue.push_and_wait(
CaptureConfigMessage { config }
);
}
void capture_stop() {
shared_memory.baseband_queue.push_and_wait(
CaptureConfigMessage { nullptr }
);
}
} /* namespace baseband */

View File

@ -58,6 +58,9 @@ void shutdown();
void spectrum_streaming_start();
void spectrum_streaming_stop();
void capture_start(CaptureConfig* const config);
void capture_stop();
} /* namespace baseband */
#endif/*__BASEBAND_API_H__*/

View File

@ -21,7 +21,7 @@
#include "capture_thread.hpp"
#include "portapack_shared_memory.hpp"
#include "baseband_api.hpp"
// StreamOutput ///////////////////////////////////////////////////////////
@ -59,9 +59,7 @@ StreamOutput::StreamOutput(
CaptureConfig* const config
) : config { config }
{
shared_memory.baseband_queue.push_and_wait(
CaptureConfigMessage { config }
);
baseband::capture_start(config);
fifo_buffers_empty = config->fifo_buffers_empty;
fifo_buffers_full = config->fifo_buffers_full;
}
@ -69,9 +67,7 @@ StreamOutput::StreamOutput(
StreamOutput::~StreamOutput() {
fifo_buffers_full = nullptr;
fifo_buffers_empty = nullptr;
shared_memory.baseband_queue.push_and_wait(
CaptureConfigMessage { nullptr }
);
baseband::capture_stop();
}
// CaptureThread //////////////////////////////////////////////////////////