From 33140012058980705437df30b2b87f42cc3ea88e Mon Sep 17 00:00:00 2001 From: sommermoregentraum Date: Sun, 21 Jan 2024 18:49:17 +0800 Subject: [PATCH] bring keyfob app back (#1794) * bring keyfob app back * format * cleanup * format * remove committed line from original list --- firmware/application/external/external.cmake | 6 ++ firmware/application/external/external.ld | 7 ++ firmware/application/external/keyfob/main.cpp | 82 +++++++++++++++++++ .../{apps => external/keyfob}/ui_keyfob.cpp | 4 +- .../{apps => external/keyfob}/ui_keyfob.hpp | 4 +- firmware/application/ui_navigation.cpp | 3 +- 6 files changed, 100 insertions(+), 6 deletions(-) create mode 100644 firmware/application/external/keyfob/main.cpp rename firmware/application/{apps => external/keyfob}/ui_keyfob.cpp (98%) rename firmware/application/{apps => external/keyfob}/ui_keyfob.hpp (97%) diff --git a/firmware/application/external/external.cmake b/firmware/application/external/external.cmake index 703b2e2d..06c359b5 100644 --- a/firmware/application/external/external.cmake +++ b/firmware/application/external/external.cmake @@ -54,6 +54,11 @@ set(EXTCPPSRC external/spainter/ui_spectrum_painter.cpp external/spainter/ui_spectrum_painter_text.cpp external/spainter/ui_spectrum_painter_image.cpp + + #keyfob + external/keyfob/main.cpp + external/keyfob/ui_keyfob.cpp + external/keyfob/ui_keyfob.hpp ) set(EXTAPPLIST @@ -70,4 +75,5 @@ set(EXTAPPLIST jammer gpssim spainter + keyfob ) diff --git a/firmware/application/external/external.ld b/firmware/application/external/external.ld index 2befdd93..f4b52e59 100644 --- a/firmware/application/external/external.ld +++ b/firmware/application/external/external.ld @@ -30,6 +30,7 @@ MEMORY ram_external_app_jammer(rwx) : org = 0xEEF30000, len = 32k ram_external_app_gpssim(rwx) : org = 0xEEF40000, len = 32k ram_external_app_spainter(rwx) : org = 0xEEF50000, len = 32k + ram_external_app_keyfob(rwx) : org = 0xEEF60000, len = 32k } SECTIONS @@ -116,4 +117,10 @@ SECTIONS *(*ui*external_app*spainter*); } > ram_external_app_spainter + .external_app_keyfob : ALIGN(4) SUBALIGN(4) + { + KEEP(*(.external_app.app_keyfob.application_information)); + *(*ui*external_app*keyfob*); + } > ram_external_app_keyfob + } diff --git a/firmware/application/external/keyfob/main.cpp b/firmware/application/external/keyfob/main.cpp new file mode 100644 index 00000000..0c40554a --- /dev/null +++ b/firmware/application/external/keyfob/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 "ui_keyfob.hpp" +#include "ui_navigation.hpp" +#include "external_app.hpp" + +namespace ui::external_app::keyfob { +void initialize_app(ui::NavigationView& nav) { + nav.push(); +} +} // namespace ui::external_app::keyfob + +extern "C" { + +__attribute__((section(".external_app.app_keyfob.application_information"), used)) application_information_t _application_information_keyfob = { + /*.memory_location = */ (uint8_t*)0x00000000, + /*.externalAppEntry = */ ui::external_app::keyfob::initialize_app, + /*.header_version = */ CURRENT_HEADER_VERSION, + /*.app_version = */ VERSION_MD5, + + /*.app_name = */ "Keyfob", + /*.bitmap_data = */ { + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0x30, + 0x00, + 0xFC, + 0x00, + 0xCE, + 0x01, + 0x86, + 0x01, + 0xFE, + 0x01, + 0x86, + 0x31, + 0x86, + 0x49, + 0xCE, + 0x87, + 0xFC, + 0x84, + 0xFC, + 0x4B, + 0x78, + 0x30, + }, + /*.icon_color = */ ui::Color::orange().v, + /*.menu_location = */ app_location_t::TX, + + /*.m4_app_tag = portapack::spi_flash::image_tag_keyfob */ {'P', 'O', 'O', 'K'}, + /*.m4_app_offset = */ 0x00000000, // will be filled at compile time +}; +} diff --git a/firmware/application/apps/ui_keyfob.cpp b/firmware/application/external/keyfob/ui_keyfob.cpp similarity index 98% rename from firmware/application/apps/ui_keyfob.cpp rename to firmware/application/external/keyfob/ui_keyfob.cpp index f907cfdf..76f7e19f 100644 --- a/firmware/application/apps/ui_keyfob.cpp +++ b/firmware/application/external/keyfob/ui_keyfob.cpp @@ -27,7 +27,7 @@ using namespace portapack; -namespace ui { +namespace ui::external_app::keyfob { uint8_t KeyfobView::subaru_get_checksum() { uint8_t checksum = 0; @@ -239,4 +239,4 @@ KeyfobView::KeyfobView( }; } -} /* namespace ui */ +} /* namespace ui::external_app::keyfob */ diff --git a/firmware/application/apps/ui_keyfob.hpp b/firmware/application/external/keyfob/ui_keyfob.hpp similarity index 97% rename from firmware/application/apps/ui_keyfob.hpp rename to firmware/application/external/keyfob/ui_keyfob.hpp index bda7c112..4e23780a 100644 --- a/firmware/application/apps/ui_keyfob.hpp +++ b/firmware/application/external/keyfob/ui_keyfob.hpp @@ -29,7 +29,7 @@ using namespace encoders; -namespace ui { +namespace ui::external_app::keyfob { class KeyfobView : public View { public: @@ -126,4 +126,4 @@ class KeyfobView : public View { }}; }; -} /* namespace ui */ +} /* namespace ui::external_app::keyfob */ diff --git a/firmware/application/ui_navigation.cpp b/firmware/application/ui_navigation.cpp index dc689a4c..039533c0 100644 --- a/firmware/application/ui_navigation.cpp +++ b/firmware/application/ui_navigation.cpp @@ -48,7 +48,7 @@ #include "ui_fsk_rx.hpp" #include "ui_iq_trim.hpp" // #include "ui_jammer.hpp" //moved to ext -// #include "ui_keyfob.hpp" +// #include "ui_keyfob.hpp" //moved to ext // #include "ui_lcr.hpp" #include "ui_level.hpp" #include "ui_looking_glass_app.hpp" @@ -178,7 +178,6 @@ const NavigationView::AppList NavigationView::appList = { {"aprstx", "APRS TX", TX, ui::Color::green(), &bitmap_icon_aprs, new ViewFactory()}, {"bht", "BHT Xy/EP", TX, ui::Color::green(), &bitmap_icon_bht, new ViewFactory()}, {"bletx", "BLE Tx", TX, ui::Color::green(), &bitmap_icon_btle, new ViewFactory()}, - //{"keyfob", "Key fob", TX, ui::Color::orange(), &bitmap_icon_keyfob, new ViewFactory()}, {"morse", "Morse", TX, ui::Color::green(), &bitmap_icon_morse, new ViewFactory()}, //{"nuoptixdtmf", "Nuoptix DTMF", TX, ui::Color::green(), &bitmap_icon_nuoptix, new ViewFactory()}, {"ooktx", "OOK", TX, ui::Color::yellow(), &bitmap_icon_remote, new ViewFactory()},