From ec80859d932a79d6daf5f1335d47dcca4a928bbc Mon Sep 17 00:00:00 2001 From: Totoo Date: Mon, 11 Dec 2023 08:55:07 +0100 Subject: [PATCH] AnalogTV to ext (#1638) --- firmware/application/CMakeLists.txt | 2 +- .../analogtv}/analog_tv_app.cpp | 11 +-- .../analogtv}/analog_tv_app.hpp | 4 +- .../application/external/analogtv/main.cpp | 82 +++++++++++++++++++ firmware/application/external/external.cmake | 5 ++ firmware/application/external/external.ld | 7 ++ firmware/application/ui_navigation.cpp | 4 +- firmware/baseband/CMakeLists.txt | 13 +-- 8 files changed, 112 insertions(+), 16 deletions(-) rename firmware/application/{apps => external/analogtv}/analog_tv_app.cpp (94%) rename firmware/application/{apps => external/analogtv}/analog_tv_app.hpp (97%) create mode 100644 firmware/application/external/analogtv/main.cpp diff --git a/firmware/application/CMakeLists.txt b/firmware/application/CMakeLists.txt index 762b0935..f11a55e2 100644 --- a/firmware/application/CMakeLists.txt +++ b/firmware/application/CMakeLists.txt @@ -243,7 +243,7 @@ set(CPPSRC apps/acars_app.cpp apps/ais_app.cpp apps/analog_audio_app.cpp - apps/analog_tv_app.cpp + # apps/analog_tv_app.cpp apps/ble_comm_app.cpp apps/ble_rx_app.cpp apps/ble_tx_app.cpp diff --git a/firmware/application/apps/analog_tv_app.cpp b/firmware/application/external/analogtv/analog_tv_app.cpp similarity index 94% rename from firmware/application/apps/analog_tv_app.cpp rename to firmware/application/external/analogtv/analog_tv_app.cpp index 60feaec1..795ea51b 100644 --- a/firmware/application/apps/analog_tv_app.cpp +++ b/firmware/application/external/analogtv/analog_tv_app.cpp @@ -37,7 +37,7 @@ using namespace tonekey; #include "string_format.hpp" -namespace ui { +namespace ui::external_app::analogtv { /* AnalogTvView *******************************************************/ @@ -192,10 +192,11 @@ void AnalogTvView::update_modulation(const ReceiverModel::Mode modulation) { baseband::shutdown(); - portapack::spi_flash::image_tag_t image_tag; - image_tag = portapack::spi_flash::image_tag_am_tv; + // portapack::spi_flash::image_tag_t image_tag; //moved to ext app, disabled + // image_tag = portapack::spi_flash::image_tag_am_tv; - baseband::run_image(image_tag); + // baseband::run_image(image_tag); + baseband::run_prepared_image(portapack::memory::map::m4_code.base()); // moved the baseband too receiver_model.set_modulation(modulation); receiver_model.set_sampling_rate(2000000); @@ -203,4 +204,4 @@ void AnalogTvView::update_modulation(const ReceiverModel::Mode modulation) { receiver_model.enable(); } -} /* namespace ui */ +} // namespace ui::external_app::analogtv diff --git a/firmware/application/apps/analog_tv_app.hpp b/firmware/application/external/analogtv/analog_tv_app.hpp similarity index 97% rename from firmware/application/apps/analog_tv_app.hpp rename to firmware/application/external/analogtv/analog_tv_app.hpp index f4ab49c3..053e5442 100644 --- a/firmware/application/apps/analog_tv_app.hpp +++ b/firmware/application/external/analogtv/analog_tv_app.hpp @@ -36,7 +36,7 @@ #include "tone_key.hpp" -namespace ui { +namespace ui::external_app::analogtv { class AnalogTvView : public View { public: @@ -111,6 +111,6 @@ class AnalogTvView : public View { void update_modulation(const ReceiverModel::Mode modulation); }; -} /* namespace ui */ +} // namespace ui::external_app::analogtv #endif /*__ANALOG_TV_APP_H__*/ diff --git a/firmware/application/external/analogtv/main.cpp b/firmware/application/external/analogtv/main.cpp new file mode 100644 index 00000000..92ff6135 --- /dev/null +++ b/firmware/application/external/analogtv/main.cpp @@ -0,0 +1,82 @@ +/* + * 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 "analog_tv_app.hpp" +#include "ui_navigation.hpp" +#include "external_app.hpp" + +namespace ui::external_app::analogtv { +void initialize_app(ui::NavigationView& nav) { + nav.push(); +} +} // namespace ui::external_app::analogtv + +extern "C" { + +__attribute__((section(".external_app.app_analogtv.application_information"), used)) application_information_t _application_information_analogtv = { + /*.memory_location = */ (uint8_t*)0x00000000, + /*.externalAppEntry = */ ui::external_app::analogtv::initialize_app, + /*.header_version = */ CURRENT_HEADER_VERSION, + /*.app_version = */ VERSION_MD5, + + /*.app_name = */ "Analog TV", + /*.bitmap_data = */ { + 0x00, + 0x00, + 0x00, + 0x00, + 0xFE, + 0x7F, + 0x03, + 0xC0, + 0x53, + 0xD5, + 0xAB, + 0xCA, + 0x53, + 0xD5, + 0xAB, + 0xCA, + 0x53, + 0xD5, + 0xAB, + 0xCA, + 0x53, + 0xD5, + 0x03, + 0xC0, + 0xFF, + 0xFF, + 0xFB, + 0xD7, + 0xFE, + 0x7F, + 0x00, + 0x00, + }, + /*.icon_color = */ ui::Color::yellow().v, + /*.menu_location = */ app_location_t::RX, + + /*.m4_app_tag = portapack::spi_flash::image_tag_am_tv */ {'P', 'A', 'M', 'T'}, + /*.m4_app_offset = */ 0x00000000, // will be filled at compile time +}; +} diff --git a/firmware/application/external/external.cmake b/firmware/application/external/external.cmake index 0578c9b7..d7371fe4 100644 --- a/firmware/application/external/external.cmake +++ b/firmware/application/external/external.cmake @@ -19,6 +19,10 @@ set(EXTCPPSRC #blespam external/blespam/main.cpp external/blespam/ui_blespam.cpp + + #analogtv + external/analogtv/main.cpp + external/analogtv/analog_tv_app.cpp ) @@ -28,4 +32,5 @@ set(EXTAPPLIST calculator font_viewer blespam + analogtv ) diff --git a/firmware/application/external/external.ld b/firmware/application/external/external.ld index 1f38d753..16a3c84f 100644 --- a/firmware/application/external/external.ld +++ b/firmware/application/external/external.ld @@ -22,6 +22,7 @@ MEMORY ram_external_app_calculator (rwx) : org = 0xEEEB0000, len = 32k 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 } SECTIONS @@ -56,4 +57,10 @@ 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 } diff --git a/firmware/application/ui_navigation.cpp b/firmware/application/ui_navigation.cpp index 40d468cd..ffa0056d 100644 --- a/firmware/application/ui_navigation.cpp +++ b/firmware/application/ui_navigation.cpp @@ -86,7 +86,7 @@ // #include "acars_app.hpp" #include "ais_app.hpp" #include "analog_audio_app.hpp" -#include "analog_tv_app.hpp" +// #include "analog_tv_app.hpp" #include "ble_comm_app.hpp" #include "ble_rx_app.hpp" #include "ble_tx_app.hpp" @@ -552,7 +552,7 @@ ReceiversMenuView::ReceiversMenuView(NavigationView& nav) { // {"ACARS", Color::yellow(), &bitmap_icon_adsb, [&nav](){ nav.push(); }}, {"ADS-B", Color::green(), &bitmap_icon_adsb, [&nav]() { nav.push(); }}, {"AIS Boats", Color::green(), &bitmap_icon_ais, [&nav]() { nav.push(); }}, - {"Analog TV", Color::yellow(), &bitmap_icon_sstv, [&nav]() { nav.push(); }}, + //{"Analog TV", Color::yellow(), &bitmap_icon_sstv, [&nav]() { nav.push(); }}, {"APRS", Color::green(), &bitmap_icon_aprs, [&nav]() { nav.push(); }}, {"Audio", Color::green(), &bitmap_icon_speaker, [&nav]() { nav.push(); }}, //{"BTLE", Color::yellow(), &bitmap_icon_btle, [&nav]() { nav.push(); }}, diff --git a/firmware/baseband/CMakeLists.txt b/firmware/baseband/CMakeLists.txt index 784b8d6e..918485f7 100644 --- a/firmware/baseband/CMakeLists.txt +++ b/firmware/baseband/CMakeLists.txt @@ -382,12 +382,6 @@ set(MODE_CPPSRC ) DeclareTargets(PAMA am_audio) -### AM TV - -set(MODE_CPPSRC - proc_am_tv.cpp -) -DeclareTargets(PAMT am_tv) ### Audio transmit @@ -626,6 +620,13 @@ set(MODE_CPPSRC ) DeclareTargets(PAFR afskrx) +### AM TV + +set(MODE_CPPSRC + proc_am_tv.cpp +) +DeclareTargets(PAMT am_tv) + ### Test set(MODE_CPPSRC