From a6538bc48bc591d474bfbecb744173d337f7e340 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Fri, 22 Apr 2016 12:15:51 -0700 Subject: [PATCH] Rename AudioThread -> CaptureThread. ...since it's doing baseband capturing too, and doesn't really know what kind of data it's moving. --- firmware/application/Makefile | 2 +- firmware/application/analog_audio_app.cpp | 4 ++-- firmware/application/analog_audio_app.hpp | 4 ++-- firmware/application/capture_app.cpp | 2 +- firmware/application/capture_app.hpp | 4 ++-- .../{audio_thread.cpp => capture_thread.cpp} | 4 ++-- .../{audio_thread.hpp => capture_thread.hpp} | 16 ++++++++-------- firmware/application/event_m0.cpp | 4 ++-- 8 files changed, 20 insertions(+), 20 deletions(-) rename firmware/application/{audio_thread.cpp => capture_thread.cpp} (92%) rename firmware/application/{audio_thread.hpp => capture_thread.hpp} (91%) diff --git a/firmware/application/Makefile b/firmware/application/Makefile index 05a2fd5e6..5efd06ceb 100755 --- a/firmware/application/Makefile +++ b/firmware/application/Makefile @@ -184,7 +184,7 @@ CPPSRC = main.cpp \ file.cpp \ log_file.cpp \ png_writer.cpp \ - audio_thread.cpp \ + capture_thread.cpp \ manchester.cpp \ string_format.cpp \ temperature_logger.cpp \ diff --git a/firmware/application/analog_audio_app.cpp b/firmware/application/analog_audio_app.cpp index 60502ff41..ce7dc4bf4 100644 --- a/firmware/application/analog_audio_app.cpp +++ b/firmware/application/analog_audio_app.cpp @@ -281,7 +281,7 @@ void AnalogAudioView::on_headphone_volume_changed(int32_t v) { void AnalogAudioView::update_modulation(const ReceiverModel::Mode modulation) { audio::output::mute(); - audio_thread.reset(); + capture_thread.reset(); const auto is_wideband_spectrum_mode = (modulation == ReceiverModel::Mode::SpectrumAnalysis); receiver_model.set_baseband_configuration({ @@ -295,7 +295,7 @@ void AnalogAudioView::update_modulation(const ReceiverModel::Mode modulation) { if( !is_wideband_spectrum_mode ) { const auto filename = next_filename_matching_pattern("AUD_????.S16"); if( !filename.empty() ) { - audio_thread = std::make_unique(filename); + capture_thread = std::make_unique(filename); } audio::output::unmute(); } diff --git a/firmware/application/analog_audio_app.hpp b/firmware/application/analog_audio_app.hpp index dace3245a..b72443e56 100644 --- a/firmware/application/analog_audio_app.hpp +++ b/firmware/application/analog_audio_app.hpp @@ -27,7 +27,7 @@ #include "ui_receiver.hpp" #include "ui_spectrum.hpp" -#include "audio_thread.hpp" +#include "capture_thread.hpp" #include "ui_font_fixed_8x16.hpp" @@ -144,7 +144,7 @@ private: spectrum::WaterfallWidget waterfall; - std::unique_ptr audio_thread; + std::unique_ptr capture_thread; void on_tuning_frequency_changed(rf::Frequency f); void on_baseband_bandwidth_changed(uint32_t bandwidth_hz); diff --git a/firmware/application/capture_app.cpp b/firmware/application/capture_app.cpp index 3bb106763..478dcedd3 100644 --- a/firmware/application/capture_app.cpp +++ b/firmware/application/capture_app.cpp @@ -112,7 +112,7 @@ void CaptureAppView::on_record() { return; } - capture_thread = std::make_unique(filename); + capture_thread = std::make_unique(filename); button_record.set_bitmap(&bitmap_stop); } } diff --git a/firmware/application/capture_app.hpp b/firmware/application/capture_app.hpp index 6eda1a72f..cb5ceeb0a 100644 --- a/firmware/application/capture_app.hpp +++ b/firmware/application/capture_app.hpp @@ -29,7 +29,7 @@ #include "bitmap.hpp" -#include "audio_thread.hpp" +#include "capture_thread.hpp" #include #include @@ -55,7 +55,7 @@ private: static constexpr uint32_t sampling_rate = 4000000; static constexpr uint32_t baseband_bandwidth = 2500000; - std::unique_ptr capture_thread; + std::unique_ptr capture_thread; void on_record(); diff --git a/firmware/application/audio_thread.cpp b/firmware/application/capture_thread.cpp similarity index 92% rename from firmware/application/audio_thread.cpp rename to firmware/application/capture_thread.cpp index eed061095..a441350a2 100644 --- a/firmware/application/audio_thread.cpp +++ b/firmware/application/capture_thread.cpp @@ -19,6 +19,6 @@ * Boston, MA 02110-1301, USA. */ -#include "audio_thread.hpp" +#include "capture_thread.hpp" -Thread* AudioThread::thread = nullptr; +Thread* CaptureThread::thread = nullptr; diff --git a/firmware/application/audio_thread.hpp b/firmware/application/capture_thread.hpp similarity index 91% rename from firmware/application/audio_thread.hpp rename to firmware/application/capture_thread.hpp index 37802fe82..077731edd 100644 --- a/firmware/application/audio_thread.hpp +++ b/firmware/application/capture_thread.hpp @@ -19,8 +19,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef __AUDIO_THREAD_H__ -#define __AUDIO_THREAD_H__ +#ifndef __CAPTURE_THREAD_H__ +#define __CAPTURE_THREAD_H__ #include "ch.h" @@ -55,18 +55,18 @@ private: FIFO* const fifo; }; -class AudioThread { +class CaptureThread { public: - AudioThread( + CaptureThread( std::string file_path ) : file_path { std::move(file_path) }, write_buffer { std::make_unique>() } { // 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); chEvtSignal(thread, EVT_FIFO_HIGHWATER); const auto success = chThdWait(thread); @@ -95,7 +95,7 @@ private: static Thread* thread; static msg_t static_fn(void* arg) { - auto obj = static_cast(arg); + auto obj = static_cast(arg); return obj->run(); } @@ -142,4 +142,4 @@ private: } }; -#endif/*__AUDIO_THREAD_H__*/ +#endif/*__CAPTURE_THREAD_H__*/ diff --git a/firmware/application/event_m0.cpp b/firmware/application/event_m0.cpp index af12bee1f..28aaeb501 100644 --- a/firmware/application/event_m0.cpp +++ b/firmware/application/event_m0.cpp @@ -31,7 +31,7 @@ #include "irq_controls.hpp" -#include "audio_thread.hpp" +#include "capture_thread.hpp" #include "ch.h" @@ -46,7 +46,7 @@ CH_IRQ_HANDLER(M4Core_IRQHandler) { CH_IRQ_PROLOGUE(); chSysLockFromIsr(); - AudioThread::check_fifo_isr(); + CaptureThread::check_fifo_isr(); EventDispatcher::events_flag_isr(EVT_MASK_APPLICATION); chSysUnlockFromIsr();