2015-09-10 18:36:39 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
2016-12-09 17:21:47 +00:00
|
|
|
* Copyright (C) 2016 Furrtek
|
2015-09-10 18:36:39 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2017-07-18 18:31:05 +00:00
|
|
|
#ifndef __SIGGEN_H__
|
|
|
|
#define __SIGGEN_H__
|
|
|
|
|
2023-06-11 18:47:13 +00:00
|
|
|
#include "app_settings.hpp"
|
2023-06-14 07:57:20 +00:00
|
|
|
#include "radio_state.hpp"
|
2015-09-10 18:36:39 +00:00
|
|
|
#include "ui.hpp"
|
|
|
|
#include "ui_widget.hpp"
|
|
|
|
#include "ui_navigation.hpp"
|
2017-04-18 11:55:49 +00:00
|
|
|
#include "ui_transmitter.hpp"
|
2017-07-18 18:31:05 +00:00
|
|
|
|
|
|
|
#include "portapack.hpp"
|
2015-09-10 18:36:39 +00:00
|
|
|
#include "message.hpp"
|
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
2017-07-18 18:31:05 +00:00
|
|
|
class SigGenView : public View {
|
2023-05-18 20:16:05 +00:00
|
|
|
public:
|
|
|
|
SigGenView(NavigationView& nav);
|
|
|
|
~SigGenView();
|
|
|
|
|
|
|
|
void focus() override;
|
|
|
|
|
|
|
|
std::string title() const override { return "Signal gen"; };
|
|
|
|
|
|
|
|
private:
|
|
|
|
void start_tx();
|
|
|
|
void update_config();
|
|
|
|
void update_tone();
|
|
|
|
void on_tx_progress(const uint32_t progress, const bool done);
|
|
|
|
|
2023-06-14 07:57:20 +00:00
|
|
|
TxRadioState radio_state_{
|
2023-10-14 16:33:52 +00:00
|
|
|
0 /* frequency */,
|
2023-06-14 07:57:20 +00:00
|
|
|
1750000 /* bandwidth */,
|
|
|
|
1536000 /* sampling rate */
|
|
|
|
};
|
2023-06-11 18:47:13 +00:00
|
|
|
app_settings::SettingsManager settings_{
|
|
|
|
"tx_siggen", app_settings::Mode::TX};
|
|
|
|
|
2023-10-30 10:32:34 +00:00
|
|
|
const std::string shape_strings[9] = {
|
|
|
|
"CW (No mod.) ",
|
|
|
|
"Sine mod. FM",
|
|
|
|
"Triangle mod.FM", // max 15 character text space.
|
|
|
|
"Saw up mod. FM",
|
|
|
|
"Saw down mod.FM",
|
|
|
|
"Square mod. FM",
|
|
|
|
"Pseudo Noise FM", // using 16 bits LFSR register, 16 order polynomial feedback.
|
|
|
|
"BPSK 0,1,0,1...",
|
|
|
|
"QPSK 00-01-10.."};
|
2023-05-18 20:16:05 +00:00
|
|
|
|
|
|
|
bool auto_update{false};
|
|
|
|
|
|
|
|
Labels labels{
|
|
|
|
{{3 * 8, 4 + 10}, "Shape:", Color::light_grey()},
|
|
|
|
{{6 * 8, 7 * 8}, "Tone: Hz", Color::light_grey()},
|
|
|
|
{{22 * 8, 15 * 8 + 4}, "s.", Color::light_grey()},
|
|
|
|
{{8 * 8, 20 * 8}, "Modulation: FM", Color::light_grey()}};
|
|
|
|
|
|
|
|
ImageOptionsField options_shape{
|
|
|
|
{10 * 8, 4, 32, 32},
|
|
|
|
Color::white(),
|
|
|
|
Color::black(),
|
|
|
|
{{&bitmap_sig_cw, 0},
|
|
|
|
{&bitmap_sig_sine, 1},
|
|
|
|
{&bitmap_sig_tri, 2},
|
|
|
|
{&bitmap_sig_saw_up, 3},
|
|
|
|
{&bitmap_sig_saw_down, 4},
|
|
|
|
{&bitmap_sig_square, 5},
|
2023-10-30 10:32:34 +00:00
|
|
|
{&bitmap_sig_noise, 6},
|
|
|
|
{&bitmap_sig_noise, 7}, // Pending to add a correct BPSK icon.
|
|
|
|
{&bitmap_sig_noise, 8}}}; // Pending to add a correct QPSK icon.
|
2023-05-18 20:16:05 +00:00
|
|
|
|
|
|
|
Text text_shape{
|
2023-10-28 06:28:17 +00:00
|
|
|
{15 * 8, 4 + 10, 15 * 8, 16},
|
2023-05-18 20:16:05 +00:00
|
|
|
""};
|
|
|
|
|
|
|
|
SymField symfield_tone{
|
2023-09-12 19:38:19 +00:00
|
|
|
{12 * 8, 7 * 8},
|
|
|
|
5};
|
2023-05-18 20:16:05 +00:00
|
|
|
|
|
|
|
Button button_update{
|
|
|
|
{5 * 8, 10 * 8, 8 * 8, 3 * 8},
|
|
|
|
"Update"};
|
|
|
|
|
|
|
|
Checkbox checkbox_auto{
|
|
|
|
{15 * 8, 10 * 8},
|
|
|
|
4,
|
|
|
|
"Auto"};
|
|
|
|
|
|
|
|
Checkbox checkbox_stop{
|
|
|
|
{5 * 8, 15 * 8},
|
|
|
|
10,
|
|
|
|
"Stop after"};
|
|
|
|
|
|
|
|
NumberField field_stop{
|
|
|
|
{20 * 8, 15 * 8 + 4},
|
|
|
|
2,
|
|
|
|
{1, 99},
|
|
|
|
1,
|
|
|
|
' '};
|
|
|
|
|
|
|
|
TransmitterView tx_view{
|
|
|
|
16 * 16,
|
|
|
|
10000,
|
|
|
|
12};
|
|
|
|
|
|
|
|
MessageHandlerRegistration message_handler_tx_progress{
|
|
|
|
Message::ID::TXProgress,
|
|
|
|
[this](const Message* const p) {
|
|
|
|
const auto message = *reinterpret_cast<const TXProgressMessage*>(p);
|
|
|
|
this->on_tx_progress(message.progress, message.done);
|
|
|
|
}};
|
2015-09-10 18:36:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace ui */
|
2017-07-18 18:31:05 +00:00
|
|
|
|
2023-05-18 20:16:05 +00:00
|
|
|
#endif /*__SIGGEN_H__*/
|