45 lines
1.2 KiB
C++
45 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <array>
|
|
#include <cstdint>
|
|
|
|
#include <vamp_pico/artwork.hpp>
|
|
#include <vamp_pico/http_client.hpp>
|
|
#include <vamp_style.hpp>
|
|
|
|
|
|
namespace vamp_pico {
|
|
|
|
constexpr auto display_width = std::int32_t{320};
|
|
constexpr auto display_height = std::int32_t{240};
|
|
|
|
enum class link_status { CONNECTING,
|
|
OFFLINE,
|
|
CONNECTED,
|
|
ERROR };
|
|
|
|
class display {
|
|
public:
|
|
auto init() -> 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:
|
|
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_{};
|
|
};
|
|
|
|
}
|