Skip to content

Commit

Permalink
Move ADSBTX to ext (#2214)
Browse files Browse the repository at this point in the history
  • Loading branch information
htotoo authored Aug 9, 2024
1 parent 0514663 commit df39818
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 14 deletions.
2 changes: 1 addition & 1 deletion firmware/application/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ set(CPPSRC
# apps/tpms_app.cpp
apps/ui_about_simple.cpp
apps/ui_adsb_rx.cpp
apps/ui_adsb_tx.cpp
# apps/ui_adsb_tx.cpp #moved to ext
apps/ui_aprs_rx.cpp
apps/ui_aprs_tx.cpp
apps/ui_battinfo.cpp
Expand Down
82 changes: 82 additions & 0 deletions firmware/application/external/adsbtx/main.cpp
Original file line number Diff line number Diff line change
@@ -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_adsb_tx.hpp"
#include "ui_navigation.hpp"
#include "external_app.hpp"

namespace ui::external_app::adsbtx {
void initialize_app(ui::NavigationView& nav) {
nav.push<ADSBTxView>();
}
} // namespace ui::external_app::adsbtx

extern "C" {

__attribute__((section(".external_app.app_adsbtx.application_information"), used)) application_information_t _application_information_adsbtx = {
/*.memory_location = */ (uint8_t*)0x00000000,
/*.externalAppEntry = */ ui::external_app::adsbtx::initialize_app,
/*.header_version = */ CURRENT_HEADER_VERSION,
/*.app_version = */ VERSION_MD5,

/*.app_name = */ "ADSB-TX",
/*.bitmap_data = */ {
0x80,
0x01,
0xC0,
0x03,
0xC0,
0x03,
0xC0,
0x03,
0xC0,
0x03,
0xE0,
0x07,
0xF8,
0x1F,
0xFE,
0x7F,
0xFF,
0xFF,
0xFF,
0xFF,
0xC0,
0x03,
0xC0,
0x03,
0xC0,
0x03,
0xE0,
0x07,
0xF0,
0x0F,
0xF8,
0x1F,
},
/*.icon_color = */ ui::Color::green().v,
/*.menu_location = */ app_location_t::TX,

/*.m4_app_tag = portapack::spi_flash::image_tag_adsbtx */ {'P', 'A', 'D', 'T'},
/*.m4_app_offset = */ 0x00000000, // will be filled at compile time
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
using namespace adsb;
using namespace portapack;

namespace ui {
namespace ui::external_app::adsbtx {

Compass::Compass(
const Point parent_pos)
Expand Down Expand Up @@ -311,7 +311,8 @@ void ADSBTxView::start_tx() {
ADSBTxView::ADSBTxView(
NavigationView& nav)
: nav_{nav} {
baseband::run_image(portapack::spi_flash::image_tag_adsb_tx);
// baseband::run_image(portapack::spi_flash::image_tag_adsb_tx);
baseband::run_prepared_image(portapack::memory::map::m4_code.base());

add_children({&tab_view,
&labels,
Expand Down Expand Up @@ -341,4 +342,4 @@ ADSBTxView::ADSBTxView(
};
}

} /* namespace ui */
} /* namespace ui::external_app::adsbtx */
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

using namespace adsb;

namespace ui {
namespace ui::external_app::adsbtx {

class Compass : public Widget {
public:
Expand Down Expand Up @@ -251,4 +251,4 @@ class ADSBTxView : public View {
std::unique_ptr<ADSBTXThread> tx_thread{};
};

} /* namespace ui */
} // namespace ui::external_app::adsbtx
5 changes: 5 additions & 0 deletions firmware/application/external/external.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ set(EXTCPPSRC
#protoview
external/protoview/main.cpp
external/protoview/ui_protoview.cpp

#adsbtx
external/adsbtx/main.cpp
external/adsbtx/ui_adsb_tx.cpp
)

set(EXTAPPLIST
Expand All @@ -107,4 +111,5 @@ set(EXTAPPLIST
wardrivemap
tpmsrx
protoview
adsbtx
)
7 changes: 7 additions & 0 deletions firmware/application/external/external.ld
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ MEMORY
ram_external_app_wardrivemap(rwx) : org = 0xADC20000, len = 32k
ram_external_app_tpmsrx(rwx) : org = 0xADC30000, len = 32k
ram_external_app_protoview(rwx) : org = 0xADC40000, len = 32k
ram_external_app_adsbtx(rwx) : org = 0xADC50000, len = 32k
}

SECTIONS
Expand Down Expand Up @@ -168,5 +169,11 @@ SECTIONS
*(*ui*external_app*protoview*);
} > ram_external_app_protoview

.external_app_adsbtx : ALIGN(4) SUBALIGN(4)
{
KEEP(*(.external_app.app_adsbtx.application_information));
*(*ui*external_app*adsbtx*);
} > ram_external_app_adsbtx


}
4 changes: 2 additions & 2 deletions firmware/application/ui_navigation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

#include "ui_about_simple.hpp"
#include "ui_adsb_rx.hpp"
#include "ui_adsb_tx.hpp"
// #include "ui_adsb_tx.hpp" //moved to ext
#include "ui_aprs_rx.hpp"
#include "ui_aprs_tx.hpp"
#include "ui_bht_tx.hpp"
Expand Down Expand Up @@ -181,7 +181,7 @@ const NavigationView::AppList NavigationView::appList = {
//{"sstv", "SSTV", RX, Color::dark_grey(), &bitmap_icon_sstv, new ViewFactory<NotImplementedView>()},
//{"tetra", "TETRA", RX, Color::dark_grey(), &bitmap_icon_tetra, new ViewFactory<NotImplementedView>()},
/* TX ********************************************************************/
{"adsbtx", "ADS-B TX", TX, ui::Color::green(), &bitmap_icon_adsb, new ViewFactory<ADSBTxView>()},
//{"adsbtx", "ADS-B TX", TX, ui::Color::green(), &bitmap_icon_adsb, new ViewFactory<ADSBTxView>()},
{"aprstx", "APRS TX", TX, ui::Color::green(), &bitmap_icon_aprs, new ViewFactory<APRSTXView>()},
{"bht", "BHT Xy/EP", TX, ui::Color::green(), &bitmap_icon_bht, new ViewFactory<BHTView>()},
{"bletx", "BLE Tx", TX, ui::Color::green(), &bitmap_icon_btle, new ViewFactory<BLETxView>()},
Expand Down
14 changes: 8 additions & 6 deletions firmware/baseband/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -328,12 +328,6 @@ set(MODE_CPPSRC
)
DeclareTargets(PADR adsbrx)

### ADS-B TX

set(MODE_CPPSRC
proc_adsbtx.cpp
)
DeclareTargets(PADT adsbtx)

### AFSK TX

Expand Down Expand Up @@ -665,6 +659,14 @@ set(MODE_CPPSRC
DeclareTargets(PTPM tpms)


### ADS-B TX

set(MODE_CPPSRC
proc_adsbtx.cpp
)
DeclareTargets(PADT adsbtx)


### HackRF "factory" firmware

add_custom_command(
Expand Down

0 comments on commit df39818

Please sign in to comment.