@@ -3,7 +3,8 @@
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
|
||||
#include <modulus/types.hpp>
|
||||
#include <vamp_pico/artwork.hpp>
|
||||
#include <vamp_pico/http_client.hpp>
|
||||
#include <vamp_style.hpp>
|
||||
|
||||
|
||||
@@ -12,27 +13,32 @@ namespace vamp_pico {
|
||||
constexpr auto display_width = std::int32_t{320};
|
||||
constexpr auto display_height = std::int32_t{240};
|
||||
|
||||
constexpr auto color_black = std::uint16_t{0x0000};
|
||||
constexpr auto color_white = std::uint16_t{0xffff};
|
||||
constexpr auto color_gray = std::uint16_t{0x8410};
|
||||
enum class link_status { CONNECTING,
|
||||
OFFLINE,
|
||||
CONNECTED,
|
||||
ERROR };
|
||||
|
||||
class display {
|
||||
public:
|
||||
auto init() -> void;
|
||||
auto fill(std::uint16_t color) -> void;
|
||||
auto fill_rect(std::int32_t x, std::int32_t y, std::int32_t width, std::int32_t height, std::uint16_t color) -> void;
|
||||
auto draw_text(std::int32_t x, std::int32_t y, std::char_t const *text, std::uint16_t color, std::int32_t scale = 2) -> void;
|
||||
auto show_boot(std::char_t const *line1, std::char_t const *line2, std::uint16_t accent) -> void;
|
||||
auto show_remote(vamp_style::color status, std::char_t const *title, std::char_t const *part, std::uint32_t page, std::uint32_t pages, std::bool_t active, std::bool_t busy = false) -> void;
|
||||
auto show_remote(link_status link, remote_display_state const &state, std::bool_t busy = false) -> void;
|
||||
auto accept_title(std::string_view identifier, std::string_view image) -> std::bool_t;
|
||||
auto reject_title(std::string_view identifier) -> void;
|
||||
auto title_ready() const -> std::bool_t;
|
||||
// At most four scanlines per call, with an 8 ms minimum write interval.
|
||||
auto poll(std::uint64_t now_ms) -> void;
|
||||
private:
|
||||
std::bool_t remote_valid_{};
|
||||
vamp_style::color last_status_{};
|
||||
std::bool_t last_active_{};
|
||||
std::bool_t last_busy_{};
|
||||
std::array<std::char_t, 96> last_title_{};
|
||||
std::array<std::char_t, 48> last_part_{};
|
||||
std::uint32_t last_page_{};
|
||||
std::uint32_t last_pages_{};
|
||||
auto dirty(std::size_t begin, std::size_t end) -> void;
|
||||
title_cache title_{};
|
||||
std::array<std::bool_t, display_height> dirty_{};
|
||||
link_status link_{link_status::CONNECTING};
|
||||
std::bool_t active_{};
|
||||
std::bool_t busy_{};
|
||||
sprite part_{sprite::COUNT};
|
||||
std::uint32_t page_{};
|
||||
std::uint32_t pages_{};
|
||||
std::uint64_t last_write_ms_{};
|
||||
std::size_t next_row_{};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user