ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
board_overlay_draw.c File Reference

Overlay draw primitives + embedded 5x7 font. More...

#include <string.h>
#include "board_overlay_internal.h"
Include dependency graph for board_overlay_draw.c:

Go to the source code of this file.

Functions

uint16_t board_overlay_sidebar_width (void)
 Width in pixels the status sidebar adds to the right of the panel.
uint16_t board_overlay_total_width (uint16_t panel_w)
 Total composite width for a panel of width panel_w.
uint16_t board_overlay_total_height (uint16_t panel_h)
 Total composite height for a panel of height panel_h.
void priv_px (board_overlay_surface_t *surface, int32_t x, int32_t y, uint16_t color)
 Plot one pixel if it lies inside the supplied surface.
void priv_fill_rect (board_overlay_surface_t *surface, int32_t x, int32_t y, int32_t rw, int32_t rh, uint16_t color)
 Fill the axis-aligned rectangle [x,x+rw) x [y,y+rh) with color.
static RA8_INTERNAL void internal_draw_glyph (board_overlay_surface_t *surface, int32_t x, int32_t y, char ch, uint16_t color, int32_t sc)
 Draw one ASCII glyph at scale sc; non-printable maps to space.
int32_t priv_draw_text (board_overlay_surface_t *surface, int32_t x, int32_t y, const char *s, uint16_t color, int32_t sc)
 Draw a NUL-terminated string; returns the x just past the last cell.
int32_t priv_section_head (board_overlay_surface_t *surface, int32_t x, int32_t y, const char *title)
 Draw a section heading (accent colour) with a thin rule beneath it.
int32_t priv_kv_row (board_overlay_surface_t *surface, int32_t x, int32_t y, const char *label, const char *value, uint16_t val_color)
 Draw a "label value" row: dim label, bright value, returns next y.
void priv_blit_panel (uint16_t *out, uint16_t w, uint16_t h, const uint16_t *panel, uint16_t panel_w, uint16_t panel_h)
 Blit the panel framebuffer into the composite's top-left region.

Variables

static const uint8_t s_k_font5x7 [(k_ovl_glyph_last - k_ovl_glyph_first)+1U][k_ovl_glyph_w]

Detailed Description

Overlay draw primitives + embedded 5x7 font.

The pixel/rect/text/blit primitives and the public-domain 5x7 column-major ASCII font every overlay panel draws with – moved verbatim out of board_overlay.c.

Since
0.1.0

Definition in file board_overlay_draw.c.

Function Documentation

◆ board_overlay_sidebar_width()

uint16_t board_overlay_sidebar_width ( void )

Width in pixels the status sidebar adds to the right of the panel.

Returns
Fixed sidebar width (the composite width is panel width + this).
Since
0.1.0

Width in pixels the status sidebar adds to the right of the panel; this step is contained within the board overlay model and uses bounded caller or module-owned storage.

Return values
valueThe operation-specific board overlay sidebar width value.
Precondition
Arguments satisfy the ranges documented for board overlay sidebar width.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board overlay model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.

Definition at line 119 of file board_overlay_draw.c.

References k_ovl_sidebar_w.

◆ board_overlay_total_height()

uint16_t board_overlay_total_height ( uint16_t panel_h)

Total composite height for a panel of height panel_h.

At least a minimum so the sidebar's text always fits even when the panel is short (a non-display example may have a tiny / blank panel region).

Parameters
[in]panel_hPanel framebuffer height in pixels.
Returns
The larger of panel_h and the sidebar's minimum height.
Since
0.1.0
Return values
valueThe operation-specific board overlay total height value.
Precondition
Arguments satisfy the ranges documented for board overlay total height.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board overlay model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.

Definition at line 129 of file board_overlay_draw.c.

References k_ovl_min_h.

Referenced by board_overlay_compose(), and board_overlay_draw_sidebar().

◆ board_overlay_total_width()

uint16_t board_overlay_total_width ( uint16_t panel_w)

Total composite width for a panel of width panel_w.

Parameters
[in]panel_wPanel framebuffer width in pixels.
Returns
panel_w plus the sidebar width.
Since
0.1.0

Total composite width for a panel of width panel_w; this step is contained within the board overlay model and uses bounded caller or module-owned storage.

Return values
valueThe operation-specific board overlay total width value.
Precondition
Arguments satisfy the ranges documented for board overlay total width.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board overlay model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.

Definition at line 124 of file board_overlay_draw.c.

References k_ovl_sidebar_w.

Referenced by board_overlay_compose(), and board_overlay_draw_sidebar().

◆ internal_draw_glyph()

RA8_INTERNAL void internal_draw_glyph ( board_overlay_surface_t * surface,
int32_t x,
int32_t y,
char ch,
uint16_t color,
int32_t sc )
static

Draw one ASCII glyph at scale sc; non-printable maps to space.

Draw one ascii glyph at scale sc; non-printable maps to space; this step is contained within the board overlay draw model and uses bounded caller or module-owned storage.

Parameters
[in,out]surfaceDescriptor-backed presentation surface to access.
[in]xHorizontal coordinate in pixels.
[in]yVertical coordinate in pixels.
[in]chSelected channel identifier.
[in]colorRGB color value used by the drawing operation.
[in]scSc input used by the operation.
Precondition
Arguments satisfy the ranges documented for draw glyph.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board overlay draw model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

Definition at line 185 of file board_overlay_draw.c.

References k_ovl_glyph_first, k_ovl_glyph_h, k_ovl_glyph_last, k_ovl_glyph_w, priv_fill_rect(), RA8_INTERNAL, and s_k_font5x7.

Referenced by priv_draw_text().

◆ priv_blit_panel()

void priv_blit_panel ( uint16_t * out,
uint16_t w,
uint16_t h,
const uint16_t * panel,
uint16_t panel_w,
uint16_t panel_h )

Blit the panel framebuffer into the composite's top-left region.

Blit the rendered panel into the composite's panel region.

Definition at line 252 of file board_overlay_draw.c.

References k_ovl_panel_bg.

Referenced by board_overlay_compose().

◆ priv_draw_text()

int32_t priv_draw_text ( board_overlay_surface_t * surface,
int32_t x,
int32_t y,
const char * s,
uint16_t color,
int32_t sc )

Draw a NUL-terminated string; returns the x just past the last cell.

Draw a NUL-terminated string; returns the x after the last glyph.

Definition at line 207 of file board_overlay_draw.c.

References internal_draw_glyph(), and k_ovl_glyph_w.

Referenced by board_overlay_draw_sidebar(), internal_draw_button(), internal_draw_console_body(), internal_draw_console_heading(), internal_draw_console_tabs(), internal_draw_core(), internal_draw_led(), internal_draw_power(), priv_kv_row(), and priv_section_head().

◆ priv_fill_rect()

void priv_fill_rect ( board_overlay_surface_t * surface,
int32_t x,
int32_t y,
int32_t rw,
int32_t rh,
uint16_t color )

◆ priv_kv_row()

int32_t priv_kv_row ( board_overlay_surface_t * surface,
int32_t x,
int32_t y,
const char * label,
const char * value,
uint16_t val_color )

Draw a "label value" row: dim label, bright value, returns next y.

Draw a "label value" row: dim label, coloured value; returns next y.

Definition at line 237 of file board_overlay_draw.c.

References k_kv_label_cols, k_ovl_dim, k_ovl_glyph_w, k_row_step, and priv_draw_text().

Referenced by internal_draw_io_block(), and internal_draw_run_stats().

◆ priv_px()

void priv_px ( board_overlay_surface_t * surface,
int32_t x,
int32_t y,
uint16_t color )

Plot one pixel if it lies inside the supplied surface.

Plot one clipped pixel into the composite (draw primitive).

Definition at line 135 of file board_overlay_draw.c.

References priv_fill_rect().

◆ priv_section_head()

int32_t priv_section_head ( board_overlay_surface_t * surface,
int32_t x,
int32_t y,
const char * title )

Draw a section heading (accent colour) with a thin rule beneath it.

Draw a section heading (accent colour) with a thin rule beneath it; this step is contained within the board overlay model and uses bounded caller or module-owned storage.

Parameters
[in,out]surfaceDescriptor-backed presentation surface to access.
[in]xHorizontal coordinate in pixels.
[in]yVertical coordinate in pixels.
[in]titleTitle input used by the operation.
Returns
The section head result produced by the board overlay model.
Return values
valueThe operation-specific section head value.
Precondition
Arguments satisfy the ranges documented for section head.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the board overlay model and documented output objects.
Ownership of caller-supplied storage is unchanged.
Note
The operation is synchronous and does not transfer heap ownership.
Since
0.1.0

Definition at line 224 of file board_overlay_draw.c.

References k_heading_gap, k_ovl_accent, k_ovl_rule, k_ovl_sidebar_w, k_pad_x, k_rule_dy, priv_draw_text(), and priv_fill_rect().

Referenced by internal_draw_buttons(), internal_draw_io_block(), internal_draw_leds(), internal_draw_power(), and internal_draw_run_stats().

Variable Documentation

◆ s_k_font5x7

const uint8_t s_k_font5x7[(k_ovl_glyph_last - k_ovl_glyph_first)+1U][k_ovl_glyph_w]
static

Definition at line 21 of file board_overlay_draw.c.

Referenced by internal_draw_glyph().