"At least it builds, now"

This commit is contained in:
furrtek 2016-02-05 17:40:14 +01:00
parent 8009a9b543
commit c81ba5be8e
27 changed files with 112 additions and 88 deletions

View File

@ -172,6 +172,7 @@ CPPSRC = main.cpp \
ui_spectrum.cpp \ ui_spectrum.cpp \
ui_loadmodule.cpp \ ui_loadmodule.cpp \
ui_afskrx.cpp \ ui_afskrx.cpp \
ui_afsksetup.cpp \
ui_sigfrx.cpp \ ui_sigfrx.cpp \
ui_xylos.cpp \ ui_xylos.cpp \
ui_numbers.cpp \ ui_numbers.cpp \
@ -246,7 +247,7 @@ INCDIR = ../common $(PORTINC) $(KERNINC) $(TESTINC) \
MCU = cortex-m0 MCU = cortex-m0
#TRGT = arm-elf- #TRGT = arm-elf-
TRGT = arm-none-eabi- TRGT = /usr/local/gcc-arm-none-eabi-5_2-2015q4/bin/arm-none-eabi-
CC = $(TRGT)gcc CC = $(TRGT)gcc
CPPC = $(TRGT)g++ CPPC = $(TRGT)g++
# Enable loading with g++ only if you need C++ runtime support. # Enable loading with g++ only if you need C++ runtime support.

View File

@ -65,11 +65,7 @@ ReceiverModel receiver_model;
TemperatureLogger temperature_logger; TemperatureLogger temperature_logger;
TemperatureLogger temperature_logger; TransmitterModel transmitter_model;
TransmitterModel transmitter_model {
clock_manager
};
uint8_t bl_tick_counter = 0; uint8_t bl_tick_counter = 0;

View File

@ -34,8 +34,7 @@
class TransmitterModel { class TransmitterModel {
public: public:
constexpr TransmitterModel( constexpr TransmitterModel(
ClockManager& clock_manager )
) : clock_manager(clock_manager)
{ {
} }
@ -77,7 +76,6 @@ private:
.sampling_rate = 2280000, .sampling_rate = 2280000,
.decimation_factor = 1, .decimation_factor = 1,
}; };
ClockManager& clock_manager;
int32_t tuning_offset(); int32_t tuning_offset();

View File

@ -29,6 +29,7 @@
#include "hackrf_gpio.hpp" #include "hackrf_gpio.hpp"
#include "portapack.hpp" #include "portapack.hpp"
#include "radio.hpp" #include "radio.hpp"
#include "string_format.hpp"
#include "hackrf_hal.hpp" #include "hackrf_hal.hpp"
#include "portapack_shared_memory.hpp" #include "portapack_shared_memory.hpp"
@ -37,7 +38,7 @@
#include <cstring> #include <cstring>
#include <stdio.h> #include <stdio.h>
using namespace hackrf::one; using namespace portapack;
namespace ui { namespace ui {
@ -103,7 +104,7 @@ AFSKSetupView::AFSKSetupView(
field_repeat.set_value(rpt); field_repeat.set_value(rpt);
button_setfreq.on_select = [this,&nav](Button&){ 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) { new_view->on_changed = [this](rf::Frequency f) {
updfreq(f); updfreq(f);
}; };

View File

@ -107,14 +107,17 @@ private:
Checkbox checkbox_lsb { Checkbox checkbox_lsb {
{ 8, 150 }, { 8, 150 },
9,
"LSB first" "LSB first"
}; };
Checkbox checkbox_parity { Checkbox checkbox_parity {
{ 8, 180 }, { 8, 180 },
11,
"Even parity" "Even parity"
}; };
Checkbox checkbox_datasize { Checkbox checkbox_datasize {
{ 8, 210 }, { 8, 210 },
6,
"8 bits" "8 bits"
}; };

View File

@ -191,14 +191,17 @@ private:
Checkbox checkbox_range1 { Checkbox checkbox_range1 {
{ 1 * 8, 6 * 16}, { 1 * 8, 6 * 16},
7,
"Range 1" "Range 1"
}; };
Checkbox checkbox_range2 { Checkbox checkbox_range2 {
{ 1 * 8, 9 * 16 + 4}, { 1 * 8, 9 * 16 + 4},
7,
"Range 2" "Range 2"
}; };
Checkbox checkbox_range3 { Checkbox checkbox_range3 {
{ 1 * 8, 12 * 16 + 8 }, { 1 * 8, 12 * 16 + 8 },
7,
"Range 3" "Range 3"
}; };

View File

@ -85,6 +85,7 @@ private:
Checkbox checkbox_am_a { Checkbox checkbox_am_a {
{ 16, 68 }, { 16, 68 },
20,
"" ""
}; };
Button button_setam_a { Button button_setam_a {
@ -93,6 +94,7 @@ private:
}; };
Checkbox checkbox_am_b { Checkbox checkbox_am_b {
{ 16, 68+40 }, { 16, 68+40 },
20,
"" ""
}; };
Button button_setam_b { Button button_setam_b {
@ -101,7 +103,8 @@ private:
}; };
Checkbox checkbox_am_c { Checkbox checkbox_am_c {
{ 16, 68+40+40 }, { 16, 68+40+40 },
"" 20,
" "
}; };
Button button_setam_c { Button button_setam_c {
{ 48, 64+40+40, 48, 32 }, { 48, 64+40+40, 48, 32 },
@ -109,6 +112,7 @@ private:
}; };
Checkbox checkbox_am_d { Checkbox checkbox_am_d {
{ 16, 68+40+40+40 }, { 16, 68+40+40+40 },
20,
"" ""
}; };
Button button_setam_d { Button button_setam_d {
@ -117,6 +121,7 @@ private:
}; };
Checkbox checkbox_am_e { Checkbox checkbox_am_e {
{ 16, 68+40+40+40+40 }, { 16, 68+40+40+40+40 },
20,
"" ""
}; };
Button button_setam_e { Button button_setam_e {

View File

@ -163,7 +163,7 @@ TranspondersMenuView::TranspondersMenuView(NavigationView& nav) {
ReceiverMenuView::ReceiverMenuView(NavigationView& nav) { ReceiverMenuView::ReceiverMenuView(NavigationView& nav) {
add_items<2>({ { add_items<2>({ {
{ "Audio", ui::Color::white(), [&nav](){ nav.push<ReceiverView>(); } }, { "Audio", ui::Color::white(), [&nav](){ nav.push<AnalogAudioView>(); } },
{ "Transponders", ui::Color::white(), [&nav](){ nav.push<TranspondersMenuView>(); } }, { "Transponders", ui::Color::white(), [&nav](){ nav.push<TranspondersMenuView>(); } },
} }); } });
} }
@ -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 **********************************************************/ /* PlayDeadView **********************************************************/
void PlayDeadView::focus() { void PlayDeadView::focus() {

View File

@ -170,19 +170,18 @@ void AntennaBiasSetupView::focus() {
button_done.focus(); button_done.focus();
} }
AboutView::AboutView(NavigationView& nav) { SetTouchCalibView::SetTouchCalibView(NavigationView& nav) {
add_children({ { add_children({{
&text_title, &text_title,
&text_firmware, &text_debugx,
&text_cpld_hackrf, &text_debugy,
&text_cpld_portapack, &button_ok
&button_ok, }});
} });
button_ok.on_select = [&nav](Button&){ nav.pop(); }; button_ok.on_select = [&nav](Button&){ nav.pop(); };
} }
void AboutView::focus() { void SetTouchCalibView::focus() {
button_ok.focus(); button_ok.focus();
} }

View File

@ -261,11 +261,13 @@ public:
private: private:
Checkbox checkbox_showsplash { Checkbox checkbox_showsplash {
{ 3 * 8, 2 * 16}, { 3 * 8, 2 * 16},
11,
"Show splash" "Show splash"
}; };
Checkbox checkbox_bloff { Checkbox checkbox_bloff {
{ 3 * 8, 4 * 16}, { 3 * 8, 4 * 16},
20,
"Backlight off after:" "Backlight off after:"
}; };

View File

@ -74,6 +74,7 @@ private:
Checkbox checkbox_am_a { Checkbox checkbox_am_a {
{ 16, 68 }, { 16, 68 },
20,
"" ""
}; };

View File

@ -230,6 +230,7 @@ private:
}; };
Checkbox checkbox_wcsubfamily { Checkbox checkbox_wcsubfamily {
{ 20 * 8, 5 * 16}, { 20 * 8, 5 * 16},
6,
"Toutes" "Toutes"
}; };
@ -246,6 +247,7 @@ private:
}; };
Checkbox checkbox_wcid { Checkbox checkbox_wcid {
{ 20 * 8, 7 * 16 + 4}, { 20 * 8, 7 * 16 + 4},
4,
"Tous" "Tous"
}; };
@ -323,6 +325,7 @@ private:
Checkbox checkbox_cligno { Checkbox checkbox_cligno {
{ 96, 16 * 16 + 4}, { 96, 16 * 16 + 4},
3,
"J/N" "J/N"
}; };

Binary file not shown.

View File

@ -201,7 +201,7 @@ INCDIR = ../common $(PORTINC) $(KERNINC) $(TESTINC) \
MCU = cortex-m4 MCU = cortex-m4
#TRGT = arm-elf- #TRGT = arm-elf-
TRGT = arm-none-eabi- TRGT = /usr/local/gcc-arm-none-eabi-5_2-2015q4/bin/arm-none-eabi-
CC = $(TRGT)gcc CC = $(TRGT)gcc
CPPC = $(TRGT)g++ CPPC = $(TRGT)g++
# Enable loading with g++ only if you need C++ runtime support. # Enable loading with g++ only if you need C++ runtime support.

Binary file not shown.

View File

@ -1,3 +1,4 @@
# #
# Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc. # Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
# #
@ -144,8 +145,6 @@ CPPSRC = main.cpp \
proc_wideband_spectrum.cpp \ proc_wideband_spectrum.cpp \
proc_tpms.cpp \ proc_tpms.cpp \
proc_ert.cpp \ proc_ert.cpp \
proc_afskrx.cpp \
proc_sigfrx.cpp \
dsp_squelch.cpp \ dsp_squelch.cpp \
clock_recovery.cpp \ clock_recovery.cpp \
packet_builder.cpp \ packet_builder.cpp \
@ -204,7 +203,7 @@ INCDIR = ../common $(PORTINC) $(KERNINC) $(TESTINC) \
MCU = cortex-m4 MCU = cortex-m4
#TRGT = arm-elf- #TRGT = arm-elf-
TRGT = arm-none-eabi- TRGT = /usr/local/gcc-arm-none-eabi-5_2-2015q4/bin/arm-none-eabi-
CC = $(TRGT)gcc CC = $(TRGT)gcc
CPPC = $(TRGT)g++ CPPC = $(TRGT)g++
# Enable loading with g++ only if you need C++ runtime support. # Enable loading with g++ only if you need C++ runtime support.

View File

@ -45,7 +45,6 @@ bool is_enabled();
void disable(); void disable();
baseband::buffer_t wait_for_rx_buffer(); baseband::buffer_t wait_for_rx_buffer();
baseband::buffer_t wait_for_tx_buffer();
} /* namespace dma */ } /* namespace dma */
} /* namespace baseband */ } /* namespace baseband */

View File

@ -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 <hal.h>
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<buffer_out.count; i++) {
x_[0] = x_[1];
x_[1] = x_[2];
x_[2] = buffer_in.p[i];
y_[0] = y_[1];
y_[1] = y_[2];
y_[2] = b_[0] * x_[2] + b_[1] * x_[1] + b_[2] * x_[0]
- a_[1] * y_[1] - a_[2] * y_[0];
buffer_out.p[i] = y_[2];
}
x = x_;
y = y_;
}
void IIRBiquadFilter::execute_in_place(const buffer_f32_t& buffer) {
execute(buffer, buffer);
}

View File

@ -24,7 +24,6 @@
#include "baseband_processor.hpp" #include "baseband_processor.hpp"
#include "channel_decimator.hpp"
#include "dsp_decimate.hpp" #include "dsp_decimate.hpp"
#include "dsp_demodulate.hpp" #include "dsp_demodulate.hpp"

View File

@ -1,2 +1,2 @@
const char md5_baseband[16] = {0xf8,0xf3,0x7b,0x36,0x68,0xd3,0xa1,0x85,0x26,0xb1,0x76,0x99,0x46,0x95,0xfd,0xec,}; const char md5_baseband[16] = {0xd1,0x3a,0x3a,0xf4,0xd4,0xdd,0x9f,0xa6,0x3d,0xdb,0xf0,0x1b,0x6a,0x11,0xa1,0xa9,};
const char md5_baseband_tx[16] = {0xfc,0xe9,0x57,0x6b,0xfb,0xac,0x72,0x61,0x65,0x4e,0x3d,0x7f,0xb4,0x78,0xbd,0xd2,}; const char md5_baseband_tx[16] = {0x30,0x80,0xd0,0x42,0x4a,0x09,0x78,0x77,0xff,0x59,0x00,0x70,0x48,0x77,0xd5,0xc6,};

View File

@ -1,5 +1,6 @@
#include "ui_widget.hpp" #include "ui_widget.hpp"
#include "ui_painter.hpp" #include "ui_painter.hpp"
#include "portapack.hpp"
#include <cstdint> #include <cstdint>
#include <cstddef> #include <cstddef>
@ -7,6 +8,8 @@
#include "string_format.hpp" #include "string_format.hpp"
using namespace portapack;
namespace ui { namespace ui {
static bool ui_dirty = true; static bool ui_dirty = true;
@ -298,6 +301,16 @@ void Text::paint(Painter& painter) {
/* Checkbox **************************************************************/ /* Checkbox **************************************************************/
Checkbox::Checkbox(
Point parent_pos,
size_t length,
std::string text
) : Widget { { parent_pos, { static_cast<ui::Dim>((8 * length) + 24), 24 } } },
text_ { text }
{
flags.focusable = true;
}
void Checkbox::set_text(const std::string value) { void Checkbox::set_text(const std::string value) {
text_ = value; text_ = value;
set_dirty(); set_dirty();
@ -375,7 +388,6 @@ bool Checkbox::on_touch(const TouchEvent event) {
set_dirty(); set_dirty();
return true; return true;
case TouchEvent::Type::End: case TouchEvent::Type::End:
flags.highlighted = false; flags.highlighted = false;
value_ = not value_; value_ = not value_;
@ -423,7 +435,7 @@ bool Checkbox::on_touch(const TouchEvent event) {
/* Button ****************************************************************/ /* Button ****************************************************************/
Button::Button( Button::Button(
Rect parent_rect, Rect parent_rect,
std::string text std::string text
) : Widget { parent_rect }, ) : Widget { parent_rect },
@ -467,6 +479,11 @@ bool Button::on_key(const KeyEvent key) {
on_select(*this); on_select(*this);
return true; return true;
} }
} else {
if( on_dir ) {
on_dir(*this, key);
return false;
}
} }
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) { void OptionsField::paint(Painter& painter) {
const auto paint_style = has_focus() ? style().invert() : style(); const auto paint_style = has_focus() ? style().invert() : style();

View File

@ -195,9 +195,33 @@ private:
std::string text; std::string text;
}; };
class Checkbox : public Widget {
public:
std::function<void(Checkbox&)> 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 { class Button : public Widget {
public: public:
std::function<void(Button&)> on_select; std::function<void(Button&)> on_select;
std::function<void(Button&,KeyEvent)> on_dir;
Button(Rect parent_rect, std::string text); Button(Rect parent_rect, std::string text);
@ -266,6 +290,8 @@ public:
std::function<void(void)> on_show_options; std::function<void(void)> on_show_options;
OptionsField(Point parent_pos, size_t length, options_t options); OptionsField(Point parent_pos, size_t length, options_t options);
void set_options(options_t new_options);
size_t selected_index() const; size_t selected_index() const;
void set_selected_index(const size_t new_index); void set_selected_index(const size_t new_index);

Binary file not shown.