mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-01-12 13:53:39 +00:00
Utility: CW generator
This commit is contained in:
parent
aa29348562
commit
0642c57041
@ -1,5 +0,0 @@
|
||||
![Stealth mode icon](stealth.png)
|
||||
|
||||
If enabled (green), transmitting will be done with the screen's backlight off.
|
||||
The TX LED will also be blinking to indicate activity.
|
||||
Turn the backlight on again by pressing any button.
|
@ -159,6 +159,7 @@ set(CPPSRC
|
||||
ui_bht_tx.cpp
|
||||
ui_channel.cpp
|
||||
ui_closecall.cpp
|
||||
ui_cw.cpp
|
||||
ui_debug.cpp
|
||||
ui_encoders.cpp
|
||||
ui_font_fixed_8x16.cpp
|
||||
|
@ -29,9 +29,18 @@
|
||||
|
||||
//TEST: Imperial in whipcalc
|
||||
|
||||
//TODO: Morse transmition time estimate
|
||||
//TODO: Morse live keying mode ?
|
||||
/*
|
||||
Keying speed: 60 or 75 PARIS
|
||||
Continuous (Fox-oring)
|
||||
12s transmit, 48s space (Sprint 1/5th)
|
||||
60s transmit, 240s space (Classic 1/5 min)
|
||||
60s transmit, 360s space (Classic 1/7 min)
|
||||
*/
|
||||
//TODO: Use transmittermodel bw setting
|
||||
//TODO: Use Labels widget wherever possible
|
||||
//TODO: Use TransmitterView in Morse, TEDI/LCR, Numbers, whistle, jammer...
|
||||
//TODO: Use TransmitterView in TEDI/LCR, Numbers, whistle, ...
|
||||
//TODO: FreqMan: Add and rename categories
|
||||
//TODO: FreqMan: Sort by category in edit screen
|
||||
//TODO: FreqMan: Cap entry count per category (only done for total entries right now)
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
void on_show() override;
|
||||
void on_hide() override;
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "Close Call"; };
|
||||
|
||||
private:
|
||||
@ -75,7 +76,7 @@ private:
|
||||
uint8_t slices_counter { 0 };
|
||||
int16_t last_channel { 0 };
|
||||
uint32_t weight { 0 };
|
||||
uint64_t frequency_acc { 0 };
|
||||
int64_t frequency_acc { 0 };
|
||||
rf::Frequency scan_span { 0 }, resolved_frequency { 0 };
|
||||
uint16_t locked_imax { 0 };
|
||||
uint8_t slicemax_pow[32]; // Todo: Cap max slices !
|
||||
|
84
firmware/application/ui_cw.cpp
Normal file
84
firmware/application/ui_cw.cpp
Normal file
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||
* Copyright (C) 2016 Furrtek
|
||||
*
|
||||
* 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_cw.hpp"
|
||||
|
||||
#include "portapack.hpp"
|
||||
#include "baseband_api.hpp"
|
||||
|
||||
#include <cstring>
|
||||
#include <stdio.h>
|
||||
|
||||
using namespace portapack;
|
||||
|
||||
namespace ui {
|
||||
|
||||
void CWTXView::focus() {
|
||||
tx_view.focus();
|
||||
}
|
||||
|
||||
CWTXView::~CWTXView() {
|
||||
transmitter_model.disable();
|
||||
baseband::shutdown();
|
||||
}
|
||||
|
||||
void CWTXView::start_tx() {
|
||||
transmitter_model.set_sampling_rate(1536000U); // Not important
|
||||
transmitter_model.set_rf_amp(true);
|
||||
transmitter_model.set_baseband_bandwidth(1750000); // Not important
|
||||
transmitter_model.enable();
|
||||
}
|
||||
|
||||
void CWTXView::stop_tx() {
|
||||
transmitter_model.disable();
|
||||
}
|
||||
|
||||
CWTXView::CWTXView(
|
||||
NavigationView& nav
|
||||
)
|
||||
{
|
||||
baseband::run_image(portapack::spi_flash::image_tag_noop);
|
||||
|
||||
add_children({
|
||||
&tx_view
|
||||
});
|
||||
|
||||
tx_view.on_edit_frequency = [this, &nav]() {
|
||||
auto new_view = nav.push<FrequencyKeypadView>(receiver_model.tuning_frequency());
|
||||
new_view->on_changed = [this](rf::Frequency f) {
|
||||
receiver_model.set_tuning_frequency(f);
|
||||
};
|
||||
};
|
||||
|
||||
tx_view.on_start = [this]() {
|
||||
start_tx();
|
||||
tx_view.set_transmitting(true);
|
||||
};
|
||||
|
||||
tx_view.on_stop = [this]() {
|
||||
stop_tx();
|
||||
tx_view.set_transmitting(false);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
} /* namespace ui */
|
58
firmware/application/ui_cw.hpp
Normal file
58
firmware/application/ui_cw.hpp
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||
* Copyright (C) 2016 Furrtek
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __CW_TX_H__
|
||||
#define __CW_TX_H__
|
||||
|
||||
#include "ui.hpp"
|
||||
#include "ui_widget.hpp"
|
||||
#include "ui_navigation.hpp"
|
||||
#include "ui_transmitter.hpp"
|
||||
|
||||
#include "portapack.hpp"
|
||||
#include "message.hpp"
|
||||
|
||||
namespace ui {
|
||||
|
||||
class CWTXView : public View {
|
||||
public:
|
||||
CWTXView(NavigationView& nav);
|
||||
~CWTXView();
|
||||
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "CW generator"; };
|
||||
|
||||
private:
|
||||
void start_tx();
|
||||
void stop_tx();
|
||||
|
||||
TransmitterView tx_view {
|
||||
8 * 16,
|
||||
10000,
|
||||
12
|
||||
};
|
||||
};
|
||||
|
||||
} /* namespace ui */
|
||||
|
||||
#endif/*__CW_TX_H__*/
|
@ -20,14 +20,6 @@
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
Keying speed: 60 or 75 PARIS
|
||||
Continuous (Fox-oring)
|
||||
12s transmit, 48s space (Sprint 1/5th)
|
||||
60s transmit, 240s space (Classic 1/5 min)
|
||||
60s transmit, 360s space (Classic 1/7 min)
|
||||
*/
|
||||
|
||||
#include "ui_morse.hpp"
|
||||
|
||||
#include "portapack.hpp"
|
||||
@ -43,8 +35,6 @@ using namespace portapack;
|
||||
using namespace morse;
|
||||
using namespace hackrf::one;
|
||||
|
||||
// TODO: Live keying mode: Dit on left key, dah on right ?
|
||||
|
||||
namespace ui {
|
||||
|
||||
void MorseView::on_set_text(NavigationView& nav) {
|
||||
@ -66,32 +56,22 @@ void MorseView::paint(Painter&) {
|
||||
}
|
||||
|
||||
static WORKING_AREA(ookthread_wa, 256);
|
||||
|
||||
static msg_t ookthread_fn(void * arg) {
|
||||
uint32_t v = 0, delay = 0;
|
||||
size_t i = 0;
|
||||
uint8_t * message = shared_memory.bb_data.tones_data.message;
|
||||
uint8_t symbol;
|
||||
MorseView * arg_c = (MorseView*)arg;
|
||||
|
||||
chRegSetThreadName("ookthread");
|
||||
for (i = 0; i < arg_c->symbol_count; i++) {
|
||||
if (chThdShouldTerminate()) break;
|
||||
|
||||
if (message[i] == 0) {
|
||||
v = 1;
|
||||
delay = MORSE_DOT;
|
||||
} else if (message[i] == 1) {
|
||||
v = 1;
|
||||
delay = MORSE_DASH;
|
||||
} else if (message[i] == 2) {
|
||||
v = 0;
|
||||
delay = MORSE_SYMBOL_SPACE;
|
||||
} else if (message[i] == 3) {
|
||||
v = 0;
|
||||
delay = MORSE_LETTER_SPACE;
|
||||
} else if (message[i] == 4) {
|
||||
v = 0;
|
||||
delay = MORSE_WORD_SPACE;
|
||||
}
|
||||
symbol = message[i];
|
||||
|
||||
v = (symbol < 2) ? 1 : 0;
|
||||
delay = morse_symbols[v];
|
||||
|
||||
gpio_tx.write(v);
|
||||
arg_c->on_tx_progress(i, false);
|
||||
|
@ -54,6 +54,9 @@ public:
|
||||
void paint(Painter& painter) override;
|
||||
|
||||
void on_tx_progress(const int progress, const bool done);
|
||||
|
||||
std::string title() const override { return "Morse TX"; };
|
||||
|
||||
uint32_t time_unit_ms { 0 };
|
||||
size_t symbol_count { 0 };
|
||||
private:
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "ui_adsbtx.hpp"
|
||||
#include "ui_bht_tx.hpp"
|
||||
#include "ui_closecall.hpp"
|
||||
#include "ui_cw.hpp"
|
||||
#include "ui_debug.hpp"
|
||||
#include "ui_encoders.hpp"
|
||||
#include "ui_freqman.hpp"
|
||||
@ -305,10 +306,10 @@ TransmitterCodedMenuView::TransmitterCodedMenuView(NavigationView& nav) {
|
||||
add_items<8>({ {
|
||||
{ "ADS-B Mode S", ui::Color::orange(),&bitmap_icon_adsb, [&nav](){ nav.push<ADSBTxView>(); } },
|
||||
{ "BHT Xy/EP", ui::Color::yellow(),&bitmap_icon_bht, [&nav](){ nav.push<BHTView>(); } },
|
||||
{ "Morse beacon", ui::Color::yellow(),&bitmap_icon_morse, [&nav](){ nav.push<MorseView>(); } },
|
||||
{ "Morse code", ui::Color::green(), &bitmap_icon_morse, [&nav](){ nav.push<MorseView>(); } },
|
||||
{ "Nuoptix DTMF timecode", ui::Color::green(), &bitmap_icon_nuoptix, [&nav](){ nav.push<NuoptixView>(); } },
|
||||
{ "OOK remote encoders", ui::Color::green(), &bitmap_icon_remote, [&nav](){ nav.push<EncodersView>(); } },
|
||||
{ "POCSAG", ui::Color::cyan(), &bitmap_icon_pocsag, [&nav](){ nav.push<POCSAGTXView>(); } },
|
||||
{ "POCSAG", ui::Color::green(), &bitmap_icon_pocsag, [&nav](){ nav.push<POCSAGTXView>(); } },
|
||||
{ "RDS", ui::Color::green(), &bitmap_icon_rds, [&nav](){ nav.push<RDSView>(); } },
|
||||
{ "TEDI/LCR AFSK", ui::Color::green(), &bitmap_icon_lcr, [&nav](){ nav.push<LCRView>(); } },
|
||||
} });
|
||||
@ -330,8 +331,9 @@ TransmitterAudioMenuView::TransmitterAudioMenuView(NavigationView& nav) {
|
||||
/* UtilitiesView *****************************************************************/
|
||||
|
||||
UtilitiesView::UtilitiesView(NavigationView& nav) {
|
||||
add_items<4>({ {
|
||||
add_items<5>({ {
|
||||
{ "Frequency manager", ui::Color::green(), nullptr, [&nav](){ nav.push<FreqManView>(); } },
|
||||
{ "CW generator", ui::Color::green(), nullptr, [&nav](){ nav.push<CWTXView>(); } },
|
||||
{ "Whip antenna length", ui::Color::yellow(),nullptr, [&nav](){ nav.push<WhipCalcView>(); } },
|
||||
{ "Notepad", ui::Color::grey(), nullptr, [&nav](){ nav.push<NotImplementedView>(); } },
|
||||
{ "Wipe SD card", ui::Color::red(), nullptr, [&nav](){ nav.push<WipeSDView>(); } },
|
||||
|
@ -136,6 +136,9 @@ TransmitterView::TransmitterView(
|
||||
if (on_edit_frequency)
|
||||
on_edit_frequency();
|
||||
};
|
||||
field_frequency.on_change = [this](rf::Frequency f) {
|
||||
transmitter_model.set_tuning_frequency(f);
|
||||
};
|
||||
|
||||
button_start.on_select = [this](Button&){
|
||||
if (transmitting_) {
|
||||
|
@ -400,6 +400,14 @@ set(MODE_CPPSRC
|
||||
)
|
||||
DeclareTargets(PADS ads)
|
||||
|
||||
|
||||
### No op
|
||||
|
||||
set(MODE_CPPSRC
|
||||
proc_noop.cpp
|
||||
)
|
||||
DeclareTargets(PNOP no_operation)
|
||||
|
||||
### HackRF "factory" firmware
|
||||
|
||||
add_custom_command(
|
||||
|
38
firmware/baseband/proc_noop.cpp
Normal file
38
firmware/baseband/proc_noop.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
||||
* Copyright (C) 2016 Furrtek
|
||||
*
|
||||
* 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 "proc_noop.hpp"
|
||||
#include "event_m4.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
void NOOPProcessor::execute(const buffer_c8_t& buffer) {
|
||||
for (size_t i = 0; i<buffer.count; i++) {
|
||||
buffer.p[i] = {0, 0};
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
EventDispatcher event_dispatcher { std::make_unique<NOOPProcessor>() };
|
||||
event_dispatcher.run();
|
||||
return 0;
|
||||
}
|
37
firmware/baseband/proc_noop.hpp
Normal file
37
firmware/baseband/proc_noop.hpp
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
||||
* Copyright (C) 2016 Furrtek
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __PROC_NOOP_H__
|
||||
#define __PROC_NOOP_H__
|
||||
|
||||
#include "baseband_processor.hpp"
|
||||
#include "baseband_thread.hpp"
|
||||
|
||||
class NOOPProcessor : public BasebandProcessor {
|
||||
public:
|
||||
void execute(const buffer_c8_t& buffer) override;
|
||||
|
||||
private:
|
||||
BasebandThread baseband_thread { 1536000, this, NORMALPRIO + 20, baseband::Direction::Transmit };
|
||||
};
|
||||
|
||||
#endif
|
@ -72,16 +72,14 @@ size_t morse_encode(std::string& message, const uint32_t time_unit_ms, const uin
|
||||
memcpy(shared_memory.bb_data.tones_data.message, morse_message, i);
|
||||
|
||||
// Setup tone "symbols"
|
||||
tone_defs[0].delta = TONES_F2D(tone); // 0: Dot
|
||||
tone_defs[0].duration = (TONES_SAMPLERATE * MORSE_DOT * time_unit_ms) / 1000;
|
||||
tone_defs[1].delta = TONES_F2D(tone); // 1: Dash
|
||||
tone_defs[1].duration = (TONES_SAMPLERATE * MORSE_DASH * time_unit_ms) / 1000;
|
||||
tone_defs[2].delta = 0; // 2: Symbol space
|
||||
tone_defs[2].duration = (TONES_SAMPLERATE * MORSE_SYMBOL_SPACE * time_unit_ms) / 1000;
|
||||
tone_defs[3].delta = 0; // 3: Letter space
|
||||
tone_defs[3].duration = (TONES_SAMPLERATE * MORSE_LETTER_SPACE * time_unit_ms) / 1000;
|
||||
tone_defs[4].delta = 0; // 4: Word space
|
||||
tone_defs[4].duration = (TONES_SAMPLERATE * MORSE_WORD_SPACE * time_unit_ms) / 1000;
|
||||
for (c = 0; c < 5; c++) {
|
||||
if (c < 2)
|
||||
tone_defs[c].delta = TONES_F2D(tone); // Dot and dash
|
||||
else
|
||||
tone_defs[c].delta = 0; // Pause
|
||||
|
||||
tone_defs[c].duration = (TONES_SAMPLERATE * morse_symbols[c] * time_unit_ms) / 1000;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
@ -35,6 +35,14 @@
|
||||
|
||||
namespace morse {
|
||||
|
||||
const uint32_t morse_symbols[5] = {
|
||||
MORSE_DOT,
|
||||
MORSE_DASH,
|
||||
MORSE_SYMBOL_SPACE,
|
||||
MORSE_LETTER_SPACE,
|
||||
MORSE_WORD_SPACE
|
||||
};
|
||||
|
||||
size_t morse_encode(std::string& message, const uint32_t time_unit_ms, const uint32_t tone);
|
||||
|
||||
const std::string foxhunt_codes[11] = {
|
||||
|
@ -84,6 +84,8 @@ constexpr image_tag_t image_tag_adsb_tx { 'P', 'A', 'D', 'S' };
|
||||
constexpr image_tag_t image_tag_replay { 'P', 'R', 'E', 'P' };
|
||||
constexpr image_tag_t image_tag_fsktx { 'P', 'F', 'S', 'K' };
|
||||
|
||||
constexpr image_tag_t image_tag_noop { 'P', 'N', 'O', 'P' };
|
||||
|
||||
constexpr image_tag_t image_tag_hackrf { 'H', 'R', 'F', '1' };
|
||||
|
||||
struct chunk_t {
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user