mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-03-29 22:52:12 +00:00
externalize scanner
This commit is contained in:
parent
4a63bdd7a0
commit
1ba83c15cf
5
firmware/application/external/external.cmake
vendored
5
firmware/application/external/external.cmake
vendored
@ -192,6 +192,10 @@ set(EXTCPPSRC
|
||||
external/doom/main.cpp
|
||||
external/doom/ui_doom.cpp
|
||||
|
||||
#scanner
|
||||
external/scanner/main.cpp
|
||||
external/scanner/ui_scanner.cpp
|
||||
|
||||
#screening
|
||||
# external/screening/main.cpp
|
||||
# external/screening/ui_screening.cpp
|
||||
@ -244,5 +248,6 @@ set(EXTAPPLIST
|
||||
stopwatch
|
||||
breakout
|
||||
doom
|
||||
scanner
|
||||
# screening
|
||||
)
|
||||
|
10
firmware/application/external/external.ld
vendored
10
firmware/application/external/external.ld
vendored
@ -69,7 +69,8 @@ MEMORY
|
||||
ram_external_app_wefax_rx (rwx) : org = 0xADDC0000, len = 32k
|
||||
ram_external_app_breakout (rwx) : org = 0xADDD0000, len = 32k
|
||||
ram_external_app_doom (rwx) : org = 0xADDE0000, len = 32k
|
||||
/*ram_external_app_screening (rwx) : org = 0xADDF0000, len = 32k*/
|
||||
ram_external_app_scanner (rwx) : org = 0xADDF0000, len = 32k
|
||||
/*ram_external_app_screening (rwx) : org = 0xADDG0000, len = 32k*/
|
||||
|
||||
}
|
||||
|
||||
@ -350,6 +351,12 @@ SECTIONS
|
||||
*(*ui*external_app*doom*);
|
||||
} > ram_external_app_doom
|
||||
|
||||
.external_app_scanner : ALIGN(4) SUBALIGN(4)
|
||||
{
|
||||
KEEP(*(.external_app.app_scanner.application_information));
|
||||
*(*ui*external_app*scanner*);
|
||||
} > ram_external_app_scanner
|
||||
|
||||
/*
|
||||
.external_app_screening : ALIGN(4) SUBALIGN(4)
|
||||
{
|
||||
@ -359,5 +366,4 @@ SECTIONS
|
||||
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
83
firmware/application/external/scanner/main.cpp
vendored
Normal file
83
firmware/application/external/scanner/main.cpp
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Bernd Herzog
|
||||
*
|
||||
* 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 "ui.hpp"
|
||||
#include "ui_scanner.hpp"
|
||||
#include "ui_navigation.hpp"
|
||||
#include "external_app.hpp"
|
||||
|
||||
namespace ui::external_app::scanner {
|
||||
void initialize_app(ui::NavigationView& nav) {
|
||||
nav.push<ScannerView>();
|
||||
}
|
||||
} // namespace ui::external_app::scanner
|
||||
|
||||
extern "C" {
|
||||
|
||||
__attribute__((section(".external_app.app_scanner.application_information"), used)) application_information_t _application_information_scanner = {
|
||||
/*.memory_location = */ (uint8_t*)0x00000000,
|
||||
/*.externalAppEntry = */ ui::external_app::scanner::initialize_app,
|
||||
/*.header_version = */ CURRENT_HEADER_VERSION,
|
||||
/*.app_version = */ VERSION_MD5,
|
||||
|
||||
/*.app_name = */ "Scanner",
|
||||
/*.bitmap_data = */ {
|
||||
0x03,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x03,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x0F,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x03,
|
||||
0x01,
|
||||
0x80,
|
||||
0x01,
|
||||
0xC3,
|
||||
0x00,
|
||||
0xE0,
|
||||
0xFF,
|
||||
0xEF,
|
||||
0xFF,
|
||||
0xC0,
|
||||
0x00,
|
||||
0x83,
|
||||
0x01,
|
||||
0x00,
|
||||
0x01,
|
||||
0x03,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00
|
||||
},
|
||||
/*.icon_color = */ ui::Color::green().v,
|
||||
/*.menu_location = */ app_location_t::RX,
|
||||
/*.desired_menu_position = */ -1,
|
||||
|
||||
/*.m4_app_tag = portapack::spi_flash::image_tag_scanner */ {'P', 'W', 'F', 'M'},
|
||||
/*.m4_app_offset = */ 0x00000000, // will be filled at compile time
|
||||
};
|
||||
}
|
@ -28,10 +28,11 @@
|
||||
#include "ui_freqman.hpp"
|
||||
#include "file_path.hpp"
|
||||
|
||||
using namespace ui;
|
||||
using namespace portapack;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
namespace ui {
|
||||
namespace ui::external_app::scanner {
|
||||
|
||||
ScannerThread::ScannerThread(std::vector<rf::Frequency> frequency_list)
|
||||
: frequency_list_{std::move(frequency_list)} {
|
||||
@ -773,5 +774,4 @@ void ScannerView::restart_scan() {
|
||||
|
||||
start_scan_thread(); // RESTART SCANNER THREAD in selected mode
|
||||
}
|
||||
|
||||
} /* namespace ui */
|
||||
} /* namespace scanner */
|
@ -35,12 +35,14 @@
|
||||
#include "ui_mictx.hpp"
|
||||
#include "ui_receiver.hpp"
|
||||
|
||||
using namespace ui;
|
||||
|
||||
namespace ui::external_app::scanner {
|
||||
|
||||
#define SCANNER_SLEEP_MS 50 // ms that Scanner Thread sleeps per loop
|
||||
#define STATISTICS_UPDATES_PER_SEC 10
|
||||
#define MAX_FREQ_LOCK 10 // # of 50ms cycles scanner locks into freq when signal detected, to verify signal is not spurious
|
||||
|
||||
namespace ui {
|
||||
|
||||
// TODO: There is too much duplicated data in these classes.
|
||||
// ScannerThread should just use more from the View.
|
||||
// Or perhaps ScannerThread should just be in the View.
|
||||
@ -314,5 +316,4 @@ class ScannerView : public View {
|
||||
this->on_statistics_update(static_cast<const ChannelStatisticsMessage*>(p)->statistics);
|
||||
}};
|
||||
};
|
||||
|
||||
} /* namespace ui */
|
||||
} /* namespace scanner */
|
Loading…
x
Reference in New Issue
Block a user