diff --git a/firmware/application/Makefile b/firmware/application/Makefile index 2e5bb800..a7efa837 100755 --- a/firmware/application/Makefile +++ b/firmware/application/Makefile @@ -172,6 +172,7 @@ CPPSRC = main.cpp \ ui_spectrum.cpp \ ui_loadmodule.cpp \ ui_afskrx.cpp \ + ui_afsksetup.cpp \ ui_sigfrx.cpp \ ui_xylos.cpp \ ui_numbers.cpp \ @@ -246,7 +247,7 @@ INCDIR = ../common $(PORTINC) $(KERNINC) $(TESTINC) \ MCU = cortex-m0 #TRGT = arm-elf- -TRGT = arm-none-eabi- +TRGT = /usr/local/gcc-arm-none-eabi-5_2-2015q4/bin/arm-none-eabi- CC = $(TRGT)gcc CPPC = $(TRGT)g++ # Enable loading with g++ only if you need C++ runtime support. diff --git a/firmware/application/portapack.cpp b/firmware/application/portapack.cpp index c185962c..8f107c3c 100644 --- a/firmware/application/portapack.cpp +++ b/firmware/application/portapack.cpp @@ -65,11 +65,7 @@ ReceiverModel receiver_model; TemperatureLogger temperature_logger; -TemperatureLogger temperature_logger; - -TransmitterModel transmitter_model { - clock_manager -}; +TransmitterModel transmitter_model; uint8_t bl_tick_counter = 0; diff --git a/firmware/application/transmitter_model.hpp b/firmware/application/transmitter_model.hpp index f941e294..43a385ed 100644 --- a/firmware/application/transmitter_model.hpp +++ b/firmware/application/transmitter_model.hpp @@ -34,8 +34,7 @@ class TransmitterModel { public: constexpr TransmitterModel( - ClockManager& clock_manager - ) : clock_manager(clock_manager) + ) { } @@ -77,7 +76,6 @@ private: .sampling_rate = 2280000, .decimation_factor = 1, }; - ClockManager& clock_manager; int32_t tuning_offset(); diff --git a/firmware/application/ui_afsksetup.cpp b/firmware/application/ui_afsksetup.cpp index e445b344..334f4425 100644 --- a/firmware/application/ui_afsksetup.cpp +++ b/firmware/application/ui_afsksetup.cpp @@ -29,6 +29,7 @@ #include "hackrf_gpio.hpp" #include "portapack.hpp" #include "radio.hpp" +#include "string_format.hpp" #include "hackrf_hal.hpp" #include "portapack_shared_memory.hpp" @@ -37,7 +38,7 @@ #include #include -using namespace hackrf::one; +using namespace portapack; namespace ui { @@ -103,7 +104,7 @@ AFSKSetupView::AFSKSetupView( field_repeat.set_value(rpt); button_setfreq.on_select = [this,&nav](Button&){ - auto new_view = new FrequencyKeypadView { nav, this->transmitter_model.tuning_frequency() }; + auto new_view = new FrequencyKeypadView { nav, transmitter_model.tuning_frequency() }; new_view->on_changed = [this](rf::Frequency f) { updfreq(f); }; diff --git a/firmware/application/ui_afsksetup.hpp b/firmware/application/ui_afsksetup.hpp index 0862d518..6b4d7e71 100644 --- a/firmware/application/ui_afsksetup.hpp +++ b/firmware/application/ui_afsksetup.hpp @@ -107,14 +107,17 @@ private: Checkbox checkbox_lsb { { 8, 150 }, + 9, "LSB first" }; Checkbox checkbox_parity { { 8, 180 }, + 11, "Even parity" }; Checkbox checkbox_datasize { { 8, 210 }, + 6, "8 bits" }; diff --git a/firmware/application/ui_jammer.hpp b/firmware/application/ui_jammer.hpp index ac30ce01..9edbf155 100644 --- a/firmware/application/ui_jammer.hpp +++ b/firmware/application/ui_jammer.hpp @@ -191,14 +191,17 @@ private: Checkbox checkbox_range1 { { 1 * 8, 6 * 16}, + 7, "Range 1" }; Checkbox checkbox_range2 { { 1 * 8, 9 * 16 + 4}, + 7, "Range 2" }; Checkbox checkbox_range3 { { 1 * 8, 12 * 16 + 8 }, + 7, "Range 3" }; diff --git a/firmware/application/ui_lcr.hpp b/firmware/application/ui_lcr.hpp index 76543c64..9a83b336 100644 --- a/firmware/application/ui_lcr.hpp +++ b/firmware/application/ui_lcr.hpp @@ -85,6 +85,7 @@ private: Checkbox checkbox_am_a { { 16, 68 }, + 20, "" }; Button button_setam_a { @@ -93,6 +94,7 @@ private: }; Checkbox checkbox_am_b { { 16, 68+40 }, + 20, "" }; Button button_setam_b { @@ -101,7 +103,8 @@ private: }; Checkbox checkbox_am_c { { 16, 68+40+40 }, - "" + 20, + " " }; Button button_setam_c { { 48, 64+40+40, 48, 32 }, @@ -109,6 +112,7 @@ private: }; Checkbox checkbox_am_d { { 16, 68+40+40+40 }, + 20, "" }; Button button_setam_d { @@ -117,6 +121,7 @@ private: }; Checkbox checkbox_am_e { { 16, 68+40+40+40+40 }, + 20, "" }; Button button_setam_e { diff --git a/firmware/application/ui_navigation.cpp b/firmware/application/ui_navigation.cpp index cbd3d572..103a3505 100644 --- a/firmware/application/ui_navigation.cpp +++ b/firmware/application/ui_navigation.cpp @@ -163,7 +163,7 @@ TranspondersMenuView::TranspondersMenuView(NavigationView& nav) { ReceiverMenuView::ReceiverMenuView(NavigationView& nav) { add_items<2>({ { - { "Audio", ui::Color::white(), [&nav](){ nav.push(); } }, + { "Audio", ui::Color::white(), [&nav](){ nav.push(); } }, { "Transponders", ui::Color::white(), [&nav](){ nav.push(); } }, } }); } @@ -270,6 +270,29 @@ HackRFFirmwareView::HackRFFirmwareView(NavigationView& nav) { } }); } +/* ***********************************************************************/ + +void BMPView::focus() { + button_done.focus(); +} + +BMPView::BMPView(NavigationView& nav) { + add_children({ { + &text_info, + &button_done + } }); + + button_done.on_select = [this,&nav](Button&){ + nav.pop(); + nav.push(new SystemMenuView { nav }); + }; +} + +void BMPView::paint(Painter& painter) { + (void)painter; + portapack::display.drawBMP({(240-185)/2, 0}, splash_bmp); +} + /* PlayDeadView **********************************************************/ void PlayDeadView::focus() { diff --git a/firmware/application/ui_setup.cpp b/firmware/application/ui_setup.cpp index 641be01b..abb0a3c7 100644 --- a/firmware/application/ui_setup.cpp +++ b/firmware/application/ui_setup.cpp @@ -170,19 +170,18 @@ void AntennaBiasSetupView::focus() { button_done.focus(); } -AboutView::AboutView(NavigationView& nav) { - add_children({ { +SetTouchCalibView::SetTouchCalibView(NavigationView& nav) { + add_children({{ &text_title, - &text_firmware, - &text_cpld_hackrf, - &text_cpld_portapack, - &button_ok, - } }); + &text_debugx, + &text_debugy, + &button_ok + }}); button_ok.on_select = [&nav](Button&){ nav.pop(); }; } -void AboutView::focus() { +void SetTouchCalibView::focus() { button_ok.focus(); } diff --git a/firmware/application/ui_setup.hpp b/firmware/application/ui_setup.hpp index 9f650b43..0d25baeb 100644 --- a/firmware/application/ui_setup.hpp +++ b/firmware/application/ui_setup.hpp @@ -261,11 +261,13 @@ public: private: Checkbox checkbox_showsplash { { 3 * 8, 2 * 16}, + 11, "Show splash" }; Checkbox checkbox_bloff { { 3 * 8, 4 * 16}, + 20, "Backlight off after:" }; diff --git a/firmware/application/ui_whistle.hpp b/firmware/application/ui_whistle.hpp index 94b0215c..f2d8d1ee 100644 --- a/firmware/application/ui_whistle.hpp +++ b/firmware/application/ui_whistle.hpp @@ -74,6 +74,7 @@ private: Checkbox checkbox_am_a { { 16, 68 }, + 20, "" }; diff --git a/firmware/application/ui_xylos.hpp b/firmware/application/ui_xylos.hpp index 37fd8fb7..586dbb54 100644 --- a/firmware/application/ui_xylos.hpp +++ b/firmware/application/ui_xylos.hpp @@ -230,6 +230,7 @@ private: }; Checkbox checkbox_wcsubfamily { { 20 * 8, 5 * 16}, + 6, "Toutes" }; @@ -246,6 +247,7 @@ private: }; Checkbox checkbox_wcid { { 20 * 8, 7 * 16 + 4}, + 4, "Tous" }; @@ -323,6 +325,7 @@ private: Checkbox checkbox_cligno { { 96, 16 * 16 + 4}, + 3, "J/N" }; diff --git a/firmware/baseband-tx.bin b/firmware/baseband-tx.bin index 226a8ead..90778ae5 100644 Binary files a/firmware/baseband-tx.bin and b/firmware/baseband-tx.bin differ diff --git a/firmware/baseband-tx/Makefile b/firmware/baseband-tx/Makefile index 8ce24acb..4f92b720 100755 --- a/firmware/baseband-tx/Makefile +++ b/firmware/baseband-tx/Makefile @@ -201,7 +201,7 @@ INCDIR = ../common $(PORTINC) $(KERNINC) $(TESTINC) \ MCU = cortex-m4 #TRGT = arm-elf- -TRGT = arm-none-eabi- +TRGT = /usr/local/gcc-arm-none-eabi-5_2-2015q4/bin/arm-none-eabi- CC = $(TRGT)gcc CPPC = $(TRGT)g++ # Enable loading with g++ only if you need C++ runtime support. diff --git a/firmware/baseband/proc_afskrx.cpp b/firmware/baseband-tx/proc_afskrx.cpp similarity index 100% rename from firmware/baseband/proc_afskrx.cpp rename to firmware/baseband-tx/proc_afskrx.cpp diff --git a/firmware/baseband/proc_afskrx.hpp b/firmware/baseband-tx/proc_afskrx.hpp similarity index 100% rename from firmware/baseband/proc_afskrx.hpp rename to firmware/baseband-tx/proc_afskrx.hpp diff --git a/firmware/baseband/proc_sigfrx.cpp b/firmware/baseband-tx/proc_sigfrx.cpp similarity index 100% rename from firmware/baseband/proc_sigfrx.cpp rename to firmware/baseband-tx/proc_sigfrx.cpp diff --git a/firmware/baseband/proc_sigfrx.hpp b/firmware/baseband-tx/proc_sigfrx.hpp similarity index 100% rename from firmware/baseband/proc_sigfrx.hpp rename to firmware/baseband-tx/proc_sigfrx.hpp diff --git a/firmware/baseband.bin b/firmware/baseband.bin index 41e3840f..93fc07b5 100644 Binary files a/firmware/baseband.bin and b/firmware/baseband.bin differ diff --git a/firmware/baseband/Makefile b/firmware/baseband/Makefile index d6a2c04c..816809b6 100755 --- a/firmware/baseband/Makefile +++ b/firmware/baseband/Makefile @@ -1,3 +1,4 @@ + # # Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc. # @@ -144,8 +145,6 @@ CPPSRC = main.cpp \ proc_wideband_spectrum.cpp \ proc_tpms.cpp \ proc_ert.cpp \ - proc_afskrx.cpp \ - proc_sigfrx.cpp \ dsp_squelch.cpp \ clock_recovery.cpp \ packet_builder.cpp \ @@ -204,7 +203,7 @@ INCDIR = ../common $(PORTINC) $(KERNINC) $(TESTINC) \ MCU = cortex-m4 #TRGT = arm-elf- -TRGT = arm-none-eabi- +TRGT = /usr/local/gcc-arm-none-eabi-5_2-2015q4/bin/arm-none-eabi- CC = $(TRGT)gcc CPPC = $(TRGT)g++ # Enable loading with g++ only if you need C++ runtime support. diff --git a/firmware/baseband/baseband_dma.hpp b/firmware/baseband/baseband_dma.hpp index 99e32de8..cc41a751 100644 --- a/firmware/baseband/baseband_dma.hpp +++ b/firmware/baseband/baseband_dma.hpp @@ -45,7 +45,6 @@ bool is_enabled(); void disable(); baseband::buffer_t wait_for_rx_buffer(); -baseband::buffer_t wait_for_tx_buffer(); } /* namespace dma */ } /* namespace baseband */ diff --git a/firmware/baseband/dsp_iir.cpp b/firmware/baseband/dsp_iir.cpp deleted file mode 100644 index 443183ba..00000000 --- a/firmware/baseband/dsp_iir.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc. - * - * 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 "dsp_iir.hpp" - -#include - -void IIRBiquadFilter::configure(const iir_biquad_config_t& new_config) { - config = new_config; -} - -void IIRBiquadFilter::execute(const buffer_f32_t& buffer_in, const buffer_f32_t& buffer_out) { - const auto a_ = config.a; - const auto b_ = config.b; - - auto x_ = x; - auto y_ = y; - - // TODO: Assert that buffer_out.count == buffer_in.count. - for(size_t i=0; i #include @@ -7,6 +8,8 @@ #include "string_format.hpp" +using namespace portapack; + namespace ui { static bool ui_dirty = true; @@ -298,6 +301,16 @@ void Text::paint(Painter& painter) { /* Checkbox **************************************************************/ +Checkbox::Checkbox( + Point parent_pos, + size_t length, + std::string text +) : Widget { { parent_pos, { static_cast((8 * length) + 24), 24 } } }, + text_ { text } +{ + flags.focusable = true; +} + void Checkbox::set_text(const std::string value) { text_ = value; set_dirty(); @@ -375,7 +388,6 @@ bool Checkbox::on_touch(const TouchEvent event) { set_dirty(); return true; - case TouchEvent::Type::End: flags.highlighted = false; value_ = not value_; @@ -423,7 +435,7 @@ bool Checkbox::on_touch(const TouchEvent event) { /* Button ****************************************************************/ - Button::Button( +Button::Button( Rect parent_rect, std::string text ) : Widget { parent_rect }, @@ -467,6 +479,11 @@ bool Button::on_key(const KeyEvent key) { on_select(*this); return true; } + } else { + if( on_dir ) { + on_dir(*this, key); + return false; + } } return false; @@ -654,6 +671,12 @@ void OptionsField::set_by_value(value_t v) { } } +void OptionsField::set_options(options_t new_options) { + options = new_options; + set_by_value(0); + set_dirty(); +} + void OptionsField::paint(Painter& painter) { const auto paint_style = has_focus() ? style().invert() : style(); diff --git a/firmware/common/ui_widget.hpp b/firmware/common/ui_widget.hpp index 80d3de46..6c2ca658 100644 --- a/firmware/common/ui_widget.hpp +++ b/firmware/common/ui_widget.hpp @@ -195,9 +195,33 @@ private: std::string text; }; +class Checkbox : public Widget { +public: + std::function on_select; + + Checkbox(Point parent_pos, size_t length, std::string text); + + void set_text(const std::string value); + void set_style(const Style* new_style); + std::string text() const; + void set_value(const bool value); + bool value() const; + + void paint(Painter& painter) override; + + bool on_key(const KeyEvent key) override; + bool on_touch(const TouchEvent event) override; + +private: + std::string text_; + bool value_ = false; + const Style* style_ { nullptr }; +}; + class Button : public Widget { public: std::function on_select; + std::function on_dir; Button(Rect parent_rect, std::string text); @@ -266,6 +290,8 @@ public: std::function on_show_options; OptionsField(Point parent_pos, size_t length, options_t options); + + void set_options(options_t new_options); size_t selected_index() const; void set_selected_index(const size_t new_index); diff --git a/firmware/portapack-h1-firmware.bin b/firmware/portapack-h1-firmware.bin index 719b8ad6..633ff286 100644 Binary files a/firmware/portapack-h1-firmware.bin and b/firmware/portapack-h1-firmware.bin differ