2015-07-08 08:39:24 -07:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
2016-08-06 08:49:45 +02:00
|
|
|
* Copyright (C) 2016 Furrtek
|
2015-07-08 08:39:24 -07: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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __UI_WIDGET_H__
|
|
|
|
#define __UI_WIDGET_H__
|
|
|
|
|
|
|
|
#include "ui.hpp"
|
|
|
|
#include "ui_text.hpp"
|
|
|
|
#include "ui_painter.hpp"
|
|
|
|
#include "ui_focus.hpp"
|
2017-02-12 07:23:31 +00:00
|
|
|
#include "ui_font_fixed_8x16.hpp"
|
2017-09-20 07:50:59 +01:00
|
|
|
#include "rtc_time.hpp"
|
2016-05-11 23:57:22 +02:00
|
|
|
#include "radio.hpp"
|
2015-07-08 08:39:24 -07:00
|
|
|
|
2016-12-09 18:21:47 +01:00
|
|
|
#include "portapack.hpp"
|
2015-07-08 08:39:24 -07:00
|
|
|
#include "utility.hpp"
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
2018-02-03 13:41:40 -05:00
|
|
|
#include <functional>
|
2015-07-08 08:39:24 -07:00
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
2015-08-14 21:17:23 -07:00
|
|
|
void dirty_set();
|
|
|
|
void dirty_clear();
|
|
|
|
bool is_dirty();
|
2015-07-08 08:39:24 -07:00
|
|
|
|
2015-11-09 11:56:40 -08:00
|
|
|
class Context {
|
|
|
|
public:
|
|
|
|
FocusManager& focus_manager() {
|
|
|
|
return focus_manager_;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2016-11-26 16:50:44 -08:00
|
|
|
FocusManager focus_manager_ { };
|
2015-07-08 08:39:24 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class Widget {
|
|
|
|
public:
|
2016-05-09 21:05:11 +02:00
|
|
|
Widget(
|
2016-12-06 09:28:48 -08:00
|
|
|
) : _parent_rect { }
|
2015-07-08 08:39:24 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-05-09 21:05:11 +02:00
|
|
|
Widget(
|
2015-07-08 08:39:24 -07:00
|
|
|
Rect parent_rect
|
2016-12-06 09:28:48 -08:00
|
|
|
) : _parent_rect { parent_rect }
|
2015-07-08 08:39:24 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget(const Widget&) = delete;
|
|
|
|
Widget(Widget&&) = delete;
|
2016-11-26 16:52:57 -08:00
|
|
|
Widget& operator=(const Widget&) = delete;
|
|
|
|
Widget& operator=(Widget&&) = delete;
|
2015-07-08 08:39:24 -07:00
|
|
|
|
|
|
|
virtual ~Widget() = default;
|
|
|
|
|
|
|
|
Point screen_pos();
|
|
|
|
Size size() const;
|
2016-05-09 21:05:11 +02:00
|
|
|
Rect screen_rect() const;
|
2016-12-06 09:28:48 -08:00
|
|
|
Rect parent_rect() const;
|
2015-07-08 08:39:24 -07:00
|
|
|
virtual void set_parent_rect(const Rect new_parent_rect);
|
|
|
|
|
|
|
|
Widget* parent() const;
|
|
|
|
void set_parent(Widget* const widget);
|
|
|
|
|
|
|
|
bool hidden() const { return flags.hidden; }
|
|
|
|
void hidden(bool hide);
|
|
|
|
|
|
|
|
virtual void focus();
|
|
|
|
virtual void on_focus();
|
|
|
|
virtual void blur();
|
|
|
|
virtual void on_blur();
|
|
|
|
bool focusable() const;
|
2016-02-07 10:32:38 -08:00
|
|
|
void set_focusable(const bool value);
|
2015-07-08 08:39:24 -07:00
|
|
|
bool has_focus();
|
|
|
|
|
|
|
|
virtual void paint(Painter& painter) = 0;
|
|
|
|
|
|
|
|
virtual void on_show() { };
|
|
|
|
virtual void on_hide() { };
|
|
|
|
|
|
|
|
virtual bool on_key(const KeyEvent event);
|
|
|
|
virtual bool on_encoder(const EncoderEvent event);
|
|
|
|
virtual bool on_touch(const TouchEvent event);
|
2016-02-07 11:24:25 -08:00
|
|
|
virtual const std::vector<Widget*>& children() const;
|
2015-07-08 08:39:24 -07:00
|
|
|
|
|
|
|
virtual Context& context() const;
|
|
|
|
|
|
|
|
void set_style(const Style* new_style);
|
|
|
|
|
|
|
|
const Style& style() const;
|
2017-04-21 00:31:21 +01:00
|
|
|
int16_t id = 0;
|
2015-07-08 08:39:24 -07:00
|
|
|
|
|
|
|
// State management methods.
|
|
|
|
void set_dirty();
|
|
|
|
bool dirty() const;
|
|
|
|
void set_clean();
|
|
|
|
|
|
|
|
void visible(bool v);
|
2016-08-03 04:53:51 +02:00
|
|
|
bool visible() { return flags.visible; };
|
2015-07-08 08:39:24 -07:00
|
|
|
|
2016-02-07 10:32:38 -08:00
|
|
|
bool highlighted() const;
|
|
|
|
void set_highlighted(const bool value);
|
|
|
|
|
2015-07-08 08:39:24 -07:00
|
|
|
protected:
|
2016-02-07 10:40:06 -08:00
|
|
|
void dirty_overlapping_children_in_rect(const Rect& child_rect);
|
|
|
|
|
|
|
|
private:
|
2015-07-08 08:39:24 -07:00
|
|
|
/* Widget rectangle relative to parent pos(). */
|
2016-12-06 09:28:48 -08:00
|
|
|
Rect _parent_rect;
|
2015-07-08 08:39:24 -07:00
|
|
|
const Style* style_ { nullptr };
|
|
|
|
Widget* parent_ { nullptr };
|
|
|
|
|
|
|
|
struct flags_t {
|
|
|
|
bool dirty : 1; // Widget content has changed.
|
|
|
|
bool hidden : 1; // Hide widget and children.
|
|
|
|
bool focusable : 1; // Widget can receive focus.
|
|
|
|
bool highlighted : 1; // Show in a highlighted style.
|
|
|
|
bool visible : 1; // Object was visible during last paint.
|
|
|
|
};
|
|
|
|
|
|
|
|
flags_t flags {
|
|
|
|
.dirty = true,
|
|
|
|
.hidden = false,
|
|
|
|
.focusable = false,
|
|
|
|
.highlighted = false,
|
|
|
|
.visible = false,
|
|
|
|
};
|
2016-01-31 09:34:24 +01:00
|
|
|
|
2016-02-07 11:24:25 -08:00
|
|
|
static const std::vector<Widget*> no_children;
|
2015-07-08 08:39:24 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class View : public Widget {
|
|
|
|
public:
|
|
|
|
View() {
|
|
|
|
}
|
|
|
|
|
|
|
|
View(Rect parent_rect) {
|
|
|
|
set_parent_rect(parent_rect);
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: ~View() should on_hide() all children?
|
|
|
|
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
|
|
|
|
void add_child(Widget* const widget);
|
2016-09-05 14:53:04 -07:00
|
|
|
void add_children(const std::initializer_list<Widget*> children);
|
2015-07-08 08:39:24 -07:00
|
|
|
void remove_child(Widget* const widget);
|
2016-12-09 18:21:47 +01:00
|
|
|
void remove_children(const std::vector<Widget*>& children);
|
2016-02-07 11:24:25 -08:00
|
|
|
const std::vector<Widget*>& children() const override;
|
2015-07-08 08:39:24 -07:00
|
|
|
|
2016-01-31 09:34:24 +01:00
|
|
|
virtual std::string title() const;
|
|
|
|
|
2015-07-08 08:39:24 -07:00
|
|
|
protected:
|
2016-11-26 16:50:44 -08:00
|
|
|
std::vector<Widget*> children_ { };
|
2015-07-08 08:39:24 -07:00
|
|
|
|
|
|
|
void invalidate_child(Widget* const widget);
|
|
|
|
};
|
|
|
|
|
|
|
|
class Rectangle : public Widget {
|
|
|
|
public:
|
2016-05-25 11:32:06 -07:00
|
|
|
Rectangle(Color c);
|
2016-01-31 09:34:24 +01:00
|
|
|
Rectangle(Rect parent_rect, Color c);
|
2017-01-16 03:45:44 +00:00
|
|
|
Rectangle(
|
|
|
|
) : Rectangle { { }, { } }
|
|
|
|
{
|
|
|
|
}
|
2015-07-08 08:39:24 -07:00
|
|
|
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
|
|
|
|
void set_color(const Color c);
|
2016-07-29 04:52:51 +02:00
|
|
|
void set_outline(const bool outline);
|
2015-07-08 08:39:24 -07:00
|
|
|
|
|
|
|
private:
|
|
|
|
Color color;
|
2016-07-29 04:52:51 +02:00
|
|
|
bool _outline = false;
|
2015-07-08 08:39:24 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class Text : public Widget {
|
|
|
|
public:
|
|
|
|
Text(
|
|
|
|
) : text { "" } {
|
|
|
|
}
|
|
|
|
|
2016-01-31 09:34:24 +01:00
|
|
|
Text(Rect parent_rect, std::string text);
|
|
|
|
Text(Rect parent_rect);
|
2015-07-08 08:39:24 -07:00
|
|
|
|
|
|
|
void set(const std::string value);
|
2016-02-04 10:27:53 +01:00
|
|
|
|
2015-07-08 08:39:24 -07:00
|
|
|
void paint(Painter& painter) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::string text;
|
|
|
|
};
|
|
|
|
|
2017-02-12 04:05:21 +00:00
|
|
|
class Labels : public Widget {
|
|
|
|
public:
|
|
|
|
struct Label {
|
|
|
|
Point pos;
|
|
|
|
std::string text;
|
|
|
|
ui::Color color;
|
|
|
|
};
|
|
|
|
|
|
|
|
Labels(const Labels&) = delete;
|
|
|
|
Labels(Labels&&) = delete;
|
|
|
|
Labels& operator=(const Labels&) = delete;
|
|
|
|
Labels& operator=(Labels&&) = delete;
|
|
|
|
|
2017-02-12 07:23:31 +00:00
|
|
|
Labels(std::initializer_list<Label> labels);
|
2017-02-12 04:05:21 +00:00
|
|
|
|
2017-02-12 07:23:31 +00:00
|
|
|
void set_labels(std::initializer_list<Label> labels);
|
2017-02-12 04:05:21 +00:00
|
|
|
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
|
|
|
|
private:
|
2017-02-12 07:23:31 +00:00
|
|
|
std::vector<Label> labels_;
|
2017-02-12 04:05:21 +00:00
|
|
|
};
|
|
|
|
|
2017-09-20 07:50:59 +01:00
|
|
|
class LiveDateTime : public Widget {
|
|
|
|
public:
|
|
|
|
LiveDateTime(Rect parent_rect);
|
|
|
|
~LiveDateTime();
|
|
|
|
|
|
|
|
void paint(Painter& painter) override;
|
2020-08-08 04:24:57 -04:00
|
|
|
|
2021-05-16 11:41:09 +02:00
|
|
|
void set_hide_clock(bool new_value);
|
2020-08-08 04:24:57 -04:00
|
|
|
void set_seconds_enabled(bool new_value);
|
|
|
|
void set_date_enabled(bool new_value);
|
|
|
|
|
2017-09-20 07:50:59 +01:00
|
|
|
std::string& string() {
|
|
|
|
return text;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void on_tick_second();
|
|
|
|
|
2020-08-15 15:46:53 +02:00
|
|
|
uint16_t init_delay = 4;
|
2021-05-16 11:41:09 +02:00
|
|
|
bool hide_clock = false;
|
2020-08-08 04:24:57 -04:00
|
|
|
bool date_enabled = true;
|
|
|
|
bool seconds_enabled = false;
|
|
|
|
|
2017-09-20 07:50:59 +01:00
|
|
|
rtc::RTC datetime { };
|
|
|
|
SignalToken signal_token_tick_second { };
|
|
|
|
std::string text { };
|
|
|
|
};
|
|
|
|
|
2016-05-11 23:57:22 +02:00
|
|
|
class BigFrequency : public Widget {
|
|
|
|
public:
|
|
|
|
BigFrequency(Rect parent_rect, rf::Frequency frequency);
|
|
|
|
|
|
|
|
void set(const rf::Frequency frequency);
|
|
|
|
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
rf::Frequency _frequency;
|
2017-03-13 04:09:21 +00:00
|
|
|
|
2017-09-20 07:50:59 +01:00
|
|
|
static constexpr Dim digit_width = 32;
|
|
|
|
|
2017-03-13 04:09:21 +00:00
|
|
|
const uint8_t segment_font[11] = {
|
|
|
|
0b00111111, // 0: ABCDEF
|
|
|
|
0b00000110, // 1: AB
|
|
|
|
0b01011011, // 2: ABDEG
|
|
|
|
0b01001111, // 3: ABCDG
|
|
|
|
0b01100110, // 4: BCFG
|
|
|
|
0b01101101, // 5: ACDFG
|
|
|
|
0b01111101, // 6: ACDEFG
|
|
|
|
0b00000111, // 7: ABC
|
|
|
|
0b01111111, // 8: ABCDEFG
|
|
|
|
0b01101111, // 9: ABCDFG
|
|
|
|
0b01000000 // -: G
|
|
|
|
};
|
2017-09-20 07:50:59 +01:00
|
|
|
|
|
|
|
const Rect segments[7] = {
|
|
|
|
{{4, 0}, {20, 4}},
|
|
|
|
{{24, 4}, {4, 20}},
|
|
|
|
{{24, 28}, {4, 20}},
|
|
|
|
{{4, 48}, {20, 4}},
|
|
|
|
{{0, 28}, {4, 20}},
|
|
|
|
{{0, 4}, {4, 20}},
|
|
|
|
{{4, 24}, {20, 4}}
|
|
|
|
};
|
2016-05-11 23:57:22 +02:00
|
|
|
};
|
|
|
|
|
2016-05-09 20:42:20 +02:00
|
|
|
class ProgressBar : public Widget {
|
|
|
|
public:
|
|
|
|
ProgressBar(Rect parent_rect);
|
|
|
|
|
2016-08-26 08:11:24 +02:00
|
|
|
void set_max(const uint32_t max);
|
|
|
|
void set_value(const uint32_t value);
|
2016-05-09 20:42:20 +02:00
|
|
|
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
|
|
|
|
private:
|
2016-08-26 08:11:24 +02:00
|
|
|
uint32_t _value = 0;
|
|
|
|
uint32_t _max = 100;
|
2016-05-09 20:42:20 +02:00
|
|
|
};
|
|
|
|
|
2016-07-29 04:52:51 +02:00
|
|
|
class Console : public Widget {
|
|
|
|
public:
|
|
|
|
Console(Rect parent_rect);
|
|
|
|
|
2020-06-28 20:06:00 +02:00
|
|
|
void clear(bool clear_buffer);
|
2016-07-29 04:52:51 +02:00
|
|
|
void write(std::string message);
|
|
|
|
void writeln(std::string message);
|
|
|
|
|
2017-01-16 13:36:28 +00:00
|
|
|
void paint(Painter&) override;
|
2016-07-29 04:52:51 +02:00
|
|
|
|
2021-03-07 16:05:23 -06:00
|
|
|
void enable_scrolling(bool enable);
|
2016-07-29 04:52:51 +02:00
|
|
|
void on_show() override;
|
|
|
|
void on_hide() override;
|
|
|
|
|
|
|
|
private:
|
2017-09-02 08:28:29 +01:00
|
|
|
//bool visible = false;
|
2016-07-29 04:52:51 +02:00
|
|
|
Point pos { 0, 0 };
|
2017-01-16 03:45:44 +00:00
|
|
|
std::string buffer { };
|
2021-03-07 16:05:23 -06:00
|
|
|
static bool scrolling_enabled;
|
2016-07-29 04:52:51 +02:00
|
|
|
|
|
|
|
void crlf();
|
|
|
|
};
|
|
|
|
|
2016-02-05 17:40:14 +01:00
|
|
|
class Checkbox : public Widget {
|
|
|
|
public:
|
2017-01-17 14:27:37 +00:00
|
|
|
std::function<void(Checkbox&, bool)> on_select { };
|
2016-02-05 17:40:14 +01:00
|
|
|
|
2017-01-16 13:36:28 +00:00
|
|
|
Checkbox(Point parent_pos, size_t length, std::string text, bool small);
|
|
|
|
Checkbox(
|
|
|
|
Point parent_pos,
|
|
|
|
size_t length,
|
|
|
|
std::string text
|
|
|
|
) : Checkbox { parent_pos, length, text, false }
|
|
|
|
{
|
|
|
|
}
|
2016-02-05 17:40:14 +01:00
|
|
|
|
2016-07-28 00:08:05 +02:00
|
|
|
Checkbox(
|
|
|
|
) : Checkbox { { }, { }, { } }
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-16 03:45:44 +00:00
|
|
|
Checkbox(const Checkbox&) = delete;
|
|
|
|
Checkbox(Checkbox&&) = delete;
|
|
|
|
Checkbox& operator=(const Checkbox&) = delete;
|
|
|
|
Checkbox& operator=(Checkbox&&) = delete;
|
|
|
|
|
2016-02-05 17:40:14 +01:00
|
|
|
void set_text(const std::string value);
|
2016-12-09 18:21:47 +01:00
|
|
|
bool set_value(const bool value);
|
2016-02-05 17:40:14 +01:00
|
|
|
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_;
|
2017-01-16 13:36:28 +00:00
|
|
|
bool small_ { false };
|
|
|
|
bool value_ { false };
|
2017-02-12 04:05:21 +00:00
|
|
|
const Style * style_ { nullptr };
|
2016-02-05 17:40:14 +01:00
|
|
|
};
|
|
|
|
|
2016-02-04 10:27:53 +01:00
|
|
|
class Button : public Widget {
|
2015-09-05 20:17:43 +02:00
|
|
|
public:
|
2016-11-26 16:50:44 -08:00
|
|
|
std::function<void(Button&)> on_select { };
|
2020-09-25 03:34:05 +02:00
|
|
|
std::function<void(Button&)> on_touch_release { }; // Executed when releasing touch, after on_select.
|
|
|
|
std::function<void(Button&)> on_touch_press { }; // Executed when touching, before on_select.
|
2017-01-16 03:45:44 +00:00
|
|
|
std::function<bool(Button&, KeyEvent)> on_dir { };
|
|
|
|
std::function<void(Button&)> on_highlight { };
|
2015-09-05 20:17:43 +02:00
|
|
|
|
2020-08-24 11:02:42 +08:00
|
|
|
Button(Rect parent_rect, std::string text, bool instant_exec); // instant_exec: Execute on_select when you touching instead of releasing
|
2016-02-04 10:27:53 +01:00
|
|
|
Button(
|
2020-08-24 11:02:42 +08:00
|
|
|
Rect parent_rect,
|
|
|
|
std::string text
|
|
|
|
) : Button { parent_rect, text, false }
|
2015-09-05 20:17:43 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-08-24 11:02:42 +08:00
|
|
|
Button(
|
|
|
|
) : Button { { }, { } }
|
2020-08-24 01:53:34 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void set_text(const std::string value);
|
|
|
|
std::string text() const;
|
|
|
|
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
|
|
|
|
void on_focus() override;
|
|
|
|
bool on_key(const KeyEvent key) override;
|
|
|
|
bool on_touch(const TouchEvent event) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::string text_;
|
2020-08-24 11:02:42 +08:00
|
|
|
bool instant_exec_ { false };
|
2020-08-24 01:53:34 +08:00
|
|
|
};
|
|
|
|
|
2022-09-11 16:09:05 +02:00
|
|
|
class ButtonWithEncoder : public Widget {
|
|
|
|
public:
|
|
|
|
std::function<void(ButtonWithEncoder&)> on_select { };
|
|
|
|
std::function<void(ButtonWithEncoder&)> on_touch_release { }; // Executed when releasing touch, after on_select.
|
|
|
|
std::function<void(ButtonWithEncoder&)> on_touch_press { }; // Executed when touching, before on_select.
|
|
|
|
std::function<bool(ButtonWithEncoder&, KeyEvent)> on_dir { };
|
|
|
|
std::function<void(ButtonWithEncoder&)> on_highlight { };
|
|
|
|
|
|
|
|
ButtonWithEncoder(Rect parent_rect, std::string text, bool instant_exec); // instant_exec: Execute on_select when you touching instead of releasing
|
|
|
|
ButtonWithEncoder(
|
|
|
|
Rect parent_rect,
|
|
|
|
std::string text
|
|
|
|
) : ButtonWithEncoder { parent_rect, text, false }
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ButtonWithEncoder(
|
|
|
|
) : ButtonWithEncoder { { }, { } }
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
std::function<void()> on_change { };
|
|
|
|
|
|
|
|
void set_text(const std::string value);
|
|
|
|
int32_t get_encoder_delta();
|
|
|
|
void set_encoder_delta( const int32_t delta );
|
|
|
|
std::string text() const;
|
|
|
|
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
|
|
|
|
void on_focus() override;
|
|
|
|
bool on_key(const KeyEvent key) override;
|
|
|
|
bool on_touch(const TouchEvent event) override;
|
|
|
|
bool on_encoder(const EncoderEvent delta) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::string text_;
|
|
|
|
int32_t encoder_delta = 0 ;
|
|
|
|
bool delta_change = 0 ;
|
|
|
|
bool instant_exec_ { false };
|
|
|
|
};
|
|
|
|
|
UI Redesign for Portapack-Havoc (#268)
* Power: Turn off additional peripheral clock branches.
* Update schematic with new symbol table and KiCad standard symbols.
Fix up wires.
* Schematic: Update power net labels.
* Schematic: Update footprint names to match library changes.
* Schematic: Update header vendor and part numbers.
* Schematic: Specify (arbitrary) value for PDN# net.
* Schematic: Remove fourth fiducial. Not standard practice, and was taking up valuable board space.
* Schematic: Add reference oscillator -- options for clipped sine or HCMOS output.
* Schematic: Update copyright year.
* Schematic: Remove CLKOUT to CPLD. It was a half-baked idea.
* Schematic: Add (experimental) GPS circuit.
Add note about charging circuit.
Update date and revision to match PCB.
* PCB: Update from schematic change: now revision 20180819.
Diff was extensive due to net renumbering...
* PCB: Fix GPS courtyard to accommodate crazy solder paste recommendation in integration manual.
PCB: Address DRC clearance violation between via and oscillator pad.
* PCB: Update copyright on drawing.
* Update schematic and PCB date and revision.
* gitignore: Sublime Text editor project/workspace files
* Power: Power up or power down peripheral clock at appropriate times, so firmware doesn't freeze...
* Clocking: Fix incorrect shift for CGU IDIVx_CTRL.PD field.
* LPC43xx: Add CGU IDIVx struct/union type.
* Power: Switch off unused IDIV dividers. Make note of active IDIVs and their use.
* HackRF Mode: Upgrade firmware to 2018.01.1 (API 1.02)
* MAX V CPLD: Refactor class to look more like Xilinx CoolRunner II CPLD class.
* MAX V CPLD: Add BYPASS, SAMPLE support.
Rename enter_isp -> enable, exit_isp -> disable.
Use SAMPLE at start of flash process, which somehow addresses the problem where CFM wouldn't load into SRAM (and become the active bitstream) after flashing.
* MAX V CPLD: Reverse verify data checking logic to make it a little faster.
* CPLD: After reprogramming flash, immediately clamp I/O signals, load to SRAM, and "execute" the new bitstream.
* Si5351: Refactor code, make one of the registers more type-safe.
Clock Manager: Track selected reference clock source for later use in user interface.
* Clock Manager: Add note about PPM only affecting Si5351C PLLA, which always runs from the HackRF 25MHz crystal.
It is assumed an external clock does not need adjustment, though I am open to being convinced otherwise...
* PPM UI: Show "EXT" when showing PPM adjustment and reference clock is external.
* CPLD: Add pins and logic for new PortaPack hardware feature(s).
* CPLD: Bitstream to support new hardware features.
* Clock Generator: Add a couple more setter methods for ClockControl registers.
* Clock Manager: Use shared MCU CLKIN clock control configuration constant.
* Clock Manager: Reduce MCU CLKIN driver current. 2mA should be plenty.
* Clock Manager: Remove redundant clock generator output enable.
* Bootstrap: Remove unnecessary ldscript hack to locate SPIFI mode change code in RAM.
* Bootstrap: Get CPU operating at max frequency as soon as possible.
Update SPIFI speed comment.
Make some more LPC43xx types into unions with uint32_t.
* Bootstrap: Explicitly configure IDIVB for SPIFI, despite LPC43xx bootloader setting it.
* Clock Manager: Init peripherals before CPLD reconfig. Do the clock generator setup after, so we can check presence of PortaPack reference clock with the help of the latest CPLD bitstream.
* Clock Manager: Reverse sense of conditional that determines crystal or non-crystal reference source. This is for an expected upcoming change where multiple external options can be differentiated.
* Bootstrap: Consolidate clock configuration, update SPIFI rate comment.
* Clock Manager: Use IDIVA for clock source for all peripherals, instead of PLL1. Should make switching easier going forward.
Don't use IRC as clock during initial clock manager configuration. Until we switch to GP_CLKIN, we should go flat out...
* ChibiOS M0: Change default clock speed to 204MHz, since bootstrap now maxes out clock speed before starting M0 execution.
* PortaPack IO: Expose method to set reference oscillator enable pin.
* Pin configuration: Do SPIFI pin config with other pins, in preparation for eliminating separate bootloader.
* Pin configuration: Disable input buffers on pins that are never read.
* Revert "ChibiOS M0: Change default clock speed to 204MHz, since bootstrap now maxes out clock speed before starting M0 execution."
This reverts commit c0e2bb6cc4cc656769323bdbb8ee5a16d2d5bb03.
* PCB: Change PCB stackup, Tg, clarify solder mask color, use more metric.
* PCB: Move HackRF header P9 to B.CrtYd layer.
* PCB: Change a Tg reference I missed.
* PCB: Update footprints for parts with mismatched CAD->tape rotation.
Adjust a few layer choice and line thickness bits.
* PCB: Got cold feet, switched back to rectangular pads.
* PCB: Add Eco layers to be visible and Gerber output.
* PCB: Use aux origin for plotting, for tidier coordinates.
* PCB: Output Gerber job file, because why not?
* Schematic: Correct footprints for two reference-related components.
* Schematic: Remove manfuacturer and part number for DNP component.
* Schematic: Specify resistor value, manufacturer, part number for reference oscillator series termination.
* PCB: Update netlist and footprints from schematic.
* Netlist: Updated component values, footprints.
* PCB: Nudge some components and traces to address DRC clearance violations.
* PCB: Allow KiCad to update zone timestamps (again?!).
* PCB: Generate *all* Gerber layers.
* Schematic, PCB: Update revision to 20181025.
* PCB: Adjust fab layer annotations orientation and font size.
* PCB: Hide mounting hole reference designators on silk layer.
* PCB: Shrink U1, U3 pads to get 0.2mm space between pads.
* PCB: Set pad-to-mask clearance to zero, leave up to fab. Set minimum mask web to 0.2mm for non-black options.
* PCB: Revise U1 pad shape, mask, paste, thermal drills.
Clearance is improved at corner pads.
* PCB: Tweak U3 for better thermal pad/drill/mask/paste design.
* PCB: Change solder mask color to blue.
* Schematic, PCB: Update revision to 20181029.
* PCB: Bump minimum mask web down a tiny bit because KiCad is having trouble with math.
* Update schematic
* Remove unused board files.
* Add LPC43xx functions.
* chibios: Replace code with per-peripheral structs defining clocks, interrupts, and reset bits.
* LPC43xx: Add MCPWM peripheral struct.
* clock generator: Use recommended PLL reset register value.
Datasheet recommends a value. AN619 is quiet on the topic, claims the low nibble is default 0b0000.
* GPIO: Tweak masking of SCU function.
I don't remember why I thought this was necessary...
* HAL: Explicitly turn on timer peripheral clocks used as systicks, during init.
* SCU: Add struct to hold pin configuration.
* PAL: Add functions to address The Glitch.
https://greatscottgadgets.com/2018/02-28-we-fixed-the-glitch/
* PAL/board: New IO initialization code
Declare initial state for SCU pin config, GPIOs. Apply initial state during PAL init. Perform VAA slow turn-on to address The Glitch.
* Merge M0 and M4 to eliminate need for bootstrap firmware
During _early_init, detect if we're running on the M4 or M0.
If M4: do M4-specific core initialization, reset peripherals, speed up SPIFI clock, start M0, go to sleep.
If M0: do all the other things.
* Pins: Miscellaneous SCU configuration tweaks.
* Little code clarity improvement.
* bootstrap: Remove, not necessary.
* Clock Manager: Large re-working to support external references.
* Clock Manager: Actually store chosen clock reference
Similarly-named local was covering a member and discarding the value.
* Clock Manager: Reference type which contains source, frequency.
* Setup: Display reference source, frequency in frequency correction screen.
* LPC43xx API: Add extern "C" for use from C++.
* Use LPC43xx API for SGPIO, GPDMA, I2S initialization.
* I2S: Add BASE_AUDIO_CLK management.
* Add MOTOCON_PWM clock/reset structure.
* Serial: Fix dumb typos.
* Serial: Remove extra reference operator.
* Serial: Cut-and-paste error in structure type name.
* Move SCU structure from PAL to LPC43xx API.
It'd be nice if I gave some thought to where code should live before I commit it.
* VAA power: Move code to HackRF board file
It doesn't belong in PAL.
* MAX5 CPLD: Add SAMPLE and EXTEST methods.
* Flash image: Change packing scheme to use flash more efficiently.
Application is now a single image for both M4 bootstrap and M0.
Baseband images come immediately after application binary. No need to align to large blocks (and waste lots of flash).
* Clock Manager: Remove PLL1 power down function.
* Move and rename peripherals reset function to board module.
* Remove unused peripheral/clock management.
* Clock Manager: Extract switch to IRC into separate function.
* Clock Manager: More explicit shutdown of clocks, clock generator.
* Move initialization to board module.
* ChibiOS: Rename "application" board, add "baseband" board.
There are now two ChibiOS "boards", one which runs the application and does the hardware setup. The other board, "baseband", does very little setup.
* Clock Manager: Remove unused crystal enable/disable code.
* Clock Manager: Restore clock configuration to SPIFI bootloader state before app shutdown.
* Reset peripherals on app shutdown.
Be careful not to reset M0APP (the core we're running on) or GPIO (which is holding the hardware in a stable state).
* M4/baseband hal_lld_init: use IDIVA, which is configured earlier by M0.
This was causing problems during restart into HackRF mode. Baseband hal_lld_init changed M4 clock from IDIVA (set by M0) to PLL1, which was unceremoniously turned off during shutdown.
* Audio app: Stop audio PLL on shutdown.
* M4 HAL: Make LPC43XX_M4_CLK_SRC optional.
This was changing the BASE_M4_CLK when a baseband was run.
* LPC43xx C++ layer: Fix IDIVx constructor IDIV narrow field width.
* Application board: hide the peripherals_reset function, as it isn't useful except during hardware init.
* Consolidate hardware init code to some degree.
ClockManager is super-overloaded and murky in its purpose.
Migrate audio from IDIVC to IDIVD, to more closely resemble initial clock scheme, so it's simpler to get back to it during shutdown.
* Migrate some startup code to application board.
* Si5351: Use correct methods for reset().
update_output_enable_control() doesn't reset the enabled outputs to the reset state, unless the object is freshly initialized, which it isn't when performing firmware shutdown.
For similar reasons, use set_clock_control() instead of setting internal state and then using the update function.
* GPIO: Set SPIFI CS pin to match input buffer state coming out of bootloader.
* Change application board.c to .cpp, with required dependent changes
* Board: Clean up SCU configuration code/data.
* I2S: Add shutdown code and use it.
* LPC43xx: Consolidate a bunch of structures that had been scattered all over.
...because I'm an undisciplined coder.
* I2S: Fix ordering of branch and base clock disable.
Core was hanging, presumably because the register interface on the branch/peripheral was unresponsive after the base clock was disabled.
* Controls: Save and expose raw navigation wheel switch state
I need to do some work on debouncing and ignoring simultaneous key presses.
* Controls: Add debug view for switches state.
* Controls: Ignore all key presses until all keys are released.
This should address some mechanical quirks of the navigation wheel used on the PortaPack.
* Clock Manager: Wait for only the necessary PLL to lock.
Wasn't working on PortaPacks without a built-in clock reference, as that uses the other PLL.
TODO: Switching PLLs may be kind of pointless now...
* CMake: Pull HackRF project from GitHub and build.
* CMake: Remove commented code.
* CMake: Clone HackRF via HTTPS, not SSH.
* CMake: Extra pause for slow post-DFU firmware boot-up.
* CMake: TODO to fix SVF/XSVF file source.
* CMake: Ask HackRF hackrf_usb to make DFU binary.
* Travis-CI: Add dfu-util, now that HackRF firmware is being built for inclusion.
* Travis-CI: Update build environment to Ubuntu xenial
Previously Trusty.
* Travis-CI: Incorrectly structured my request for dfu-util package.
I'm soooo talented.
* ldscript: Mark flash, ram with correct R/W/X flags.
* ldscript: Enlarge M0 flash region to 1Mbyte, the size of the HackRF SPI flash.
* Receiver: Hide PPM adjustment if clock source is not HackRF crystal.
* Documentation: Update product photos and README.
* Documentation: Add TCXO feature to README description.
* Application: Rearrange files to match HAVOC directory structure.
* Map view in AIS (#213)
* Added GeoMapView to AISRecentEntryDetailView
* Added autoupdate in AIS map
* Revert "Map view in AIS (#213)"
This reverts commit 262c030224b9ea3e56ff1c8a66246e7ecf30e41f.
This commit will be cherry-picked onto a clean branch, then re-committed after a troublesome pull request is reverted.
* Revert "Upstream merge to make new revision of PortaPack work (#206)"
This reverts commit 920b98f7c9a30371b643c42949066fb7d2441daf.
This pull request was missing some changes and was preventing firmware from functioning on older PortaPacks.
* CPLD: Pull bitstream from HackRF project.
* SGPIO: Identify pins on CPLD by their new functions. Pull down HOST_SYNC_EN.
* CPLD: Don't load HackRF CPLD bitstream into RAM.
Trying to converge CPLD implementations, so this shouldn't be necesssary. HOWEVER, it would be good to *check* the CPLD contents and provide a way to update, if necessary.
* CPLD: Tweak clock generator config to match CPLD timing changes in HackRF.
* PinConfig: Drive CPLD pins correctly.
* CMake: Use jboone/hackrf master branch, now that CPLD fixes are there.
* CMake: Fix HackRF CPLD SVF dependency.
Build would break on the first pass, but work if you restarted make.
* CMake: Fix my misuse of the HackRF CMake configuration -- was building from too deep in the directory tree
* CMake: Work-around for CMake 3.5 not supporting ExternalProject_Add SOURCE_SUBDIR.
* CMake: Choose a CMP0005 policy to quiet CMake warnings.
* Settings: Show active clock reference. Only show PPM adjustment for HackRF source.
* Setup: Format clock reference frequency in MHz, not Hz.
* Radio Settings: Change reference clock text color.
Make consistent color with other un-editable text.
TODO: This is a bit of a hack to get ui::Text objects to support custom colors, like the Label structures used elsewhere.
* Pin config: VREGMODE=1, add other pins for completeness, comment detail
* Pin setup: More useful comments.
* Pin setup: Change some defaults, only set up PortaPack pins if detected.
* Pin setup: Disable LPC pull-ups on PP CPLD data bus, as CPLD is pulling up.
* Baseband: Allow larger HackRF firmware image.
* HackRF: Remove USER_INTERFACE CMake variable.
* CPLD: Make use of HackRF CPLD tool to generate code.
* Release: Add generation of MD5SUMS, SHA256SUMS during "make release"
* Clock generator: Match clock output currents to HackRF firmware.
Someday, we will share a code base again...
* CMake: Make "firmware" target part of the "all" target.
So now an unqualified "make" will make the firmware binary.
* CMake: Change how HackRF firmware is incorporated into binary.
Use the separate HackRF "RAM" binary. Get rid of the strip-dfu utility, since there's no longer a need to extract the binary from the DFU.
* CMake: Renamed GIT_REVISION* -> GIT_VERSION* to match HackRF build env.
* CMake: Bring git version handling closer to HackRF for code reuse.
* Travis-CI: Rework CI release artifact output.
* Travis-CI: Don't assign PROJECT_NAME within deploy-nightly.sh
* Travis-CI: Oops, don't include distro package for compiler...
...when also installing it from a third-party PPA.
* Travis-CI: Update GCC package, old one seems "retired"?
* Travis-CI: OK, the gcc-arm-none-eabi package is NOT current. Undoing...
* Travis-CI: Path oopsies.
* Travis-CI: More path confusion. I think this will do it. *touch wood*
* Travis-CI: Update build message sent to FreeNode #portapack IRC.
* Travis-CI: Break out BUILD_DATE from BUILD_NAME.
* Travis-CI: Introduce build directories, include MD5 and SHA256 hashes.
* Travis-CI: Fix MD5SUMS/SHA256SUMS paths.
* Travis-CI: Fix typo generating name for binary links.
* Power: Keep 1V8 off until after VAA is brought up.
* Power: Bring up VAA in several steps to keep voltage swing small.
* About: Show longer commit/tag version string.
* Versioning: Report non-CI builds with "local-" version prefix.
* Travis-CI: Report new nightly build site in IRC notification.
* Change use of GIT_VERSION to VERSION_STRING
Required by prior merge.
* Git: add "hackrf" submodule.
* CMake: Use hackrf submodule for build, stop pulling during build.
* Travis: Fix build paths due to CMake submodule changes.
* Travis: Explicitly update submodules recursively
* Revert "Travis: Explicitly update submodules recursively"
This reverts commit b246438d805f431e727e01b7407540e932e89ee1.
* Travis: Try to sort out hackrf submodule output paths...
* Travis: I don't know what I'm doing.
* CMake: "make firmware" problem due to target vs. path used for dependency.
* HackRF: Incorporate YAML security fix.
* CMake: Fix more places where targets should be used...
...instead of paths to outputs.
* CMake: Add DFU file to "make firmware" outputs
* HackRF: Update submodule for CMake m0_bin.s path fix.
* added encoder support to alphanum
* added encoder support to freq-keypad
* UI Redesign -
added BtnGrid & NewButton widgets and created a new button-based
layout, with both encoder and touchscreen are supported.
* Scanner changes:
- using SCANNER.TXT for frequencies, ranges also supported. file
format is the same as any other frequency file, thus can be edited
via the Frequency Manager.
- add nfm bw selector & time-to-wait to the UI
- add SCANNER.TXT to sdcard dir
orignal idea & scanner file adopted from user 'bicurico'
* small changes to scanner
* remember last category on frequency manager
* fix: cast int16_t instead of uint16_t (although i doubt we will
have more than 32767 buttons in the array...)
* added a missing last_category_id on freq manager
2019-10-29 23:53:54 +02:00
|
|
|
class NewButton : public Widget {
|
|
|
|
public:
|
|
|
|
std::function<void(void)> on_select { };
|
|
|
|
//std::function<void(NewButton&)> on_select { };
|
|
|
|
std::function<bool(NewButton&, KeyEvent)> on_dir { };
|
|
|
|
std::function<void(NewButton&)> on_highlight { };
|
|
|
|
|
|
|
|
NewButton(const NewButton&) = delete;
|
|
|
|
NewButton& operator=(const NewButton&) = delete;
|
|
|
|
NewButton(Rect parent_rect, std::string text, const Bitmap* bitmap);
|
2023-05-11 13:46:38 -07:00
|
|
|
NewButton(Rect parent_rect, std::string text, const Bitmap* bitmap, Color color);
|
UI Redesign for Portapack-Havoc (#268)
* Power: Turn off additional peripheral clock branches.
* Update schematic with new symbol table and KiCad standard symbols.
Fix up wires.
* Schematic: Update power net labels.
* Schematic: Update footprint names to match library changes.
* Schematic: Update header vendor and part numbers.
* Schematic: Specify (arbitrary) value for PDN# net.
* Schematic: Remove fourth fiducial. Not standard practice, and was taking up valuable board space.
* Schematic: Add reference oscillator -- options for clipped sine or HCMOS output.
* Schematic: Update copyright year.
* Schematic: Remove CLKOUT to CPLD. It was a half-baked idea.
* Schematic: Add (experimental) GPS circuit.
Add note about charging circuit.
Update date and revision to match PCB.
* PCB: Update from schematic change: now revision 20180819.
Diff was extensive due to net renumbering...
* PCB: Fix GPS courtyard to accommodate crazy solder paste recommendation in integration manual.
PCB: Address DRC clearance violation between via and oscillator pad.
* PCB: Update copyright on drawing.
* Update schematic and PCB date and revision.
* gitignore: Sublime Text editor project/workspace files
* Power: Power up or power down peripheral clock at appropriate times, so firmware doesn't freeze...
* Clocking: Fix incorrect shift for CGU IDIVx_CTRL.PD field.
* LPC43xx: Add CGU IDIVx struct/union type.
* Power: Switch off unused IDIV dividers. Make note of active IDIVs and their use.
* HackRF Mode: Upgrade firmware to 2018.01.1 (API 1.02)
* MAX V CPLD: Refactor class to look more like Xilinx CoolRunner II CPLD class.
* MAX V CPLD: Add BYPASS, SAMPLE support.
Rename enter_isp -> enable, exit_isp -> disable.
Use SAMPLE at start of flash process, which somehow addresses the problem where CFM wouldn't load into SRAM (and become the active bitstream) after flashing.
* MAX V CPLD: Reverse verify data checking logic to make it a little faster.
* CPLD: After reprogramming flash, immediately clamp I/O signals, load to SRAM, and "execute" the new bitstream.
* Si5351: Refactor code, make one of the registers more type-safe.
Clock Manager: Track selected reference clock source for later use in user interface.
* Clock Manager: Add note about PPM only affecting Si5351C PLLA, which always runs from the HackRF 25MHz crystal.
It is assumed an external clock does not need adjustment, though I am open to being convinced otherwise...
* PPM UI: Show "EXT" when showing PPM adjustment and reference clock is external.
* CPLD: Add pins and logic for new PortaPack hardware feature(s).
* CPLD: Bitstream to support new hardware features.
* Clock Generator: Add a couple more setter methods for ClockControl registers.
* Clock Manager: Use shared MCU CLKIN clock control configuration constant.
* Clock Manager: Reduce MCU CLKIN driver current. 2mA should be plenty.
* Clock Manager: Remove redundant clock generator output enable.
* Bootstrap: Remove unnecessary ldscript hack to locate SPIFI mode change code in RAM.
* Bootstrap: Get CPU operating at max frequency as soon as possible.
Update SPIFI speed comment.
Make some more LPC43xx types into unions with uint32_t.
* Bootstrap: Explicitly configure IDIVB for SPIFI, despite LPC43xx bootloader setting it.
* Clock Manager: Init peripherals before CPLD reconfig. Do the clock generator setup after, so we can check presence of PortaPack reference clock with the help of the latest CPLD bitstream.
* Clock Manager: Reverse sense of conditional that determines crystal or non-crystal reference source. This is for an expected upcoming change where multiple external options can be differentiated.
* Bootstrap: Consolidate clock configuration, update SPIFI rate comment.
* Clock Manager: Use IDIVA for clock source for all peripherals, instead of PLL1. Should make switching easier going forward.
Don't use IRC as clock during initial clock manager configuration. Until we switch to GP_CLKIN, we should go flat out...
* ChibiOS M0: Change default clock speed to 204MHz, since bootstrap now maxes out clock speed before starting M0 execution.
* PortaPack IO: Expose method to set reference oscillator enable pin.
* Pin configuration: Do SPIFI pin config with other pins, in preparation for eliminating separate bootloader.
* Pin configuration: Disable input buffers on pins that are never read.
* Revert "ChibiOS M0: Change default clock speed to 204MHz, since bootstrap now maxes out clock speed before starting M0 execution."
This reverts commit c0e2bb6cc4cc656769323bdbb8ee5a16d2d5bb03.
* PCB: Change PCB stackup, Tg, clarify solder mask color, use more metric.
* PCB: Move HackRF header P9 to B.CrtYd layer.
* PCB: Change a Tg reference I missed.
* PCB: Update footprints for parts with mismatched CAD->tape rotation.
Adjust a few layer choice and line thickness bits.
* PCB: Got cold feet, switched back to rectangular pads.
* PCB: Add Eco layers to be visible and Gerber output.
* PCB: Use aux origin for plotting, for tidier coordinates.
* PCB: Output Gerber job file, because why not?
* Schematic: Correct footprints for two reference-related components.
* Schematic: Remove manfuacturer and part number for DNP component.
* Schematic: Specify resistor value, manufacturer, part number for reference oscillator series termination.
* PCB: Update netlist and footprints from schematic.
* Netlist: Updated component values, footprints.
* PCB: Nudge some components and traces to address DRC clearance violations.
* PCB: Allow KiCad to update zone timestamps (again?!).
* PCB: Generate *all* Gerber layers.
* Schematic, PCB: Update revision to 20181025.
* PCB: Adjust fab layer annotations orientation and font size.
* PCB: Hide mounting hole reference designators on silk layer.
* PCB: Shrink U1, U3 pads to get 0.2mm space between pads.
* PCB: Set pad-to-mask clearance to zero, leave up to fab. Set minimum mask web to 0.2mm for non-black options.
* PCB: Revise U1 pad shape, mask, paste, thermal drills.
Clearance is improved at corner pads.
* PCB: Tweak U3 for better thermal pad/drill/mask/paste design.
* PCB: Change solder mask color to blue.
* Schematic, PCB: Update revision to 20181029.
* PCB: Bump minimum mask web down a tiny bit because KiCad is having trouble with math.
* Update schematic
* Remove unused board files.
* Add LPC43xx functions.
* chibios: Replace code with per-peripheral structs defining clocks, interrupts, and reset bits.
* LPC43xx: Add MCPWM peripheral struct.
* clock generator: Use recommended PLL reset register value.
Datasheet recommends a value. AN619 is quiet on the topic, claims the low nibble is default 0b0000.
* GPIO: Tweak masking of SCU function.
I don't remember why I thought this was necessary...
* HAL: Explicitly turn on timer peripheral clocks used as systicks, during init.
* SCU: Add struct to hold pin configuration.
* PAL: Add functions to address The Glitch.
https://greatscottgadgets.com/2018/02-28-we-fixed-the-glitch/
* PAL/board: New IO initialization code
Declare initial state for SCU pin config, GPIOs. Apply initial state during PAL init. Perform VAA slow turn-on to address The Glitch.
* Merge M0 and M4 to eliminate need for bootstrap firmware
During _early_init, detect if we're running on the M4 or M0.
If M4: do M4-specific core initialization, reset peripherals, speed up SPIFI clock, start M0, go to sleep.
If M0: do all the other things.
* Pins: Miscellaneous SCU configuration tweaks.
* Little code clarity improvement.
* bootstrap: Remove, not necessary.
* Clock Manager: Large re-working to support external references.
* Clock Manager: Actually store chosen clock reference
Similarly-named local was covering a member and discarding the value.
* Clock Manager: Reference type which contains source, frequency.
* Setup: Display reference source, frequency in frequency correction screen.
* LPC43xx API: Add extern "C" for use from C++.
* Use LPC43xx API for SGPIO, GPDMA, I2S initialization.
* I2S: Add BASE_AUDIO_CLK management.
* Add MOTOCON_PWM clock/reset structure.
* Serial: Fix dumb typos.
* Serial: Remove extra reference operator.
* Serial: Cut-and-paste error in structure type name.
* Move SCU structure from PAL to LPC43xx API.
It'd be nice if I gave some thought to where code should live before I commit it.
* VAA power: Move code to HackRF board file
It doesn't belong in PAL.
* MAX5 CPLD: Add SAMPLE and EXTEST methods.
* Flash image: Change packing scheme to use flash more efficiently.
Application is now a single image for both M4 bootstrap and M0.
Baseband images come immediately after application binary. No need to align to large blocks (and waste lots of flash).
* Clock Manager: Remove PLL1 power down function.
* Move and rename peripherals reset function to board module.
* Remove unused peripheral/clock management.
* Clock Manager: Extract switch to IRC into separate function.
* Clock Manager: More explicit shutdown of clocks, clock generator.
* Move initialization to board module.
* ChibiOS: Rename "application" board, add "baseband" board.
There are now two ChibiOS "boards", one which runs the application and does the hardware setup. The other board, "baseband", does very little setup.
* Clock Manager: Remove unused crystal enable/disable code.
* Clock Manager: Restore clock configuration to SPIFI bootloader state before app shutdown.
* Reset peripherals on app shutdown.
Be careful not to reset M0APP (the core we're running on) or GPIO (which is holding the hardware in a stable state).
* M4/baseband hal_lld_init: use IDIVA, which is configured earlier by M0.
This was causing problems during restart into HackRF mode. Baseband hal_lld_init changed M4 clock from IDIVA (set by M0) to PLL1, which was unceremoniously turned off during shutdown.
* Audio app: Stop audio PLL on shutdown.
* M4 HAL: Make LPC43XX_M4_CLK_SRC optional.
This was changing the BASE_M4_CLK when a baseband was run.
* LPC43xx C++ layer: Fix IDIVx constructor IDIV narrow field width.
* Application board: hide the peripherals_reset function, as it isn't useful except during hardware init.
* Consolidate hardware init code to some degree.
ClockManager is super-overloaded and murky in its purpose.
Migrate audio from IDIVC to IDIVD, to more closely resemble initial clock scheme, so it's simpler to get back to it during shutdown.
* Migrate some startup code to application board.
* Si5351: Use correct methods for reset().
update_output_enable_control() doesn't reset the enabled outputs to the reset state, unless the object is freshly initialized, which it isn't when performing firmware shutdown.
For similar reasons, use set_clock_control() instead of setting internal state and then using the update function.
* GPIO: Set SPIFI CS pin to match input buffer state coming out of bootloader.
* Change application board.c to .cpp, with required dependent changes
* Board: Clean up SCU configuration code/data.
* I2S: Add shutdown code and use it.
* LPC43xx: Consolidate a bunch of structures that had been scattered all over.
...because I'm an undisciplined coder.
* I2S: Fix ordering of branch and base clock disable.
Core was hanging, presumably because the register interface on the branch/peripheral was unresponsive after the base clock was disabled.
* Controls: Save and expose raw navigation wheel switch state
I need to do some work on debouncing and ignoring simultaneous key presses.
* Controls: Add debug view for switches state.
* Controls: Ignore all key presses until all keys are released.
This should address some mechanical quirks of the navigation wheel used on the PortaPack.
* Clock Manager: Wait for only the necessary PLL to lock.
Wasn't working on PortaPacks without a built-in clock reference, as that uses the other PLL.
TODO: Switching PLLs may be kind of pointless now...
* CMake: Pull HackRF project from GitHub and build.
* CMake: Remove commented code.
* CMake: Clone HackRF via HTTPS, not SSH.
* CMake: Extra pause for slow post-DFU firmware boot-up.
* CMake: TODO to fix SVF/XSVF file source.
* CMake: Ask HackRF hackrf_usb to make DFU binary.
* Travis-CI: Add dfu-util, now that HackRF firmware is being built for inclusion.
* Travis-CI: Update build environment to Ubuntu xenial
Previously Trusty.
* Travis-CI: Incorrectly structured my request for dfu-util package.
I'm soooo talented.
* ldscript: Mark flash, ram with correct R/W/X flags.
* ldscript: Enlarge M0 flash region to 1Mbyte, the size of the HackRF SPI flash.
* Receiver: Hide PPM adjustment if clock source is not HackRF crystal.
* Documentation: Update product photos and README.
* Documentation: Add TCXO feature to README description.
* Application: Rearrange files to match HAVOC directory structure.
* Map view in AIS (#213)
* Added GeoMapView to AISRecentEntryDetailView
* Added autoupdate in AIS map
* Revert "Map view in AIS (#213)"
This reverts commit 262c030224b9ea3e56ff1c8a66246e7ecf30e41f.
This commit will be cherry-picked onto a clean branch, then re-committed after a troublesome pull request is reverted.
* Revert "Upstream merge to make new revision of PortaPack work (#206)"
This reverts commit 920b98f7c9a30371b643c42949066fb7d2441daf.
This pull request was missing some changes and was preventing firmware from functioning on older PortaPacks.
* CPLD: Pull bitstream from HackRF project.
* SGPIO: Identify pins on CPLD by their new functions. Pull down HOST_SYNC_EN.
* CPLD: Don't load HackRF CPLD bitstream into RAM.
Trying to converge CPLD implementations, so this shouldn't be necesssary. HOWEVER, it would be good to *check* the CPLD contents and provide a way to update, if necessary.
* CPLD: Tweak clock generator config to match CPLD timing changes in HackRF.
* PinConfig: Drive CPLD pins correctly.
* CMake: Use jboone/hackrf master branch, now that CPLD fixes are there.
* CMake: Fix HackRF CPLD SVF dependency.
Build would break on the first pass, but work if you restarted make.
* CMake: Fix my misuse of the HackRF CMake configuration -- was building from too deep in the directory tree
* CMake: Work-around for CMake 3.5 not supporting ExternalProject_Add SOURCE_SUBDIR.
* CMake: Choose a CMP0005 policy to quiet CMake warnings.
* Settings: Show active clock reference. Only show PPM adjustment for HackRF source.
* Setup: Format clock reference frequency in MHz, not Hz.
* Radio Settings: Change reference clock text color.
Make consistent color with other un-editable text.
TODO: This is a bit of a hack to get ui::Text objects to support custom colors, like the Label structures used elsewhere.
* Pin config: VREGMODE=1, add other pins for completeness, comment detail
* Pin setup: More useful comments.
* Pin setup: Change some defaults, only set up PortaPack pins if detected.
* Pin setup: Disable LPC pull-ups on PP CPLD data bus, as CPLD is pulling up.
* Baseband: Allow larger HackRF firmware image.
* HackRF: Remove USER_INTERFACE CMake variable.
* CPLD: Make use of HackRF CPLD tool to generate code.
* Release: Add generation of MD5SUMS, SHA256SUMS during "make release"
* Clock generator: Match clock output currents to HackRF firmware.
Someday, we will share a code base again...
* CMake: Make "firmware" target part of the "all" target.
So now an unqualified "make" will make the firmware binary.
* CMake: Change how HackRF firmware is incorporated into binary.
Use the separate HackRF "RAM" binary. Get rid of the strip-dfu utility, since there's no longer a need to extract the binary from the DFU.
* CMake: Renamed GIT_REVISION* -> GIT_VERSION* to match HackRF build env.
* CMake: Bring git version handling closer to HackRF for code reuse.
* Travis-CI: Rework CI release artifact output.
* Travis-CI: Don't assign PROJECT_NAME within deploy-nightly.sh
* Travis-CI: Oops, don't include distro package for compiler...
...when also installing it from a third-party PPA.
* Travis-CI: Update GCC package, old one seems "retired"?
* Travis-CI: OK, the gcc-arm-none-eabi package is NOT current. Undoing...
* Travis-CI: Path oopsies.
* Travis-CI: More path confusion. I think this will do it. *touch wood*
* Travis-CI: Update build message sent to FreeNode #portapack IRC.
* Travis-CI: Break out BUILD_DATE from BUILD_NAME.
* Travis-CI: Introduce build directories, include MD5 and SHA256 hashes.
* Travis-CI: Fix MD5SUMS/SHA256SUMS paths.
* Travis-CI: Fix typo generating name for binary links.
* Power: Keep 1V8 off until after VAA is brought up.
* Power: Bring up VAA in several steps to keep voltage swing small.
* About: Show longer commit/tag version string.
* Versioning: Report non-CI builds with "local-" version prefix.
* Travis-CI: Report new nightly build site in IRC notification.
* Change use of GIT_VERSION to VERSION_STRING
Required by prior merge.
* Git: add "hackrf" submodule.
* CMake: Use hackrf submodule for build, stop pulling during build.
* Travis: Fix build paths due to CMake submodule changes.
* Travis: Explicitly update submodules recursively
* Revert "Travis: Explicitly update submodules recursively"
This reverts commit b246438d805f431e727e01b7407540e932e89ee1.
* Travis: Try to sort out hackrf submodule output paths...
* Travis: I don't know what I'm doing.
* CMake: "make firmware" problem due to target vs. path used for dependency.
* HackRF: Incorporate YAML security fix.
* CMake: Fix more places where targets should be used...
...instead of paths to outputs.
* CMake: Add DFU file to "make firmware" outputs
* HackRF: Update submodule for CMake m0_bin.s path fix.
* added encoder support to alphanum
* added encoder support to freq-keypad
* UI Redesign -
added BtnGrid & NewButton widgets and created a new button-based
layout, with both encoder and touchscreen are supported.
* Scanner changes:
- using SCANNER.TXT for frequencies, ranges also supported. file
format is the same as any other frequency file, thus can be edited
via the Frequency Manager.
- add nfm bw selector & time-to-wait to the UI
- add SCANNER.TXT to sdcard dir
orignal idea & scanner file adopted from user 'bicurico'
* small changes to scanner
* remember last category on frequency manager
* fix: cast int16_t instead of uint16_t (although i doubt we will
have more than 32767 buttons in the array...)
* added a missing last_category_id on freq manager
2019-10-29 23:53:54 +02:00
|
|
|
NewButton(
|
|
|
|
) : NewButton { { }, { }, { } }
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void set_bitmap(const Bitmap* bitmap);
|
|
|
|
void set_text(const std::string value);
|
|
|
|
void set_color(Color value);
|
|
|
|
std::string text() const;
|
|
|
|
const Bitmap* bitmap();
|
|
|
|
ui::Color color();
|
|
|
|
|
|
|
|
void on_focus() override;
|
|
|
|
bool on_key(const KeyEvent key) override;
|
|
|
|
bool on_touch(const TouchEvent event) override;
|
|
|
|
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::string text_;
|
|
|
|
const Bitmap* bitmap_;
|
2023-05-11 13:46:38 -07:00
|
|
|
Color color_;
|
UI Redesign for Portapack-Havoc (#268)
* Power: Turn off additional peripheral clock branches.
* Update schematic with new symbol table and KiCad standard symbols.
Fix up wires.
* Schematic: Update power net labels.
* Schematic: Update footprint names to match library changes.
* Schematic: Update header vendor and part numbers.
* Schematic: Specify (arbitrary) value for PDN# net.
* Schematic: Remove fourth fiducial. Not standard practice, and was taking up valuable board space.
* Schematic: Add reference oscillator -- options for clipped sine or HCMOS output.
* Schematic: Update copyright year.
* Schematic: Remove CLKOUT to CPLD. It was a half-baked idea.
* Schematic: Add (experimental) GPS circuit.
Add note about charging circuit.
Update date and revision to match PCB.
* PCB: Update from schematic change: now revision 20180819.
Diff was extensive due to net renumbering...
* PCB: Fix GPS courtyard to accommodate crazy solder paste recommendation in integration manual.
PCB: Address DRC clearance violation between via and oscillator pad.
* PCB: Update copyright on drawing.
* Update schematic and PCB date and revision.
* gitignore: Sublime Text editor project/workspace files
* Power: Power up or power down peripheral clock at appropriate times, so firmware doesn't freeze...
* Clocking: Fix incorrect shift for CGU IDIVx_CTRL.PD field.
* LPC43xx: Add CGU IDIVx struct/union type.
* Power: Switch off unused IDIV dividers. Make note of active IDIVs and their use.
* HackRF Mode: Upgrade firmware to 2018.01.1 (API 1.02)
* MAX V CPLD: Refactor class to look more like Xilinx CoolRunner II CPLD class.
* MAX V CPLD: Add BYPASS, SAMPLE support.
Rename enter_isp -> enable, exit_isp -> disable.
Use SAMPLE at start of flash process, which somehow addresses the problem where CFM wouldn't load into SRAM (and become the active bitstream) after flashing.
* MAX V CPLD: Reverse verify data checking logic to make it a little faster.
* CPLD: After reprogramming flash, immediately clamp I/O signals, load to SRAM, and "execute" the new bitstream.
* Si5351: Refactor code, make one of the registers more type-safe.
Clock Manager: Track selected reference clock source for later use in user interface.
* Clock Manager: Add note about PPM only affecting Si5351C PLLA, which always runs from the HackRF 25MHz crystal.
It is assumed an external clock does not need adjustment, though I am open to being convinced otherwise...
* PPM UI: Show "EXT" when showing PPM adjustment and reference clock is external.
* CPLD: Add pins and logic for new PortaPack hardware feature(s).
* CPLD: Bitstream to support new hardware features.
* Clock Generator: Add a couple more setter methods for ClockControl registers.
* Clock Manager: Use shared MCU CLKIN clock control configuration constant.
* Clock Manager: Reduce MCU CLKIN driver current. 2mA should be plenty.
* Clock Manager: Remove redundant clock generator output enable.
* Bootstrap: Remove unnecessary ldscript hack to locate SPIFI mode change code in RAM.
* Bootstrap: Get CPU operating at max frequency as soon as possible.
Update SPIFI speed comment.
Make some more LPC43xx types into unions with uint32_t.
* Bootstrap: Explicitly configure IDIVB for SPIFI, despite LPC43xx bootloader setting it.
* Clock Manager: Init peripherals before CPLD reconfig. Do the clock generator setup after, so we can check presence of PortaPack reference clock with the help of the latest CPLD bitstream.
* Clock Manager: Reverse sense of conditional that determines crystal or non-crystal reference source. This is for an expected upcoming change where multiple external options can be differentiated.
* Bootstrap: Consolidate clock configuration, update SPIFI rate comment.
* Clock Manager: Use IDIVA for clock source for all peripherals, instead of PLL1. Should make switching easier going forward.
Don't use IRC as clock during initial clock manager configuration. Until we switch to GP_CLKIN, we should go flat out...
* ChibiOS M0: Change default clock speed to 204MHz, since bootstrap now maxes out clock speed before starting M0 execution.
* PortaPack IO: Expose method to set reference oscillator enable pin.
* Pin configuration: Do SPIFI pin config with other pins, in preparation for eliminating separate bootloader.
* Pin configuration: Disable input buffers on pins that are never read.
* Revert "ChibiOS M0: Change default clock speed to 204MHz, since bootstrap now maxes out clock speed before starting M0 execution."
This reverts commit c0e2bb6cc4cc656769323bdbb8ee5a16d2d5bb03.
* PCB: Change PCB stackup, Tg, clarify solder mask color, use more metric.
* PCB: Move HackRF header P9 to B.CrtYd layer.
* PCB: Change a Tg reference I missed.
* PCB: Update footprints for parts with mismatched CAD->tape rotation.
Adjust a few layer choice and line thickness bits.
* PCB: Got cold feet, switched back to rectangular pads.
* PCB: Add Eco layers to be visible and Gerber output.
* PCB: Use aux origin for plotting, for tidier coordinates.
* PCB: Output Gerber job file, because why not?
* Schematic: Correct footprints for two reference-related components.
* Schematic: Remove manfuacturer and part number for DNP component.
* Schematic: Specify resistor value, manufacturer, part number for reference oscillator series termination.
* PCB: Update netlist and footprints from schematic.
* Netlist: Updated component values, footprints.
* PCB: Nudge some components and traces to address DRC clearance violations.
* PCB: Allow KiCad to update zone timestamps (again?!).
* PCB: Generate *all* Gerber layers.
* Schematic, PCB: Update revision to 20181025.
* PCB: Adjust fab layer annotations orientation and font size.
* PCB: Hide mounting hole reference designators on silk layer.
* PCB: Shrink U1, U3 pads to get 0.2mm space between pads.
* PCB: Set pad-to-mask clearance to zero, leave up to fab. Set minimum mask web to 0.2mm for non-black options.
* PCB: Revise U1 pad shape, mask, paste, thermal drills.
Clearance is improved at corner pads.
* PCB: Tweak U3 for better thermal pad/drill/mask/paste design.
* PCB: Change solder mask color to blue.
* Schematic, PCB: Update revision to 20181029.
* PCB: Bump minimum mask web down a tiny bit because KiCad is having trouble with math.
* Update schematic
* Remove unused board files.
* Add LPC43xx functions.
* chibios: Replace code with per-peripheral structs defining clocks, interrupts, and reset bits.
* LPC43xx: Add MCPWM peripheral struct.
* clock generator: Use recommended PLL reset register value.
Datasheet recommends a value. AN619 is quiet on the topic, claims the low nibble is default 0b0000.
* GPIO: Tweak masking of SCU function.
I don't remember why I thought this was necessary...
* HAL: Explicitly turn on timer peripheral clocks used as systicks, during init.
* SCU: Add struct to hold pin configuration.
* PAL: Add functions to address The Glitch.
https://greatscottgadgets.com/2018/02-28-we-fixed-the-glitch/
* PAL/board: New IO initialization code
Declare initial state for SCU pin config, GPIOs. Apply initial state during PAL init. Perform VAA slow turn-on to address The Glitch.
* Merge M0 and M4 to eliminate need for bootstrap firmware
During _early_init, detect if we're running on the M4 or M0.
If M4: do M4-specific core initialization, reset peripherals, speed up SPIFI clock, start M0, go to sleep.
If M0: do all the other things.
* Pins: Miscellaneous SCU configuration tweaks.
* Little code clarity improvement.
* bootstrap: Remove, not necessary.
* Clock Manager: Large re-working to support external references.
* Clock Manager: Actually store chosen clock reference
Similarly-named local was covering a member and discarding the value.
* Clock Manager: Reference type which contains source, frequency.
* Setup: Display reference source, frequency in frequency correction screen.
* LPC43xx API: Add extern "C" for use from C++.
* Use LPC43xx API for SGPIO, GPDMA, I2S initialization.
* I2S: Add BASE_AUDIO_CLK management.
* Add MOTOCON_PWM clock/reset structure.
* Serial: Fix dumb typos.
* Serial: Remove extra reference operator.
* Serial: Cut-and-paste error in structure type name.
* Move SCU structure from PAL to LPC43xx API.
It'd be nice if I gave some thought to where code should live before I commit it.
* VAA power: Move code to HackRF board file
It doesn't belong in PAL.
* MAX5 CPLD: Add SAMPLE and EXTEST methods.
* Flash image: Change packing scheme to use flash more efficiently.
Application is now a single image for both M4 bootstrap and M0.
Baseband images come immediately after application binary. No need to align to large blocks (and waste lots of flash).
* Clock Manager: Remove PLL1 power down function.
* Move and rename peripherals reset function to board module.
* Remove unused peripheral/clock management.
* Clock Manager: Extract switch to IRC into separate function.
* Clock Manager: More explicit shutdown of clocks, clock generator.
* Move initialization to board module.
* ChibiOS: Rename "application" board, add "baseband" board.
There are now two ChibiOS "boards", one which runs the application and does the hardware setup. The other board, "baseband", does very little setup.
* Clock Manager: Remove unused crystal enable/disable code.
* Clock Manager: Restore clock configuration to SPIFI bootloader state before app shutdown.
* Reset peripherals on app shutdown.
Be careful not to reset M0APP (the core we're running on) or GPIO (which is holding the hardware in a stable state).
* M4/baseband hal_lld_init: use IDIVA, which is configured earlier by M0.
This was causing problems during restart into HackRF mode. Baseband hal_lld_init changed M4 clock from IDIVA (set by M0) to PLL1, which was unceremoniously turned off during shutdown.
* Audio app: Stop audio PLL on shutdown.
* M4 HAL: Make LPC43XX_M4_CLK_SRC optional.
This was changing the BASE_M4_CLK when a baseband was run.
* LPC43xx C++ layer: Fix IDIVx constructor IDIV narrow field width.
* Application board: hide the peripherals_reset function, as it isn't useful except during hardware init.
* Consolidate hardware init code to some degree.
ClockManager is super-overloaded and murky in its purpose.
Migrate audio from IDIVC to IDIVD, to more closely resemble initial clock scheme, so it's simpler to get back to it during shutdown.
* Migrate some startup code to application board.
* Si5351: Use correct methods for reset().
update_output_enable_control() doesn't reset the enabled outputs to the reset state, unless the object is freshly initialized, which it isn't when performing firmware shutdown.
For similar reasons, use set_clock_control() instead of setting internal state and then using the update function.
* GPIO: Set SPIFI CS pin to match input buffer state coming out of bootloader.
* Change application board.c to .cpp, with required dependent changes
* Board: Clean up SCU configuration code/data.
* I2S: Add shutdown code and use it.
* LPC43xx: Consolidate a bunch of structures that had been scattered all over.
...because I'm an undisciplined coder.
* I2S: Fix ordering of branch and base clock disable.
Core was hanging, presumably because the register interface on the branch/peripheral was unresponsive after the base clock was disabled.
* Controls: Save and expose raw navigation wheel switch state
I need to do some work on debouncing and ignoring simultaneous key presses.
* Controls: Add debug view for switches state.
* Controls: Ignore all key presses until all keys are released.
This should address some mechanical quirks of the navigation wheel used on the PortaPack.
* Clock Manager: Wait for only the necessary PLL to lock.
Wasn't working on PortaPacks without a built-in clock reference, as that uses the other PLL.
TODO: Switching PLLs may be kind of pointless now...
* CMake: Pull HackRF project from GitHub and build.
* CMake: Remove commented code.
* CMake: Clone HackRF via HTTPS, not SSH.
* CMake: Extra pause for slow post-DFU firmware boot-up.
* CMake: TODO to fix SVF/XSVF file source.
* CMake: Ask HackRF hackrf_usb to make DFU binary.
* Travis-CI: Add dfu-util, now that HackRF firmware is being built for inclusion.
* Travis-CI: Update build environment to Ubuntu xenial
Previously Trusty.
* Travis-CI: Incorrectly structured my request for dfu-util package.
I'm soooo talented.
* ldscript: Mark flash, ram with correct R/W/X flags.
* ldscript: Enlarge M0 flash region to 1Mbyte, the size of the HackRF SPI flash.
* Receiver: Hide PPM adjustment if clock source is not HackRF crystal.
* Documentation: Update product photos and README.
* Documentation: Add TCXO feature to README description.
* Application: Rearrange files to match HAVOC directory structure.
* Map view in AIS (#213)
* Added GeoMapView to AISRecentEntryDetailView
* Added autoupdate in AIS map
* Revert "Map view in AIS (#213)"
This reverts commit 262c030224b9ea3e56ff1c8a66246e7ecf30e41f.
This commit will be cherry-picked onto a clean branch, then re-committed after a troublesome pull request is reverted.
* Revert "Upstream merge to make new revision of PortaPack work (#206)"
This reverts commit 920b98f7c9a30371b643c42949066fb7d2441daf.
This pull request was missing some changes and was preventing firmware from functioning on older PortaPacks.
* CPLD: Pull bitstream from HackRF project.
* SGPIO: Identify pins on CPLD by their new functions. Pull down HOST_SYNC_EN.
* CPLD: Don't load HackRF CPLD bitstream into RAM.
Trying to converge CPLD implementations, so this shouldn't be necesssary. HOWEVER, it would be good to *check* the CPLD contents and provide a way to update, if necessary.
* CPLD: Tweak clock generator config to match CPLD timing changes in HackRF.
* PinConfig: Drive CPLD pins correctly.
* CMake: Use jboone/hackrf master branch, now that CPLD fixes are there.
* CMake: Fix HackRF CPLD SVF dependency.
Build would break on the first pass, but work if you restarted make.
* CMake: Fix my misuse of the HackRF CMake configuration -- was building from too deep in the directory tree
* CMake: Work-around for CMake 3.5 not supporting ExternalProject_Add SOURCE_SUBDIR.
* CMake: Choose a CMP0005 policy to quiet CMake warnings.
* Settings: Show active clock reference. Only show PPM adjustment for HackRF source.
* Setup: Format clock reference frequency in MHz, not Hz.
* Radio Settings: Change reference clock text color.
Make consistent color with other un-editable text.
TODO: This is a bit of a hack to get ui::Text objects to support custom colors, like the Label structures used elsewhere.
* Pin config: VREGMODE=1, add other pins for completeness, comment detail
* Pin setup: More useful comments.
* Pin setup: Change some defaults, only set up PortaPack pins if detected.
* Pin setup: Disable LPC pull-ups on PP CPLD data bus, as CPLD is pulling up.
* Baseband: Allow larger HackRF firmware image.
* HackRF: Remove USER_INTERFACE CMake variable.
* CPLD: Make use of HackRF CPLD tool to generate code.
* Release: Add generation of MD5SUMS, SHA256SUMS during "make release"
* Clock generator: Match clock output currents to HackRF firmware.
Someday, we will share a code base again...
* CMake: Make "firmware" target part of the "all" target.
So now an unqualified "make" will make the firmware binary.
* CMake: Change how HackRF firmware is incorporated into binary.
Use the separate HackRF "RAM" binary. Get rid of the strip-dfu utility, since there's no longer a need to extract the binary from the DFU.
* CMake: Renamed GIT_REVISION* -> GIT_VERSION* to match HackRF build env.
* CMake: Bring git version handling closer to HackRF for code reuse.
* Travis-CI: Rework CI release artifact output.
* Travis-CI: Don't assign PROJECT_NAME within deploy-nightly.sh
* Travis-CI: Oops, don't include distro package for compiler...
...when also installing it from a third-party PPA.
* Travis-CI: Update GCC package, old one seems "retired"?
* Travis-CI: OK, the gcc-arm-none-eabi package is NOT current. Undoing...
* Travis-CI: Path oopsies.
* Travis-CI: More path confusion. I think this will do it. *touch wood*
* Travis-CI: Update build message sent to FreeNode #portapack IRC.
* Travis-CI: Break out BUILD_DATE from BUILD_NAME.
* Travis-CI: Introduce build directories, include MD5 and SHA256 hashes.
* Travis-CI: Fix MD5SUMS/SHA256SUMS paths.
* Travis-CI: Fix typo generating name for binary links.
* Power: Keep 1V8 off until after VAA is brought up.
* Power: Bring up VAA in several steps to keep voltage swing small.
* About: Show longer commit/tag version string.
* Versioning: Report non-CI builds with "local-" version prefix.
* Travis-CI: Report new nightly build site in IRC notification.
* Change use of GIT_VERSION to VERSION_STRING
Required by prior merge.
* Git: add "hackrf" submodule.
* CMake: Use hackrf submodule for build, stop pulling during build.
* Travis: Fix build paths due to CMake submodule changes.
* Travis: Explicitly update submodules recursively
* Revert "Travis: Explicitly update submodules recursively"
This reverts commit b246438d805f431e727e01b7407540e932e89ee1.
* Travis: Try to sort out hackrf submodule output paths...
* Travis: I don't know what I'm doing.
* CMake: "make firmware" problem due to target vs. path used for dependency.
* HackRF: Incorporate YAML security fix.
* CMake: Fix more places where targets should be used...
...instead of paths to outputs.
* CMake: Add DFU file to "make firmware" outputs
* HackRF: Update submodule for CMake m0_bin.s path fix.
* added encoder support to alphanum
* added encoder support to freq-keypad
* UI Redesign -
added BtnGrid & NewButton widgets and created a new button-based
layout, with both encoder and touchscreen are supported.
* Scanner changes:
- using SCANNER.TXT for frequencies, ranges also supported. file
format is the same as any other frequency file, thus can be edited
via the Frequency Manager.
- add nfm bw selector & time-to-wait to the UI
- add SCANNER.TXT to sdcard dir
orignal idea & scanner file adopted from user 'bicurico'
* small changes to scanner
* remember last category on frequency manager
* fix: cast int16_t instead of uint16_t (although i doubt we will
have more than 32767 buttons in the array...)
* added a missing last_category_id on freq manager
2019-10-29 23:53:54 +02:00
|
|
|
};
|
|
|
|
|
2016-02-04 10:27:53 +01:00
|
|
|
class Image : public Widget {
|
2015-07-08 08:39:24 -07:00
|
|
|
public:
|
2016-02-04 10:27:53 +01:00
|
|
|
Image();
|
|
|
|
Image(
|
|
|
|
const Rect parent_rect,
|
|
|
|
const Bitmap* bitmap,
|
|
|
|
const Color foreground,
|
|
|
|
const Color background
|
|
|
|
);
|
|
|
|
|
2016-11-26 16:52:57 -08:00
|
|
|
Image(const Image&) = delete;
|
|
|
|
Image(Image&&) = delete;
|
|
|
|
Image& operator=(const Image&) = delete;
|
|
|
|
Image& operator=(Image&&) = delete;
|
|
|
|
|
2016-02-04 10:27:53 +01:00
|
|
|
void set_bitmap(const Bitmap* bitmap);
|
|
|
|
void set_foreground(const Color color);
|
|
|
|
void set_background(const Color color);
|
2016-07-28 05:25:33 +02:00
|
|
|
void invert_colors();
|
2015-07-08 08:39:24 -07:00
|
|
|
|
2016-02-04 10:27:53 +01:00
|
|
|
void paint(Painter& painter) override;
|
2015-07-08 08:39:24 -07:00
|
|
|
|
2016-02-04 10:27:53 +01:00
|
|
|
private:
|
|
|
|
const Bitmap* bitmap_;
|
|
|
|
Color foreground_;
|
|
|
|
Color background_;
|
|
|
|
};
|
2015-07-08 08:39:24 -07:00
|
|
|
|
2016-02-04 10:27:53 +01:00
|
|
|
class ImageButton : public Image {
|
|
|
|
public:
|
2016-11-26 16:50:44 -08:00
|
|
|
std::function<void(ImageButton&)> on_select { };
|
2015-07-08 08:39:24 -07:00
|
|
|
|
2016-02-04 10:27:53 +01:00
|
|
|
ImageButton(
|
|
|
|
const Rect parent_rect,
|
|
|
|
const Bitmap* bitmap,
|
|
|
|
const Color foreground,
|
|
|
|
const Color background
|
|
|
|
);
|
2015-07-08 08:39:24 -07:00
|
|
|
|
|
|
|
bool on_key(const KeyEvent key) override;
|
|
|
|
bool on_touch(const TouchEvent event) override;
|
|
|
|
};
|
|
|
|
|
2016-05-27 06:48:04 +02:00
|
|
|
class ImageOptionsField : public Widget {
|
|
|
|
public:
|
|
|
|
using value_t = int32_t;
|
2017-07-18 19:31:05 +01:00
|
|
|
using option_t = std::pair<const Bitmap*, value_t>;
|
2016-05-27 06:48:04 +02:00
|
|
|
using options_t = std::vector<option_t>;
|
|
|
|
|
2017-01-16 03:45:44 +00:00
|
|
|
std::function<void(size_t, value_t)> on_change { };
|
|
|
|
std::function<void(void)> on_show_options { };
|
2016-05-27 06:48:04 +02:00
|
|
|
|
2017-07-18 19:31:05 +01:00
|
|
|
ImageOptionsField(
|
|
|
|
const Rect parent_rect,
|
|
|
|
const Color foreground,
|
|
|
|
const Color background,
|
|
|
|
const options_t options
|
|
|
|
);
|
2016-05-27 06:48:04 +02:00
|
|
|
|
2016-12-09 18:21:47 +01:00
|
|
|
ImageOptionsField(
|
2017-07-18 19:31:05 +01:00
|
|
|
) : ImageOptionsField { { }, Color::white(), Color::black(), { } }
|
2016-12-09 18:21:47 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-05-27 06:48:04 +02:00
|
|
|
void set_options(options_t new_options);
|
|
|
|
|
|
|
|
size_t selected_index() const;
|
|
|
|
size_t selected_index_value() const;
|
|
|
|
void set_selected_index(const size_t new_index);
|
|
|
|
|
|
|
|
void set_by_value(value_t v);
|
|
|
|
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
|
|
|
|
void on_focus() override;
|
|
|
|
bool on_encoder(const EncoderEvent delta) override;
|
|
|
|
bool on_touch(const TouchEvent event) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
options_t options;
|
|
|
|
size_t selected_index_ { 0 };
|
2017-07-18 19:31:05 +01:00
|
|
|
Color foreground_;
|
|
|
|
Color background_;
|
2016-05-27 06:48:04 +02:00
|
|
|
};
|
|
|
|
|
2015-07-08 08:39:24 -07:00
|
|
|
class OptionsField : public Widget {
|
|
|
|
public:
|
|
|
|
using name_t = std::string;
|
|
|
|
using value_t = int32_t;
|
|
|
|
using option_t = std::pair<name_t, value_t>;
|
|
|
|
using options_t = std::vector<option_t>;
|
|
|
|
|
2016-11-26 16:50:44 -08:00
|
|
|
std::function<void(size_t, value_t)> on_change { };
|
|
|
|
std::function<void(void)> on_show_options { };
|
2015-07-08 08:39:24 -07:00
|
|
|
|
2016-11-29 10:13:56 -08:00
|
|
|
OptionsField(Point parent_pos, int length, options_t options);
|
2016-02-05 17:40:14 +01:00
|
|
|
|
|
|
|
void set_options(options_t new_options);
|
2015-07-08 08:39:24 -07:00
|
|
|
|
|
|
|
size_t selected_index() const;
|
2016-05-13 09:34:15 +02:00
|
|
|
size_t selected_index_value() const;
|
2021-03-07 16:05:23 -06:00
|
|
|
void set_selected_index(const size_t new_index, bool trigger_change = true);
|
2015-07-08 08:39:24 -07:00
|
|
|
|
|
|
|
void set_by_value(value_t v);
|
|
|
|
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
|
2016-02-04 10:27:53 +01:00
|
|
|
void on_focus() override;
|
2015-07-08 08:39:24 -07:00
|
|
|
bool on_encoder(const EncoderEvent delta) override;
|
|
|
|
bool on_touch(const TouchEvent event) override;
|
|
|
|
|
|
|
|
private:
|
2016-11-29 10:13:56 -08:00
|
|
|
const int length_;
|
2015-07-08 08:39:24 -07:00
|
|
|
options_t options;
|
|
|
|
size_t selected_index_ { 0 };
|
|
|
|
};
|
|
|
|
|
2023-05-10 09:51:09 -07:00
|
|
|
// A TextField is bound to a string reference and allows the string
|
|
|
|
// to be manipulated. The field itself does not provide the UI for
|
|
|
|
// setting the value. It provides the UI of rendering the text,
|
|
|
|
// a cursor, and an API to edit the string content.
|
|
|
|
class TextField : public Widget {
|
|
|
|
public:
|
|
|
|
TextField(std::string& str, Point position, uint32_t length = 30)
|
|
|
|
: TextField{str, 64, position, length} { }
|
|
|
|
|
|
|
|
// Str: the string containing the content to edit.
|
|
|
|
// Max_length: max length the string is allowed to use.
|
|
|
|
// Position: the top-left corner of the control.
|
|
|
|
// Length: the number of characters to display.
|
|
|
|
// - Characters are 8 pixels wide.
|
|
|
|
// - The screen can show 30 characters max.
|
|
|
|
// - The control is 16 pixels tall.
|
|
|
|
TextField(std::string& str, size_t max_length, Point position, uint32_t length = 30);
|
|
|
|
|
|
|
|
TextField(const TextField&) = delete;
|
|
|
|
TextField(TextField&&) = delete;
|
|
|
|
TextField& operator=(const TextField&) = delete;
|
|
|
|
TextField& operator=(TextField&&) = delete;
|
|
|
|
|
|
|
|
const std::string& value() const;
|
|
|
|
|
|
|
|
void set_cursor(uint32_t pos);
|
|
|
|
void set_insert_mode();
|
|
|
|
void set_overwrite_mode();
|
|
|
|
|
|
|
|
void char_add(char c);
|
|
|
|
void char_delete();
|
|
|
|
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
|
|
|
|
bool on_key(const KeyEvent key) override;
|
|
|
|
bool on_encoder(const EncoderEvent delta) override;
|
|
|
|
bool on_touch(const TouchEvent event) override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
std::string& text_;
|
|
|
|
size_t max_length_;
|
|
|
|
uint32_t char_count_;
|
|
|
|
uint32_t cursor_pos_;
|
|
|
|
bool insert_mode_;
|
|
|
|
};
|
|
|
|
|
2015-07-08 08:39:24 -07:00
|
|
|
class NumberField : public Widget {
|
|
|
|
public:
|
2017-01-16 03:45:44 +00:00
|
|
|
std::function<void(NumberField&)> on_select { };
|
2016-11-26 16:50:44 -08:00
|
|
|
std::function<void(int32_t)> on_change { };
|
2015-07-08 08:39:24 -07:00
|
|
|
|
|
|
|
using range_t = std::pair<int32_t, int32_t>;
|
|
|
|
|
2017-07-30 09:39:01 +01:00
|
|
|
NumberField(Point parent_pos, int length, range_t range, int32_t step, char fill_char, bool can_loop);
|
|
|
|
|
|
|
|
NumberField(Point parent_pos, int length, range_t range, int32_t step, char fill_char
|
|
|
|
) : NumberField { parent_pos, length, range, step, fill_char, false }
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-08-03 04:53:51 +02:00
|
|
|
NumberField(
|
2017-07-30 09:39:01 +01:00
|
|
|
) : NumberField { { 0, 0 }, 1, { 0, 1 }, 1, ' ', false }
|
2016-08-03 04:53:51 +02:00
|
|
|
{
|
|
|
|
}
|
2015-07-08 08:39:24 -07:00
|
|
|
|
|
|
|
NumberField(const NumberField&) = delete;
|
|
|
|
NumberField(NumberField&&) = delete;
|
|
|
|
|
|
|
|
int32_t value() const;
|
2016-08-06 08:49:45 +02:00
|
|
|
void set_value(int32_t new_value, bool trigger_change = true);
|
2016-08-03 04:53:51 +02:00
|
|
|
void set_range(const int32_t min, const int32_t max);
|
2017-10-15 15:53:40 +01:00
|
|
|
void set_step(const int32_t new_step);
|
2015-07-08 08:39:24 -07:00
|
|
|
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
|
2016-07-25 16:21:27 +02:00
|
|
|
bool on_key(const KeyEvent key) override;
|
2015-07-08 08:39:24 -07:00
|
|
|
bool on_encoder(const EncoderEvent delta) override;
|
|
|
|
bool on_touch(const TouchEvent event) override;
|
|
|
|
|
|
|
|
private:
|
2016-08-03 04:53:51 +02:00
|
|
|
range_t range;
|
2017-10-15 15:53:40 +01:00
|
|
|
int32_t step;
|
2016-11-29 10:13:56 -08:00
|
|
|
const int length_;
|
2015-07-08 08:39:24 -07:00
|
|
|
const char fill_char;
|
2016-11-26 16:50:44 -08:00
|
|
|
int32_t value_ { 0 };
|
2017-07-30 09:39:01 +01:00
|
|
|
bool can_loop { };
|
2015-07-08 08:39:24 -07:00
|
|
|
|
|
|
|
int32_t clip_value(int32_t value);
|
|
|
|
};
|
|
|
|
|
2016-08-06 08:49:45 +02:00
|
|
|
class SymField : public Widget {
|
|
|
|
public:
|
2017-01-16 03:45:44 +00:00
|
|
|
std::function<void(SymField&)> on_select { };
|
|
|
|
std::function<void()> on_change { };
|
2016-08-06 08:49:45 +02:00
|
|
|
|
2017-02-01 00:21:13 +00:00
|
|
|
enum symfield_type {
|
|
|
|
SYMFIELD_OCT,
|
|
|
|
SYMFIELD_DEC,
|
|
|
|
SYMFIELD_HEX,
|
2018-02-23 20:21:24 +00:00
|
|
|
SYMFIELD_ALPHANUM,
|
2017-02-01 00:21:13 +00:00
|
|
|
SYMFIELD_DEF // User DEFined
|
|
|
|
};
|
|
|
|
|
|
|
|
SymField(Point parent_pos, size_t length, symfield_type type);
|
2016-08-06 08:49:45 +02:00
|
|
|
|
|
|
|
SymField(const SymField&) = delete;
|
|
|
|
SymField(SymField&&) = delete;
|
|
|
|
|
2017-03-13 04:09:21 +00:00
|
|
|
uint32_t get_sym(const uint32_t index);
|
|
|
|
void set_sym(const uint32_t index, const uint32_t new_value);
|
2016-08-06 08:49:45 +02:00
|
|
|
void set_length(const uint32_t new_length);
|
2016-09-27 03:06:14 +02:00
|
|
|
void set_symbol_list(const uint32_t index, const std::string symbol_list);
|
2023-03-03 23:10:58 +01:00
|
|
|
uint16_t concatenate_4_octal_u16();
|
2017-02-07 17:48:17 +00:00
|
|
|
uint32_t value_dec_u32();
|
2016-12-05 12:56:41 +01:00
|
|
|
uint64_t value_hex_u64();
|
2018-02-23 20:21:24 +00:00
|
|
|
std::string value_string();
|
2016-08-06 08:49:45 +02:00
|
|
|
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
|
|
|
|
bool on_key(const KeyEvent key) override;
|
|
|
|
bool on_encoder(const EncoderEvent delta) override;
|
|
|
|
bool on_touch(const TouchEvent event) override;
|
|
|
|
|
|
|
|
private:
|
2016-09-27 03:06:14 +02:00
|
|
|
std::string symbol_list_[32] = { "01" }; // Failsafe init
|
|
|
|
uint32_t values_[32] = { 0 };
|
2016-08-06 08:49:45 +02:00
|
|
|
uint32_t selected_ = 0;
|
2017-01-16 03:45:44 +00:00
|
|
|
size_t length_, prev_length_ = 0;
|
2016-08-06 08:49:45 +02:00
|
|
|
bool erase_prev_ = false;
|
2017-02-01 00:21:13 +00:00
|
|
|
symfield_type type_ { };
|
2016-08-06 08:49:45 +02:00
|
|
|
|
2016-09-27 03:06:14 +02:00
|
|
|
int32_t clip_value(const uint32_t index, const uint32_t value);
|
2016-08-06 08:49:45 +02:00
|
|
|
};
|
|
|
|
|
2017-01-09 02:45:29 +00:00
|
|
|
class Waveform : public Widget {
|
|
|
|
public:
|
|
|
|
|
2017-11-02 17:11:26 +00:00
|
|
|
Waveform(Rect parent_rect, int16_t * data, uint32_t length, uint32_t offset, bool digital, Color color);
|
2017-01-09 02:45:29 +00:00
|
|
|
|
|
|
|
Waveform(const Waveform&) = delete;
|
|
|
|
Waveform(Waveform&&) = delete;
|
2017-01-16 03:45:44 +00:00
|
|
|
Waveform& operator=(const Waveform&) = delete;
|
|
|
|
Waveform& operator=(Waveform&&) = delete;
|
2017-01-09 02:45:29 +00:00
|
|
|
|
|
|
|
void set_offset(const uint32_t new_offset);
|
|
|
|
void set_length(const uint32_t new_length);
|
2017-11-02 17:11:26 +00:00
|
|
|
void set_cursor(const uint32_t i, const int16_t position);
|
2017-01-09 02:45:29 +00:00
|
|
|
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
|
|
|
|
private:
|
2017-11-02 17:11:26 +00:00
|
|
|
const Color cursor_colors[2] = { Color::cyan(), Color::magenta() };
|
|
|
|
|
|
|
|
int16_t * data_;
|
2017-01-09 02:45:29 +00:00
|
|
|
uint32_t length_;
|
|
|
|
uint32_t offset_;
|
2017-01-17 07:00:42 +00:00
|
|
|
bool digital_ { false };
|
2017-01-09 02:45:29 +00:00
|
|
|
Color color_;
|
2017-11-02 17:11:26 +00:00
|
|
|
int16_t cursors[2] { };
|
|
|
|
bool show_cursors { false };
|
2017-01-09 02:45:29 +00:00
|
|
|
};
|
|
|
|
|
2017-03-13 04:09:21 +00:00
|
|
|
class VuMeter : public Widget {
|
|
|
|
public:
|
|
|
|
|
2017-05-18 11:06:11 +01:00
|
|
|
VuMeter(Rect parent_rect, uint32_t LEDs, bool show_max);
|
2017-03-13 04:09:21 +00:00
|
|
|
|
2017-05-18 11:06:11 +01:00
|
|
|
void set_value(const uint32_t new_value);
|
|
|
|
void set_mark(const uint32_t new_mark);
|
2017-03-13 04:09:21 +00:00
|
|
|
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint32_t LEDs_, LED_height { 0 };
|
2017-05-18 11:06:11 +01:00
|
|
|
uint32_t value_ { 0 }, prev_value { 255 }; // Forces painting on first display
|
2017-03-13 04:09:21 +00:00
|
|
|
uint32_t split { 0 };
|
|
|
|
uint16_t max { 0 }, prev_max { 0 }, hold_timer { 0 }, mark { 0 }, prev_mark { 0 };
|
2017-05-18 11:06:11 +01:00
|
|
|
bool show_max_;
|
2017-03-13 04:09:21 +00:00
|
|
|
};
|
|
|
|
|
2017-08-16 10:02:57 +01:00
|
|
|
class OptionTabView : public View {
|
|
|
|
public:
|
|
|
|
OptionTabView(Rect parent_rect);
|
|
|
|
|
|
|
|
void focus() override;
|
|
|
|
|
|
|
|
bool is_enabled();
|
|
|
|
void set_type(std::string type);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool enabled { false };
|
|
|
|
|
|
|
|
void set_enabled(bool value);
|
|
|
|
|
|
|
|
private:
|
|
|
|
Checkbox check_enable {
|
|
|
|
{ 2 * 8, 0 * 16 },
|
|
|
|
20,
|
|
|
|
"",
|
|
|
|
false
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2015-07-08 08:39:24 -07:00
|
|
|
} /* namespace ui */
|
|
|
|
|
|
|
|
#endif/*__UI_WIDGET_H__*/
|