Rename AudioThread -> CaptureThread.

...since it's doing baseband capturing too, and doesn't really know what kind of data it's moving.
This commit is contained in:
Jared Boone 2016-04-22 12:15:51 -07:00
parent b8196ee2be
commit a6538bc48b
8 changed files with 20 additions and 20 deletions

View file

@ -184,7 +184,7 @@ CPPSRC = main.cpp \
file.cpp \ file.cpp \
log_file.cpp \ log_file.cpp \
png_writer.cpp \ png_writer.cpp \
audio_thread.cpp \ capture_thread.cpp \
manchester.cpp \ manchester.cpp \
string_format.cpp \ string_format.cpp \
temperature_logger.cpp \ temperature_logger.cpp \

View file

@ -281,7 +281,7 @@ void AnalogAudioView::on_headphone_volume_changed(int32_t v) {
void AnalogAudioView::update_modulation(const ReceiverModel::Mode modulation) { void AnalogAudioView::update_modulation(const ReceiverModel::Mode modulation) {
audio::output::mute(); audio::output::mute();
audio_thread.reset(); capture_thread.reset();
const auto is_wideband_spectrum_mode = (modulation == ReceiverModel::Mode::SpectrumAnalysis); const auto is_wideband_spectrum_mode = (modulation == ReceiverModel::Mode::SpectrumAnalysis);
receiver_model.set_baseband_configuration({ receiver_model.set_baseband_configuration({
@ -295,7 +295,7 @@ void AnalogAudioView::update_modulation(const ReceiverModel::Mode modulation) {
if( !is_wideband_spectrum_mode ) { if( !is_wideband_spectrum_mode ) {
const auto filename = next_filename_matching_pattern("AUD_????.S16"); const auto filename = next_filename_matching_pattern("AUD_????.S16");
if( !filename.empty() ) { if( !filename.empty() ) {
audio_thread = std::make_unique<AudioThread>(filename); capture_thread = std::make_unique<CaptureThread>(filename);
} }
audio::output::unmute(); audio::output::unmute();
} }

View file

@ -27,7 +27,7 @@
#include "ui_receiver.hpp" #include "ui_receiver.hpp"
#include "ui_spectrum.hpp" #include "ui_spectrum.hpp"
#include "audio_thread.hpp" #include "capture_thread.hpp"
#include "ui_font_fixed_8x16.hpp" #include "ui_font_fixed_8x16.hpp"
@ -144,7 +144,7 @@ private:
spectrum::WaterfallWidget waterfall; spectrum::WaterfallWidget waterfall;
std::unique_ptr<AudioThread> audio_thread; std::unique_ptr<CaptureThread> capture_thread;
void on_tuning_frequency_changed(rf::Frequency f); void on_tuning_frequency_changed(rf::Frequency f);
void on_baseband_bandwidth_changed(uint32_t bandwidth_hz); void on_baseband_bandwidth_changed(uint32_t bandwidth_hz);

View file

@ -112,7 +112,7 @@ void CaptureAppView::on_record() {
return; return;
} }
capture_thread = std::make_unique<AudioThread>(filename); capture_thread = std::make_unique<CaptureThread>(filename);
button_record.set_bitmap(&bitmap_stop); button_record.set_bitmap(&bitmap_stop);
} }
} }

View file

@ -29,7 +29,7 @@
#include "bitmap.hpp" #include "bitmap.hpp"
#include "audio_thread.hpp" #include "capture_thread.hpp"
#include <string> #include <string>
#include <memory> #include <memory>
@ -55,7 +55,7 @@ private:
static constexpr uint32_t sampling_rate = 4000000; static constexpr uint32_t sampling_rate = 4000000;
static constexpr uint32_t baseband_bandwidth = 2500000; static constexpr uint32_t baseband_bandwidth = 2500000;
std::unique_ptr<AudioThread> capture_thread; std::unique_ptr<CaptureThread> capture_thread;
void on_record(); void on_record();

View file

@ -19,6 +19,6 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#include "audio_thread.hpp" #include "capture_thread.hpp"
Thread* AudioThread::thread = nullptr; Thread* CaptureThread::thread = nullptr;

View file

@ -19,8 +19,8 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifndef __AUDIO_THREAD_H__ #ifndef __CAPTURE_THREAD_H__
#define __AUDIO_THREAD_H__ #define __CAPTURE_THREAD_H__
#include "ch.h" #include "ch.h"
@ -55,18 +55,18 @@ private:
FIFO<uint8_t>* const fifo; FIFO<uint8_t>* const fifo;
}; };
class AudioThread { class CaptureThread {
public: public:
AudioThread( CaptureThread(
std::string file_path std::string file_path
) : file_path { std::move(file_path) }, ) : file_path { std::move(file_path) },
write_buffer { std::make_unique<std::array<uint8_t, write_size>>() } write_buffer { std::make_unique<std::array<uint8_t, write_size>>() }
{ {
// Need significant stack for FATFS // Need significant stack for FATFS
thread = chThdCreateFromHeap(NULL, 1024, NORMALPRIO + 10, AudioThread::static_fn, this); thread = chThdCreateFromHeap(NULL, 1024, NORMALPRIO + 10, CaptureThread::static_fn, this);
} }
~AudioThread() { ~CaptureThread() {
chThdTerminate(thread); chThdTerminate(thread);
chEvtSignal(thread, EVT_FIFO_HIGHWATER); chEvtSignal(thread, EVT_FIFO_HIGHWATER);
const auto success = chThdWait(thread); const auto success = chThdWait(thread);
@ -95,7 +95,7 @@ private:
static Thread* thread; static Thread* thread;
static msg_t static_fn(void* arg) { static msg_t static_fn(void* arg) {
auto obj = static_cast<AudioThread*>(arg); auto obj = static_cast<CaptureThread*>(arg);
return obj->run(); return obj->run();
} }
@ -142,4 +142,4 @@ private:
} }
}; };
#endif/*__AUDIO_THREAD_H__*/ #endif/*__CAPTURE_THREAD_H__*/

View file

@ -31,7 +31,7 @@
#include "irq_controls.hpp" #include "irq_controls.hpp"
#include "audio_thread.hpp" #include "capture_thread.hpp"
#include "ch.h" #include "ch.h"
@ -46,7 +46,7 @@ CH_IRQ_HANDLER(M4Core_IRQHandler) {
CH_IRQ_PROLOGUE(); CH_IRQ_PROLOGUE();
chSysLockFromIsr(); chSysLockFromIsr();
AudioThread::check_fifo_isr(); CaptureThread::check_fifo_isr();
EventDispatcher::events_flag_isr(EVT_MASK_APPLICATION); EventDispatcher::events_flag_isr(EVT_MASK_APPLICATION);
chSysUnlockFromIsr(); chSysUnlockFromIsr();