mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-25 19:29:55 +00:00
Rough implementation of capture mode
This commit is contained in:
@@ -179,6 +179,7 @@ CPPSRC = main.cpp \
|
||||
../common/tpms_packet.cpp \
|
||||
ert_app.cpp \
|
||||
../common/ert_packet.cpp \
|
||||
capture_app.cpp \
|
||||
sd_card.cpp \
|
||||
file.cpp \
|
||||
log_file.cpp \
|
||||
|
62
firmware/application/capture_app.cpp
Normal file
62
firmware/application/capture_app.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Jared Boone, ShareBrained Technology, Inc.
|
||||
*
|
||||
* This file is part of PortaPack.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "capture_app.hpp"
|
||||
|
||||
#include "baseband_api.hpp"
|
||||
|
||||
#include "utility.hpp"
|
||||
|
||||
namespace ui {
|
||||
|
||||
CaptureAppView::CaptureAppView(NavigationView&) {
|
||||
capture_thread = std::make_unique<AudioThread>("baseband.c16");
|
||||
|
||||
radio::enable({
|
||||
tuning_frequency(),
|
||||
sampling_rate,
|
||||
baseband_bandwidth,
|
||||
rf::Direction::Receive,
|
||||
false, 16, 16,
|
||||
1,
|
||||
});
|
||||
|
||||
baseband::start({
|
||||
.mode = 7,
|
||||
.sampling_rate = sampling_rate,
|
||||
.decimation_factor = 1,
|
||||
});
|
||||
}
|
||||
|
||||
CaptureAppView::~CaptureAppView() {
|
||||
baseband::stop();
|
||||
radio::disable();
|
||||
}
|
||||
|
||||
uint32_t CaptureAppView::target_frequency() const {
|
||||
return initial_target_frequency;
|
||||
}
|
||||
|
||||
uint32_t CaptureAppView::tuning_frequency() const {
|
||||
return target_frequency() - (sampling_rate / 4);
|
||||
}
|
||||
|
||||
} /* namespace ui */
|
55
firmware/application/capture_app.hpp
Normal file
55
firmware/application/capture_app.hpp
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Jared Boone, ShareBrained Technology, Inc.
|
||||
*
|
||||
* This file is part of PortaPack.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __CAPTURE_APP_HPP__
|
||||
#define __CAPTURE_APP_HPP__
|
||||
|
||||
#include "ui_widget.hpp"
|
||||
#include "ui_navigation.hpp"
|
||||
|
||||
#include "audio_thread.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
namespace ui {
|
||||
|
||||
class CaptureAppView : public View {
|
||||
public:
|
||||
CaptureAppView(NavigationView& nav);
|
||||
~CaptureAppView();
|
||||
|
||||
std::string title() const override { return "Capture"; };
|
||||
|
||||
private:
|
||||
static constexpr uint32_t initial_target_frequency = 91500000;
|
||||
static constexpr uint32_t sampling_rate = 2457600;
|
||||
static constexpr uint32_t baseband_bandwidth = 1750000;
|
||||
|
||||
std::unique_ptr<AudioThread> capture_thread;
|
||||
|
||||
uint32_t target_frequency() const;
|
||||
uint32_t tuning_frequency() const;
|
||||
};
|
||||
|
||||
} /* namespace ui */
|
||||
|
||||
#endif/*__CAPTURE_APP_HPP__*/
|
@@ -31,6 +31,7 @@
|
||||
#include "ais_app.hpp"
|
||||
#include "ert_app.hpp"
|
||||
#include "tpms_app.hpp"
|
||||
#include "capture_app.hpp"
|
||||
|
||||
#include "core_control.hpp"
|
||||
|
||||
@@ -168,7 +169,7 @@ ReceiverMenuView::ReceiverMenuView(NavigationView& nav) {
|
||||
SystemMenuView::SystemMenuView(NavigationView& nav) {
|
||||
add_items<7>({ {
|
||||
{ "Receiver", [&nav](){ nav.push<ReceiverMenuView>(); } },
|
||||
{ "Capture", [&nav](){ nav.push<NotImplementedView>(); } },
|
||||
{ "Capture", [&nav](){ nav.push<CaptureAppView>(); } },
|
||||
{ "Analyze", [&nav](){ nav.push<NotImplementedView>(); } },
|
||||
{ "Setup", [&nav](){ nav.push<SetupMenuView>(); } },
|
||||
{ "About", [&nav](){ nav.push<AboutView>(); } },
|
||||
|
Reference in New Issue
Block a user