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

Module-private layout constants + draw primitives for the overlay. More...

#include <stdint.h>
#include "board_overlay.h"
#include "ra8_attributes.h"
Include dependency graph for board_overlay_internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  overlay_layout_t : int32_t {
  k_led_label_dy = 6 ,
  k_led_row_dy = 22 ,
  k_led_col_dx = 150 ,
  k_led_row_h = 40 ,
  k_pad_x = 18 ,
  k_sidebar_top = 16 ,
  k_title_gap = 26 ,
  k_appname_gap = 30 ,
  k_section_gap = 16 ,
  k_heading_gap = 20 ,
  k_row_step = 16 ,
  k_rule_dy = 10 ,
  k_kv_label_cols = 7 ,
  k_title_bar_h = 40
}
enum  board_overlay_cfg_t : uint32_t {
  k_ovl_sidebar_w = k_board_overlay_sidebar_width_px ,
  k_ovl_min_h = k_board_overlay_min_height_px ,
  k_ovl_bg = 0x10A2U ,
  k_ovl_bg_alt = 0x18E3U ,
  k_ovl_panel_bg = 0x0000U ,
  k_ovl_divider = 0x4208U ,
  k_ovl_rule = 0x39C7U ,
  k_ovl_text = 0xCE59U ,
  k_ovl_dim = 0x8410U ,
  k_ovl_heading = 0xFFFFU ,
  k_ovl_accent = 0x5D1FU ,
  k_ovl_ok = 0x3666U ,
  k_ovl_amber = 0xFD20U ,
  k_ovl_console_bg = 0x0841U ,
  k_ovl_console_txt = 0x07E6U ,
  k_ovl_console_new = 0xFFFFU ,
  k_ovl_tab_on_bg = 0x2965U ,
  k_ovl_tab_off_bg = 0x18E3U ,
  k_ovl_tab_on_txt = 0xFFFFU ,
  k_ovl_tab_off_txt = 0x8410U ,
  k_ovl_tab_empty_txt = 0x4208U ,
  k_ovl_led_off = 0x2104U ,
  k_ovl_led_ring = 0x6B4DU ,
  k_ovl_btn_border = 0x8430U ,
  k_ovl_btn_up = 0x3186U ,
  k_ovl_btn_down = 0x05E0U ,
  k_ovl_btn_label = 0xFFFFU ,
  k_ovl_red = 0xF800U ,
  k_ovl_glyph_w = 5U ,
  k_ovl_glyph_h = 7U ,
  k_ovl_glyph_first = 0x20U ,
  k_ovl_glyph_last = 0x7EU
}
 Sidebar geometry and palette (RGB565). More...
enum  overlay_btn_layout_t : int32_t {
  k_btn_x_dx = 18 ,
  k_btn_head_y = 404 ,
  k_btn_y = 424 ,
  k_btn_w = 150 ,
  k_btn_h = 36 ,
  k_btn_gap = 20 ,
  k_btn_label_x = 14 ,
  k_btn_label_y = 12
}
 Fixed layout of the on-screen SW1 / SW2 buttons (sidebar-relative priv_px). More...
enum  overlay_io_layout_t : int32_t { k_io_head_y = 250 }
 Fixed Y anchor for the I/O section (below the LED row). More...
enum  overlay_pwr_layout_t : int32_t {
  k_pwr_x_dx = 18 ,
  k_pwr_head_y = 344 ,
  k_pwr_y = 364 ,
  k_pwr_h = 26 ,
  k_pwr_track_w = 320 ,
  k_pwr_chg_off = 338 ,
  k_pwr_chg_w = 126 ,
  k_pwr_label_y = 9 ,
  k_pwr_soc_low = 20 ,
  k_pwr_soc_mid = 50 ,
  k_pwr_soc_full = 100 ,
  k_core_lp_off = 338 ,
  k_core_lp_w = 126
}
 Fixed layout of the POWER section: battery slider + CHG toggle. More...
enum  overlay_con_layout_t : int32_t {
  k_con_head_y = 480 ,
  k_con_y = 496 ,
  k_con_pad = 8 ,
  k_con_line_h = 10 ,
  k_con_bottom = 14 ,
  k_con_tab_h = 13 ,
  k_con_tab_txt = 3 ,
  k_con_tab_gap = 1 ,
  k_con_tab_min_w = 58 ,
  k_con_tab_cap_y = 3
}
 Console-panel layout (the bottom scrolling log with a tab bar). More...
enum  overlay_sd_unit_t : uint64_t { k_sd_unit_div = 1024ULL }
 Binary size-unit factor for the SD-card capacity readout. More...

Functions

void priv_px (board_overlay_surface_t *surface, int32_t x, int32_t y, uint16_t color)
 Plot one clipped pixel into the composite (draw primitive).
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 a clipped rectangle in the composite (draw primitive).
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 after the last glyph.
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, coloured 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 rendered panel into the composite's panel region.

Detailed Description

Module-private layout constants + draw primitives for the overlay.

The board-view overlay is one logical module split across two translation units: the panel composer / hit-testing core (board_overlay.c) and the pixel-level draw primitives + embedded 5x7 font (board_overlay_draw.c). The shared layout/colour/font constants and the primitive declarations live here; nothing in this header is part of the emulator-facing API in inc/board_overlay.h.

Since
0.1.0

Definition in file board_overlay_internal.h.

Enumeration Type Documentation

◆ board_overlay_cfg_t

enum board_overlay_cfg_t : uint32_t

Sidebar geometry and palette (RGB565).

Enumerator
k_ovl_sidebar_w 

Sidebar width.

k_ovl_min_h 

Minimum height.

k_ovl_bg 

Dark slate sidebar background.

k_ovl_bg_alt 

Lighter section band.

k_ovl_panel_bg 

Fill behind a missing/short panel.

k_ovl_divider 

Panel/sidebar divider.

k_ovl_rule 

Thin horizontal section rule.

k_ovl_text 

Light-grey body text.

k_ovl_dim 

Dim label text (field names).

k_ovl_heading 

White heading text.

k_ovl_accent 

Cyan title accent.

k_ovl_ok 

Green "running / ok" indicator.

k_ovl_amber 

Amber attention indicator.

k_ovl_console_bg 

Near-black console background.

k_ovl_console_txt 

Console text (terminal green).

k_ovl_console_new 

Newest line (white).

k_ovl_tab_on_bg 

Active tab background.

k_ovl_tab_off_bg 

Inactive tab background.

k_ovl_tab_on_txt 

Active tab caption.

k_ovl_tab_off_txt 

Inactive tab with traffic.

k_ovl_tab_empty_txt 

Inactive empty tab.

k_ovl_led_off 

Unlit LED dot.

k_ovl_led_ring 

LED dot outline.

k_ovl_btn_border 

On-screen button outline.

k_ovl_btn_up 

Button face, released.

k_ovl_btn_down 

Button face, pressed (green).

k_ovl_btn_label 

Button caption text.

k_ovl_red 

Low-SOC red gauge.

k_ovl_glyph_w 

Font glyph width in pixels.

k_ovl_glyph_h 

Font glyph height in pixels.

k_ovl_glyph_first 

First font glyph (space).

k_ovl_glyph_last 

Last font glyph (tilde).

Definition at line 47 of file board_overlay_internal.h.

◆ overlay_btn_layout_t

enum overlay_btn_layout_t : int32_t

Fixed layout of the on-screen SW1 / SW2 buttons (sidebar-relative priv_px).

Both ::draw_buttons and board_overlay_hit_button derive the button rectangles from these constants, so the drawn face and the click hit-box stay in lock-step. The block sits below the status-text block (which ends near y 166 for any panel) and above the minimum composite height, so it is on-screen for every panel size.

Enumerator
k_btn_x_dx 

Button column inset from the sidebar origin.

k_btn_head_y 

"BUTTONS" heading row.

k_btn_y 

Button face top.

k_btn_w 

Button face width.

k_btn_h 

Button face height.

k_btn_gap 

Horizontal gap between SW1 and SW2.

k_btn_label_x 

Caption inset within the button face.

k_btn_label_y 

Caption top inset within the button face.

Definition at line 91 of file board_overlay_internal.h.

◆ overlay_con_layout_t

enum overlay_con_layout_t : int32_t

Console-panel layout (the bottom scrolling log with a tab bar).

Enumerator
k_con_head_y 

"CONSOLE" heading row.

k_con_y 

Console panel top.

k_con_pad 

Inner padding inside the console panel.

k_con_line_h 

Vertical step between console text lines.

k_con_bottom 

Bottom margin below the console panel.

k_con_tab_h 

Tab-bar row height (one row of the grid).

k_con_tab_txt 

Caption inset within a tab cell.

k_con_tab_gap 

Gap between adjacent tab cells.

k_con_tab_min_w 

Minimum tab-cell pitch; sets tabs-per-row.

k_con_tab_cap_y 

Caption y-offset within a tab row.

Definition at line 133 of file board_overlay_internal.h.

◆ overlay_io_layout_t

enum overlay_io_layout_t : int32_t

Fixed Y anchor for the I/O section (below the LED row).

Enumerator
k_io_head_y 

"I/O" section heading row (clear of the LEDs).

Definition at line 103 of file board_overlay_internal.h.

◆ overlay_layout_t

enum overlay_layout_t : int32_t
Enumerator
k_led_label_dy 

LED label vertical offset within its dot.

k_led_row_dy 

"LEDS" heading to the LED row.

k_led_col_dx 

Horizontal spacing between LEDs.

k_led_row_h 

LED row height (advance to next block).

k_pad_x 

Left padding inside the sidebar.

k_sidebar_top 

Sidebar top margin.

k_title_gap 

Title line to the app-name line.

k_appname_gap 

App-name line to the run-stats block.

k_section_gap 

Gap above a section heading.

k_heading_gap 

Section heading to its first row.

k_row_step 

Vertical step between text rows.

k_rule_dy 

Heading baseline to its underline rule.

k_kv_label_cols 

Label column width (glyphs) so values align.

k_title_bar_h 

Title-bar band height (board name at 2x).

Definition at line 29 of file board_overlay_internal.h.

◆ overlay_pwr_layout_t

enum overlay_pwr_layout_t : int32_t

Fixed layout of the POWER section: battery slider + CHG toggle.

::draw_power, board_overlay_hit_button and board_overlay_battery_pct_at all derive their rectangles from these, so the drawn slider, its click hit-box, and the drag-to-percent map stay in lock-step. The block sits below the I/O text block (which ends near y 334) and above the BUTTONS block, so it is on-screen for every panel size.

Enumerator
k_pwr_x_dx 

POWER column inset from the sidebar origin.

k_pwr_head_y 

"POWER" heading row.

k_pwr_y 

Battery slider track top.

k_pwr_h 

Slider track height.

k_pwr_track_w 

Slider track width (the full drag range).

k_pwr_chg_off 

CHG toggle x offset from the track origin.

k_pwr_chg_w 

CHG toggle face width.

k_pwr_label_y 

Caption top inset within a POWER face.

k_pwr_soc_low 

SOC at or below this draws the gauge red.

k_pwr_soc_mid 

SOC at or below this draws the gauge amber.

k_pwr_soc_full 

SOC clamp / percent denominator.

k_core_lp_off 

Low-power toggle x offset (right of SW1/SW2).

k_core_lp_w 

Low-power toggle face width.

Definition at line 116 of file board_overlay_internal.h.

◆ overlay_sd_unit_t

enum overlay_sd_unit_t : uint64_t

Binary size-unit factor for the SD-card capacity readout.

Enumerator
k_sd_unit_div 

Bytes per KiB step (KiB->MiB->GiB ladder).

Definition at line 147 of file board_overlay_internal.h.

Function Documentation

◆ 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 rendered panel into the composite's panel region.

Blit the rendered panel into the composite's panel region; this step is contained within the board overlay model and uses bounded caller or module-owned storage.

Parameters
[out]outDestination storage receiving the computed result.
[in]wW input used by the operation.
[in]hH input used by the operation.
[in]panelPanel input used by the operation.
[in]panel_wPanel w input used by the operation.
[in]panel_hPanel h input used by the operation.
Precondition
Arguments satisfy the ranges documented for blit panel.
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

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 after the last glyph.

Draw a nul-terminated string; returns the x after the last glyph; 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]sModule state instance processed by the operation.
[in]colorRGB color value used by the drawing operation.
[in]scInteger glyph scale used by the operation.
Returns
The draw text result produced by the board overlay model.
Return values
valueThe operation-specific draw text value.
Precondition
Arguments satisfy the ranges documented for draw text.
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

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 )

Fill a clipped rectangle in the composite (draw primitive).

Fill a clipped rectangle in the composite (draw primitive); 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]rwRw input used by the operation.
[in]rhRh input used by the operation.
[in]colorRGB color value used by the drawing operation.
Precondition
Arguments satisfy the ranges documented for fill rect.
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

Fill a clipped rectangle in the composite (draw primitive).

Definition at line 141 of file board_overlay_draw.c.

References board_overlay_surface_t::context, board_overlay_surface_t::fill, board_overlay_surface_t::height, board_overlay_surface_t::ok, and board_overlay_surface_t::width.

Referenced by board_overlay_draw_sidebar(), internal_draw_button(), internal_draw_console(), internal_draw_console_heading(), internal_draw_console_tabs(), internal_draw_core(), internal_draw_glyph(), internal_draw_led(), internal_draw_power(), priv_px(), and priv_section_head().

◆ 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, coloured value; returns next y.

Draw a "label value" row: dim label, coloured value; returns next y; 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]labelNUL-terminated label used by the operation.
[in]valueRegister or payload value involved in the operation.
[in]val_colorVal color input used by the operation.
Returns
The kv row result produced by the board overlay model.
Return values
valueThe operation-specific kv row value.
Precondition
Arguments satisfy the ranges documented for kv row.
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

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 clipped pixel into the composite (draw primitive).

Plot one clipped pixel into the composite (draw primitive); 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]colorRGB color value used by the drawing operation.
Precondition
Arguments satisfy the ranges documented for px.
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

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().