From 5f8e44e7b790d46f6b466011dfa7ffadcfa1a3d3 Mon Sep 17 00:00:00 2001 From: Totoo Date: Mon, 11 Dec 2023 11:57:04 +0100 Subject: [PATCH] NRF RX to ext app (#1641) * NFR Rx to ext app --- firmware/application/CMakeLists.txt | 2 +- firmware/application/external/external.cmake | 5 ++ firmware/application/external/external.ld | 10 ++- firmware/application/external/nrf_rx/main.cpp | 83 +++++++++++++++++++ .../{apps => external/nrf_rx}/ui_nrf_rx.cpp | 7 +- .../{apps => external/nrf_rx}/ui_nrf_rx.hpp | 4 +- firmware/application/ui_navigation.cpp | 4 +- firmware/baseband/CMakeLists.txt | 14 ++-- 8 files changed, 114 insertions(+), 15 deletions(-) create mode 100644 firmware/application/external/nrf_rx/main.cpp rename firmware/application/{apps => external/nrf_rx}/ui_nrf_rx.cpp (94%) rename firmware/application/{apps => external/nrf_rx}/ui_nrf_rx.hpp (96%) diff --git a/firmware/application/CMakeLists.txt b/firmware/application/CMakeLists.txt index f11a55e2..45192d55 100644 --- a/firmware/application/CMakeLists.txt +++ b/firmware/application/CMakeLists.txt @@ -281,7 +281,7 @@ set(CPPSRC apps/ui_mictx.cpp apps/ui_modemsetup.cpp apps/ui_morse.cpp - apps/ui_nrf_rx.cpp + # apps/ui_nrf_rx.cpp # apps/ui_nuoptix.cpp apps/ui_playlist.cpp apps/ui_pocsag_tx.cpp diff --git a/firmware/application/external/external.cmake b/firmware/application/external/external.cmake index d7371fe4..4d6a3e00 100644 --- a/firmware/application/external/external.cmake +++ b/firmware/application/external/external.cmake @@ -24,6 +24,10 @@ set(EXTCPPSRC external/analogtv/main.cpp external/analogtv/analog_tv_app.cpp + #nrf_rx + external/nrf_rx/main.cpp + external/nrf_rx/ui_nrf_rx.cpp + ) set(EXTAPPLIST @@ -32,5 +36,6 @@ set(EXTAPPLIST calculator font_viewer blespam + nrf_rx analogtv ) diff --git a/firmware/application/external/external.ld b/firmware/application/external/external.ld index 16a3c84f..f3c11f7e 100644 --- a/firmware/application/external/external.ld +++ b/firmware/application/external/external.ld @@ -23,6 +23,7 @@ MEMORY ram_external_app_font_viewer(rwx) : org = 0xEEEC0000, len = 32k ram_external_app_blespam(rwx) : org = 0xEEED0000, len = 32k ram_external_app_analogtv(rwx) : org = 0xEEEE0000, len = 32k + ram_external_app_nrf_rx(rwx) : org = 0xEEEF0000, len = 32k } SECTIONS @@ -57,10 +58,17 @@ SECTIONS KEEP(*(.external_app.app_blespam.application_information)); *(*ui*external_app*blespam*); } > ram_external_app_blespam - + .external_app_analogtv : ALIGN(4) SUBALIGN(4) { KEEP(*(.external_app.app_analogtv.application_information)); *(*ui*external_app*analogtv*); } > ram_external_app_analogtv + + .external_app_nrf_rx : ALIGN(4) SUBALIGN(4) + { + KEEP(*(.external_app.app_nrf_rx.application_information)); + *(*ui*external_app*nrf_rx*); + } > ram_external_app_nrf_rx + } diff --git a/firmware/application/external/nrf_rx/main.cpp b/firmware/application/external/nrf_rx/main.cpp new file mode 100644 index 00000000..3a3f1369 --- /dev/null +++ b/firmware/application/external/nrf_rx/main.cpp @@ -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_nrf_rx.hpp" +#include "ui_navigation.hpp" +#include "external_app.hpp" + +namespace ui::external_app::nrf_rx { +void initialize_app(ui::NavigationView& nav) { + nav.push(); +} +} // namespace ui::external_app::nrf_rx + +extern "C" { + +__attribute__((section(".external_app.app_nrf_rx.application_information"), used)) application_information_t _application_information_nrf_rx = { + /*.memory_location = */ (uint8_t*)0x00000000, + /*.externalAppEntry = */ ui::external_app::nrf_rx::initialize_app, + /*.header_version = */ CURRENT_HEADER_VERSION, + /*.app_version = */ VERSION_MD5, + + /*.app_name = */ "NRF", + /*.bitmap_data = */ { + + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0x00, + 0x01, + 0xF8, + 0x3F, + 0xFC, + 0x7F, + 0xFC, + 0x7F, + 0xDC, + 0x7F, + 0x8C, + 0x6B, + 0xDC, + 0x7F, + 0xFC, + 0x7F, + 0xFC, + 0x7F, + 0xF8, + 0x3F, + }, + /*.icon_color = */ ui::Color::yellow().v, + /*.menu_location = */ app_location_t::RX, + + /*.m4_app_tag = portapack::spi_flash::image_tag_nrf_rx */ {'P', 'N', 'R', 'R'}, + /*.m4_app_offset = */ 0x00000000, // will be filled at compile time +}; +} diff --git a/firmware/application/apps/ui_nrf_rx.cpp b/firmware/application/external/nrf_rx/ui_nrf_rx.cpp similarity index 94% rename from firmware/application/apps/ui_nrf_rx.cpp rename to firmware/application/external/nrf_rx/ui_nrf_rx.cpp index 179d8ac2..ad9b122e 100644 --- a/firmware/application/apps/ui_nrf_rx.cpp +++ b/firmware/application/external/nrf_rx/ui_nrf_rx.cpp @@ -34,7 +34,7 @@ using namespace portapack; using namespace modems; -namespace ui { +namespace ui::external_app::nrf_rx { void NRFRxView::focus() { field_frequency.focus(); @@ -42,7 +42,8 @@ void NRFRxView::focus() { NRFRxView::NRFRxView(NavigationView& nav) : nav_{nav} { - baseband::run_image(portapack::spi_flash::image_tag_nrf_rx); + // baseband::run_image(portapack::spi_flash::image_tag_nrf_rx); + baseband::run_prepared_image(portapack::memory::map::m4_code.base()); add_children({&rssi, &channel, @@ -130,4 +131,4 @@ NRFRxView::~NRFRxView() { baseband::shutdown(); } -} /* namespace ui */ +} // namespace ui::external_app::nrf_rx diff --git a/firmware/application/apps/ui_nrf_rx.hpp b/firmware/application/external/nrf_rx/ui_nrf_rx.hpp similarity index 96% rename from firmware/application/apps/ui_nrf_rx.hpp rename to firmware/application/external/nrf_rx/ui_nrf_rx.hpp index efb46cb5..3f33b571 100644 --- a/firmware/application/apps/ui_nrf_rx.hpp +++ b/firmware/application/external/nrf_rx/ui_nrf_rx.hpp @@ -34,7 +34,7 @@ #include "utility.hpp" -namespace ui { +namespace ui::external_app::nrf_rx { class NRFRxView : public View { public: @@ -90,6 +90,6 @@ class NRFRxView : public View { }}; }; -} /* namespace ui */ +} /* namespace ui::external_app::nrf_rx */ #endif /*__UI_NRF_RX_H__*/ diff --git a/firmware/application/ui_navigation.cpp b/firmware/application/ui_navigation.cpp index ffa0056d..14e1d4a5 100644 --- a/firmware/application/ui_navigation.cpp +++ b/firmware/application/ui_navigation.cpp @@ -54,7 +54,7 @@ #include "ui_looking_glass_app.hpp" #include "ui_mictx.hpp" #include "ui_morse.hpp" -#include "ui_nrf_rx.hpp" +// #include "ui_nrf_rx.hpp" // #include "ui_numbers.hpp" // #include "ui_nuoptix.hpp" // #include "ui_playdead.hpp" @@ -560,7 +560,7 @@ ReceiversMenuView::ReceiversMenuView(NavigationView& nav) { {"BLE Rx", Color::green(), &bitmap_icon_btle, [&nav]() { nav.push(); }}, {"ERT Meter", Color::green(), &bitmap_icon_ert, [&nav]() { nav.push(); }}, {"Level", Color::green(), &bitmap_icon_options_radio, [&nav]() { nav.push(); }}, - {"NRF", Color::yellow(), &bitmap_icon_nrf, [&nav]() { nav.push(); }}, + //{"NRF", Color::yellow(), &bitmap_icon_nrf, [&nav]() { nav.push(); }}, {"POCSAG", Color::green(), &bitmap_icon_pocsag, [&nav]() { nav.push(); }}, {"Radiosnde", Color::green(), &bitmap_icon_sonde, [&nav]() { nav.push(); }}, {"Recon", Color::green(), &bitmap_icon_scanner, [&nav]() { nav.push(); }}, diff --git a/firmware/baseband/CMakeLists.txt b/firmware/baseband/CMakeLists.txt index 918485f7..7e13e541 100644 --- a/firmware/baseband/CMakeLists.txt +++ b/firmware/baseband/CMakeLists.txt @@ -347,12 +347,6 @@ set(MODE_CPPSRC ) DeclareTargets(PAPR aprsrx) -### NRF RX - -set(MODE_CPPSRC - proc_nrfrx.cpp -) -DeclareTargets(PNRR nrfrx) ### BTLE RX @@ -620,6 +614,14 @@ set(MODE_CPPSRC ) DeclareTargets(PAFR afskrx) +### NRF RX + +set(MODE_CPPSRC + proc_nrfrx.cpp +) +DeclareTargets(PNRR nrfrx) + + ### AM TV set(MODE_CPPSRC