Files
mayhem-firmware/firmware/application/external/same_tx/main.cpp
T
Sarah Rose bae3854d27 Add SAME TX external app (#3069)
* Add SAME TX external app

Adds a Specific Area Message Encoding (SAME/EAS) transmitter as an
external app (.ppma) for HackRF PortaPack.

SAME is the digital protocol used by NOAA Weather Radio and the
Emergency Alert System in the US and Canada for broadcasting
emergency alerts (tornado warnings, flash floods, EAN, etc.)
on 162.400-162.550 MHz and AM/FM broadcast stations.

Features:
- Originator code selector (WXR, EAS, CIV, PEP)
- Event code selector: 26 standard SAME event codes
  (RWT, TOR, SVR, FFW, EAN, etc.) with live name display
- FIPS location code entry (state 00-99 + county 000-999)
- Purge time entry (hours + minutes)
- Live message preview showing the encoded header
- AFSK encoding: mark=2083Hz, space=1563Hz, 520.833 baud
- FM deviation: 5 kHz, repeated 3x per SAME spec
- Default frequency: 162.550 MHz (WX channel 7)

Protocol details:
- 16-byte 0xAB preamble (bit-reversed for LSB-first AFSK)
- Header: ZCZC-ORG-EVT-SSPCCC+HHMM-JJJHHMM-STATION-
- Uses existing PAFT (proc_afsk) baseband image

* Apply clang-format via format-code.sh

* Add GPL license headers, guard re-entry, call set_transmitting(true)

- Add standard PortaPack GPL-2.0 license header to ui_same_tx.cpp and .hpp
- Guard start_tx() with tx_active_ to prevent re-entrant calls
- Call tx_view.set_transmitting(true) after starting TX so the
  TransmitterView button switches to stop mode
2026-03-05 19:49:17 +13:00

80 lines
2.0 KiB
C++

/*
* SAME TX - Specific Area Message Encoding Transmitter
*
* 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.
*/
#include "ui.hpp"
#include "ui_same_tx.hpp"
#include "ui_navigation.hpp"
#include "external_app.hpp"
namespace ui::external_app::same_tx {
void initialize_app(ui::NavigationView& nav) {
nav.push<SameTxView>();
}
} // namespace ui::external_app::same_tx
extern "C" {
__attribute__((section(".external_app.app_same_tx.application_information"), used)) application_information_t _application_information_same_tx = {
/*.memory_location = */ (uint8_t*)0x00000000,
/*.externalAppEntry = */ ui::external_app::same_tx::initialize_app,
/*.header_version = */ CURRENT_HEADER_VERSION,
/*.app_version = */ VERSION_MD5,
/*.app_name = */ "SAME TX",
/*.bitmap_data = */ {
// 16x16 icon - simple "!" alert symbol
0x00,
0x00,
0x18,
0x00,
0x3C,
0x00,
0x3C,
0x00,
0x3C,
0x00,
0x3C,
0x00,
0x18,
0x00,
0x18,
0x00,
0x00,
0x00,
0x18,
0x00,
0x3C,
0x00,
0x3C,
0x00,
0x18,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
},
/*.icon_color = */ ui::Color::orange().v,
/*.menu_location = */ app_location_t::TX,
/*.desired_menu_position = */ -1,
/*.m4_app_tag = portapack::spi_flash::image_tag_afsk */ {'P', 'A', 'F', 'T'},
/*.m4_app_offset = */ 0x00000000,
};
}