27 #include <satcat5/pkt_buffer.h>
65 : m_opcode(0), m_arg1(0), m_arg2{.ptr = 0} {}
68 : m_opcode(opcode), m_arg1(arg1), m_arg2(arg2) {}
73 bool rc(u16 r, u16 c)
const;
88 {
return (
const Icon16x16*)m_arg2.
ptr; }
90 {
return (
const Icon32x32*)m_arg2.
ptr; }
93 void update(Cursor& cursor)
const;
119 virtual bool scroll(s16 rows) {
return true; }
124 inline u16
width()
const {
return m_width; }
155 bool cursor(u16 r, u16 c);
158 bool clear(u32 color);
174 bool draw_rect(u16 h, u16 w,
bool fg =
true);
211 {
return m_cursor_draw; }
213 {
return m_display; }
214 inline u16 height()
const
215 {
return m_display->
height(); }
216 inline u16 width()
const
217 {
return m_display->
width(); }
222 bool draw_eol(u16 height, u16& total_rows);
238 u32 bg_text, fg_text;
239 u32 bg_error, fg_error;
240 u32 bg_warn, fg_warn;
241 u32 bg_info, fg_info;
242 u32 bg_debug, fg_debug;
259 u16 row_min = 0, u16 row_count = 0);
262 void log_event(s8 priority,
unsigned nbytes,
const char* msg)
override;
266 { m_colors = colors; }
271 const u16 m_row_min, m_row_count;
User-facing interface for drawing graphical elements on a screen.
u16 raw_text(const char *msg, const satcat5::gui::Font8x8 &font=BASIC_FONT, u8 mag=1)
Draw a partial line of text with the designated font.
bool clear(u32 color)
Clear the entire display contents.
bool cursor(u16 r, u16 c)
Set cursor position for subsequent commands.
bool draw_rect(u16 h, u16 w, bool fg=true)
Draw a solid rectangle using the specified color.
bool draw_icon(const satcat5::gui::Icon8x8 *icon, u8 mag=1)
Draw icon with the designated location and color.
bool color_bg(u32 color)
Set background color for subsequent commands.
bool scroll(s16 rows)
On supported displays, scroll the designated scrollable window.
void poll_demand() override
Deferred event handler, called after request().
u16 draw_text(const char *msg, const satcat5::gui::Font8x8 &font=BASIC_FONT, u8 mag=1)
Draw a full line of text with the designated font.
bool color_fg(u32 color)
Set foreground color for subsequent commands.
Canvas(satcat5::gui::Display *display)
Link this object to a Display in immediate mode.
Required API for display devices.
virtual bool draw(const satcat5::gui::Cursor &cursor, const satcat5::gui::DrawCmd &cmd)=0
Draw pixels to the screen at the designated location.
u16 width() const
Total size of the display, in pixels.
const u16 m_height
Total size of the display, in pixels.
virtual bool scroll(s16 rows)
Optional: Advance the predefined viewport by N pixels.
u16 height() const
Total size of the display, in pixels.
Display(u16 h, u16 w)
Constructor sets the size of this display in pixels.
Each "draw command" updates a rectangular region of pixels.
u16 width() const
Size of the rectangular update region.
u16 height() const
Size of the rectangular update region.
void update(Cursor &cursor) const
Update cursor-state automatically for easier chaining.
constexpr DrawCmd(u8 opcode, u8 arg1, const DrawArg &arg2)
Construct a specific command.
bool rc(u16 r, u16 c) const
Get the new pixel value at the designated row and column.
constexpr DrawCmd()
Construct an empty command.
The Font class maps characters to fixed-size icons.
Service for forwarding Log events to a display adapter.
void log_event(s8 priority, unsigned nbytes, const char *msg) override
Implement the required API from log::EventHandler.
void set_colors(const satcat5::gui::LogColors &colors)
Adjust color parameters.
LogToDisplay(satcat5::gui::Canvas *canvas, const satcat5::gui::LogColors &colors, u16 row_min=0, u16 row_count=0)
Link this log service to the designated display/canvas.
The PacketBuffer class is a wrapper for a circular buffer, with optional logic to support retention o...
Defines the interface for accepting Log messages.
An "OnDemand" object is polled only on request.
"Icon" API for small monochrome images
const Font8x8 BASIC_FONT
A basic fixed-width 8x8 font.
Diagnostic logging to UART and/or Ethernet ports.
Core event-processing loop for SatCat5 software.
Cursor object tracks position and foreground/background colors.
u32 fg
Foreground color (format defined by display)
u16 r
Row coordinate (0 = top)
u32 bg
Background color (format defined by display)
u16 c
Column coordinate (0 = left)
Plain-old-data struct for a 16x16 monochrome image.
Plain-old-data struct for a 32x32 monochrome image.
Plain-old-data struct for an 8x8 monochrome image.
Color parameters for the LogToDisplay class.
Argument for a draw command (see below).
const void * ptr
Pointer to an icon or other object.
u32 color
Display-specific color argument.
s16 scroll
Scrolling parameter (signed)
u16 rc[2]
A row and column (coordinate or size)
u32 count
Any other counter.