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

Composite board-view renderer implementation (see board_overlay.h). More...

#include "board_overlay.h"
#include <stdint.h>
#include <stdio.h>
#include "board_overlay_internal.h"
Include dependency graph for board_overlay.c:

Go to the source code of this file.

Data Structures

struct  overlay_memory_context_t
 Context adapting the legacy contiguous composite to a fill surface. More...

Functions

static bool internal_memory_fill (void *context, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color)
 Fill one already-clipped rectangle in a contiguous RGB565 surface.
static void internal_draw_led (board_overlay_surface_t *surface, int32_t x, int32_t y, const board_led_status_t *led)
 Draw one LED indicator dot (filled when on) plus its caption.
static int32_t internal_draw_leds (board_overlay_surface_t *surface, int32_t x, int32_t y, const board_status_t *st)
 Paint the three LED indicators in a row; returns the next free y.
static int32_t internal_draw_run_stats (board_overlay_surface_t *surface, int32_t x, int32_t y, const board_status_t *st)
 Paint the run-stats block (PC / chunks / MMIO / state); next free y.
static int32_t internal_draw_io_block (board_overlay_surface_t *surface, int32_t x, int32_t y, const board_status_t *st)
 Paint the I/O block (USB / IRQ / touch / SD); returns next free y.
static uint32_t internal_console_tabs_per_row (int32_t panel_w, uint32_t count)
 Tabs drawn per row for a wrapping tab grid of count cells.
static uint32_t internal_console_tab_row_count (int32_t panel_w, uint32_t count)
 Number of rows a wrapping tab grid of count cells occupies.
static void internal_console_tab_rect (int32_t panel_x, int32_t panel_w, uint32_t idx, uint32_t count, int32_t *r)
 Compute one console tab's cell rectangle in the wrapping grid.
static void internal_draw_console_tabs (board_overlay_surface_t *surface, int32_t panel_x, int32_t panel_w, const board_status_t *st)
 Draw the wrapping console tab bar at the top of the console panel.
static void internal_draw_console_heading (board_overlay_surface_t *surface, int32_t x, const board_status_t *st)
 Draw the console heading line and its rule.
static void internal_draw_console_body (board_overlay_surface_t *surface, int32_t panel_x, int32_t body_y, int32_t body_h, const board_status_t *st)
 Draw the scrolling console body below the tab bar.
static void internal_draw_console (board_overlay_surface_t *surface, int32_t x, const board_status_t *st)
 Perform draw console for the board overlay model.
static void internal_draw_button (board_overlay_surface_t *surface, int32_t x, const char *label, bool pressed)
 Draw one labelled push-button face at x (green when pressed).
static void internal_draw_buttons (board_overlay_surface_t *surface, int32_t x, const board_status_t *st)
 Paint the "BUTTONS" heading and the clickable SW1 / SW2 buttons.
static uint8_t internal_battery_clamp (uint8_t soc)
 Clamp a SOC value to 0..100 for display.
static uint16_t internal_battery_fill_color (uint8_t soc, bool charging)
 Pick the battery gauge fill colour: green charging, else red/amber/green by level.
static void internal_draw_power (board_overlay_surface_t *surface, int32_t x, const board_status_t *st)
 Paint the POWER section: a drag-to-set battery slider and a CHG toggle.
static void internal_draw_core (board_overlay_surface_t *surface, int32_t x, const board_status_t *st)
 Paint the primary-core / low-power toggle on the right of the BUTTONS row.
bool board_overlay_draw_sidebar (board_overlay_surface_t *surface, uint16_t panel_w, const board_status_t *st)
 Paint the sidebar background, divider, title and all status sections.
void board_overlay_compose (uint16_t *out, const uint16_t *panel, uint16_t panel_w, uint16_t panel_h, const board_status_t *st)
 Render the full composite (panel region + status sidebar) into out.
board_overlay_btn_t board_overlay_hit_button (uint16_t x, uint16_t y, uint16_t panel_w)
 Classify a composite-space click against the sidebar's on-screen buttons.
bool board_overlay_battery_pct_at (uint16_t x, uint16_t panel_w, uint8_t *out_pct)
 Map a click column on the battery slider track to a 0..100 SOC percent.
bool board_overlay_hit_console_tab (uint16_t x, uint16_t y, uint16_t panel_w, uint32_t tab_count, uint32_t *out_idx)
 Map a composite-space click on the console tab bar to a tab index.

Detailed Description

Composite board-view renderer implementation (see board_overlay.h).

Renders the panel framebuffer plus a status sidebar into one RGB565 buffer. Text is drawn with an embedded 5x7 column-major ASCII font (printable range 0x20..0x7E); each glyph is five bytes, one per column, with the low seven bits giving the rows top-to-bottom. Keeping the whole composite in a plain pixel buffer is deliberate: the macOS window and the --ppm snapshot show the identical bytes, so the overlay is verifiable headlessly.

Since
0.1.0

Definition in file board_overlay.c.

Function Documentation

◆ board_overlay_battery_pct_at()

bool board_overlay_battery_pct_at ( uint16_t x,
uint16_t panel_w,
uint8_t * out_pct )

Map a click column on the battery slider track to a 0..100 SOC percent.

The POWER section draws a horizontal slider whose fill mirrors the battery SOC. board_overlay_hit_button reports k_board_overlay_btn_battery when a click lands on that track's row; this then converts the click column to the percent the user dragged to, so the caller can drive the fuel-gauge model. The percent is the click's fraction across the track, clamped to 0..100 (a click left of the track yields 0, right of it yields 100), and the same fixed geometry that board_overlay_compose draws the track with is used here so the drawn fill and the drag position stay in lock-step.

Parameters
[in]xClick column in composite pixels (top-left origin).
[in]panel_wPanel width the composite was built with (sidebar origin).
[out]out_pctReceives the mapped state-of-charge percent (0..100).
Returns
True when out_pct was written, false if out_pct is NULL.
Since
0.1.0
Return values
trueThe board overlay battery pct at condition holds or completed successfully; false otherwise.
Precondition
Arguments satisfy the ranges documented for board overlay battery pct at.
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 844 of file board_overlay.c.

References k_pwr_soc_full, k_pwr_track_w, and k_pwr_x_dx.

Referenced by apply_battery_click().

◆ board_overlay_compose()

void board_overlay_compose ( uint16_t * out,
const uint16_t * panel,
uint16_t panel_w,
uint16_t panel_h,
const board_status_t * st )

Render the full composite (panel region + status sidebar) into out.

Clears out to the sidebar background, blits the panel pixels into the top-left region, draws a divider, then paints the three LED indicators and the USB / UART / IRQ / touch text lines from st. The output is exactly what board_view blits and what --ppm writes, so a headless pixel check over a sidebar region verifies the overlay.

Parameters
[out]outComposite RGB565 buffer, board_overlay_total_width by board_overlay_total_height pixels (row-major, no gap).
[in]panelPanel framebuffer (RGB565), or NULL for a blank panel.
[in]panel_wPanel width in pixels.
[in]panel_hPanel height in pixels.
[in]stLive peripheral snapshot to render (NULL draws no status).
Returns
Nothing.
Since
0.1.0
Precondition
Arguments satisfy the ranges documented for board overlay compose.
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 779 of file board_overlay.c.

References board_overlay_draw_sidebar(), board_overlay_total_height(), board_overlay_total_width(), internal_memory_fill(), and priv_blit_panel().

◆ board_overlay_draw_sidebar()

◆ board_overlay_hit_button()

board_overlay_btn_t board_overlay_hit_button ( uint16_t x,
uint16_t y,
uint16_t panel_w )

Classify a composite-space click against the sidebar's on-screen buttons.

The interactive board view draws SW1 / SW2 push-buttons in the status sidebar at a fixed layout (the same constants board_overlay_compose draws them with). Given a click in composite pixels and the panel_w used to compose the frame, this reports which button the click hit so the caller can drive the user-switch model rather than injecting a panel touch. Out-of-band clicks (the panel, sidebar text) return k_board_overlay_btn_none.

Parameters
[in]xClick column in composite pixels (top-left origin).
[in]yClick row in composite pixels (top-left origin).
[in]panel_wPanel width the composite was built with (sidebar origin).
Returns
The button hit, or k_board_overlay_btn_none.
Since
0.1.0
Return values
valueThe operation-specific board overlay hit button value.
Precondition
Arguments satisfy the ranges documented for board overlay hit button.
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 800 of file board_overlay.c.

References k_board_overlay_btn_batt_chg, k_board_overlay_btn_battery, k_board_overlay_btn_console, k_board_overlay_btn_lowpower, k_board_overlay_btn_none, k_board_overlay_btn_sw1, k_board_overlay_btn_sw2, k_btn_gap, k_btn_h, k_btn_w, k_btn_x_dx, k_btn_y, k_con_head_y, k_core_lp_off, k_core_lp_w, k_ovl_sidebar_w, k_pwr_chg_off, k_pwr_chg_w, k_pwr_h, k_pwr_track_w, k_pwr_x_dx, and k_pwr_y.

Referenced by internal_run_classify_click(), and route_click().

◆ board_overlay_hit_console_tab()

bool board_overlay_hit_console_tab ( uint16_t x,
uint16_t y,
uint16_t panel_w,
uint32_t tab_count,
uint32_t * out_idx )

Map a composite-space click on the console tab bar to a tab index.

The tabbed console wraps tab_count equal-width tabs into as many rows as the console panel width needs (the same grid geometry the compose path draws them with). Given a click in composite pixels, the panel_w used to compose the frame, and the live tab_count, this reports which tab the click landed on so the caller can switch the active console channel. Clicks outside the tab grid (including the console body below it) return false and leave out_idx untouched, so the caller can fall through to the body's autoscroll toggle.

Parameters
[in]xClick column in composite pixels (top-left origin).
[in]yClick row in composite pixels (top-left origin).
[in]panel_wPanel width the composite was built with (sidebar origin).
[in]tab_countNumber of tabs drawn (1 .. k_overlay_console_tabs_max).
[out]out_idxReceives the hit tab index (0 .. tab_count - 1).
Returns
True when a tab was hit and out_idx written; false otherwise.
Since
0.1.0
Return values
trueThe board overlay hit console tab condition holds or completed successfully; false otherwise.
Precondition
Arguments satisfy the ranges documented for board overlay hit console tab.
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 861 of file board_overlay.c.

References internal_console_tab_rect(), k_overlay_console_tabs_max, k_ovl_sidebar_w, and k_pad_x.

Referenced by internal_run_classify_click(), and route_click().

◆ internal_battery_clamp()

uint8_t internal_battery_clamp ( uint8_t soc)
static

Clamp a SOC value to 0..100 for display.

Clamp a soc value to 0..100 for display; this step is contained within the board overlay model and uses bounded caller or module-owned storage.

Parameters
[in]socSoc input used by the operation.
Returns
The battery clamp result produced by the board overlay model.
Return values
valueThe operation-specific battery clamp value.
Precondition
Arguments satisfy the ranges documented for battery clamp.
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 585 of file board_overlay.c.

References k_pwr_soc_full, and RA8_INTERNAL.

Referenced by internal_draw_power().

◆ internal_battery_fill_color()

uint16_t internal_battery_fill_color ( uint8_t soc,
bool charging )
static

Pick the battery gauge fill colour: green charging, else red/amber/green by level.

Pick the battery gauge fill colour: green charging, else red/amber/green by level; this step is contained within the board overlay model and uses bounded caller or module-owned storage.

Parameters
[in]socSoc input used by the operation.
[in]chargingCharging input used by the operation.
Returns
The battery fill color result produced by the board overlay model.
Return values
valueThe operation-specific battery fill color value.
Precondition
Arguments satisfy the ranges documented for battery fill color.
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 602 of file board_overlay.c.

References k_ovl_amber, k_ovl_ok, k_ovl_red, k_pwr_soc_low, k_pwr_soc_mid, and RA8_INTERNAL.

Referenced by internal_draw_power().

◆ internal_console_tab_rect()

void internal_console_tab_rect ( int32_t panel_x,
int32_t panel_w,
uint32_t idx,
uint32_t count,
int32_t * r )
static

Compute one console tab's cell rectangle in the wrapping grid.

The bar wraps into internal_console_tabs_per_row columns; cell idx lands at row idx/per_row, column idxper_row. Each row is k_con_tab_h tall and each cell one k_con_tab_gap narrower/shorter than its pitch. Both internal_draw_console_tabs and board_overlay_hit_console_tab derive their geometry here so the drawn tab and its click hit-box stay in lock-step.

Parameters
[in]panel_xConsole panel left edge (sidebar left + padding).
[in]panel_wConsole panel width in pixels.
[in]idxTab index (0 .. count - 1).
[in]countTotal tab count (clamped to >= 1 internally).
[out]rReceives the cell rect {x, y, w, h}; 4-int array.
Returns
Nothing.
Precondition
count is the live channel count (0 is treated as 1).
r is a non-NULL array of at least 4 int32_t.
Postcondition
r[0]/r[1] are within the console panel band.
r[2]/r[3] (w/h) are >= 0 (clamped, never negative).
Note
Not thread-safe; ra8_emulator is single-threaded.
Since
0.1.0

Definition at line 306 of file board_overlay.c.

References internal_console_tabs_per_row(), k_con_tab_gap, k_con_tab_h, k_con_y, and RA8_INTERNAL.

Referenced by board_overlay_hit_console_tab(), and internal_draw_console_tabs().

◆ internal_console_tab_row_count()

uint32_t internal_console_tab_row_count ( int32_t panel_w,
uint32_t count )
static

Number of rows a wrapping tab grid of count cells occupies.

Ceiling-divides count by internal_console_tabs_per_row, so the tab bar is exactly tall enough to show every lane. internal_draw_console and the hit-test use it to size the tab band and leave the rest of the panel for the scrolling body.

Parameters
[in]panel_wConsole panel width in pixels.
[in]countTotal tab count.
Returns
Row count, in [1, count] for count >= 1; 0 when count is 0.
Return values
0count is 0 (no tabs to draw).
Precondition
panel_w is the live console panel width.
count is the live channel count.
Postcondition
The result is 0 only when count is 0.
rows * tabs-per-row >= count (every cell has a slot).
Note
Not thread-safe; ra8_emulator is single-threaded.
Since
0.1.0

Definition at line 275 of file board_overlay.c.

References internal_console_tabs_per_row(), and RA8_INTERNAL.

Referenced by internal_draw_console().

◆ internal_console_tabs_per_row()

uint32_t internal_console_tabs_per_row ( int32_t panel_w,
uint32_t count )
static

Tabs drawn per row for a wrapping tab grid of count cells.

The tab bar wraps: each row holds as many equal-width cells as fit at the minimum cell pitch k_con_tab_min_w, so a wide panel packs more lanes per row and a narrow one fewer. The result is clamped to [1, count] so a single lane still gets a full-width tab and the grid never claims more cells per row than exist. Both internal_console_tab_rect and internal_console_tab_row_count build on this.

Parameters
[in]panel_wConsole panel width in pixels.
[in]countTotal tab count (>= 1 expected; 0 is treated as 1).
Returns
Tabs per row, in [1, max(1, count)].
Return values
1The panel is narrower than one minimum cell, or count is 0/1.
Precondition
panel_w is the live console panel width.
count is the live channel count.
Postcondition
The result is >= 1 (never zero – safe as a divisor).
The result is <= max(1, count).
Note
Not thread-safe; ra8_emulator is single-threaded.
Since
0.1.0

Definition at line 242 of file board_overlay.c.

References k_con_tab_min_w, and RA8_INTERNAL.

Referenced by internal_console_tab_rect(), and internal_console_tab_row_count().

◆ internal_draw_button()

void internal_draw_button ( board_overlay_surface_t * surface,
int32_t x,
const char * label,
bool pressed )
static

Draw one labelled push-button face at x (green when pressed).

Draw one labelled push-button face at x (green when pressed); 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]labelNUL-terminated label used by the operation.
[in]pressedPressed input used by the operation.
Precondition
Arguments satisfy the ranges documented for draw button.
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 537 of file board_overlay.c.

References k_btn_h, k_btn_label_x, k_btn_label_y, k_btn_w, k_btn_y, k_ovl_btn_border, k_ovl_btn_down, k_ovl_btn_label, k_ovl_btn_up, priv_draw_text(), and priv_fill_rect().

Referenced by internal_draw_buttons().

◆ internal_draw_buttons()

void internal_draw_buttons ( board_overlay_surface_t * surface,
int32_t x,
const board_status_t * st )
static

Paint the "BUTTONS" heading and the clickable SW1 / SW2 buttons.

Paint the "buttons" heading and the clickable sw1 / sw2 buttons; 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]stBoard-status snapshot used to render or report state.
Precondition
Arguments satisfy the ranges documented for draw buttons.
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 567 of file board_overlay.c.

References internal_draw_button(), k_btn_gap, k_btn_head_y, k_btn_w, priv_section_head(), board_status_t::sw1_pressed, and board_status_t::sw2_pressed.

Referenced by board_overlay_draw_sidebar().

◆ internal_draw_console()

void internal_draw_console ( board_overlay_surface_t * surface,
int32_t x,
const board_status_t * st )
static

Perform draw console for the board overlay model.

Perform draw console for the board overlay model; 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]stBoard-status snapshot used to render or report state.
Precondition
Arguments satisfy the ranges documented for draw console.
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 495 of file board_overlay.c.

References board_status_t::console_ch_count, board_overlay_surface_t::height, internal_console_tab_row_count(), internal_draw_console_body(), internal_draw_console_heading(), internal_draw_console_tabs(), k_con_bottom, k_con_line_h, k_con_tab_h, k_con_y, k_overlay_console_tabs_max, k_ovl_console_bg, k_ovl_sidebar_w, k_pad_x, and priv_fill_rect().

Referenced by board_overlay_draw_sidebar().

◆ internal_draw_console_body()

void internal_draw_console_body ( board_overlay_surface_t * surface,
int32_t panel_x,
int32_t body_y,
int32_t body_h,
const board_status_t * st )
static

Draw the scrolling console body below the tab bar.

Lines are drawn bottom-up so the console scrolls like a terminal: console[0] is the newest line and lands on the bottom row, highlighted.

Parameters
[in,out]surfaceClipped composite rectangle sink.
[in]panel_xLeft edge of the console panel.
[in]body_yTop of the body area, below the tab bar.
[in]body_hHeight of the body area, pixels.
[in]stBoard status carrying the visible lines.
Precondition
surface is valid and st is non-NULL.
body_h is at least one line high.
Postcondition
At most as many lines are drawn as the body height allows.
No line is drawn outside the body area.
Note
Not thread-safe; the overlay is drawn from one thread.
Since
0.1.0

Definition at line 464 of file board_overlay.c.

References board_status_t::console, board_status_t::console_count, k_con_line_h, k_con_pad, k_ovl_console_new, k_ovl_console_txt, priv_draw_text(), and RA8_INTERNAL.

Referenced by internal_draw_console().

◆ internal_draw_console_heading()

void internal_draw_console_heading ( board_overlay_surface_t * surface,
int32_t x,
const board_status_t * st )
static

Draw the console heading line and its rule.

The heading doubles as the scroll indicator: paused shows how far back the held view sits and how to resume, live shows the byte counter.

Parameters
[in,out]surfaceClipped composite rectangle sink.
[in]xLeft edge of the sidebar panel.
[in]stBoard status carrying the console counters.
Precondition
surface is valid and st is non-NULL.
The sidebar geometry constants fit inside surface.
Postcondition
The heading colour distinguishes paused (amber) from live.
A rule is drawn directly under the heading.
Note
Not thread-safe; the overlay is drawn from one thread.
Since
0.1.0

< Widest heading (the PAUSED variant), plus slack.

Definition at line 415 of file board_overlay.c.

References board_status_t::console_autoscroll, board_status_t::console_scroll, board_status_t::console_total, k_con_head_y, k_ovl_amber, k_ovl_ok, k_ovl_rule, k_ovl_sidebar_w, k_pad_x, k_rule_dy, priv_draw_text(), priv_fill_rect(), and board_status_t::uart_tx_total.

Referenced by internal_draw_console().

◆ internal_draw_console_tabs()

void internal_draw_console_tabs ( board_overlay_surface_t * surface,
int32_t panel_x,
int32_t panel_w,
const board_status_t * st )
static

Draw the wrapping console tab bar at the top of the console panel.

One equal-width cell per channel (ALL | UART | ITM | SPI | I2C | CAN | ...), wrapped across as many rows as the panel width needs and captioned "NAME n" where n is the channel's live line count. The active tab is filled bright with white text; an inactive tab with traffic is dim, and an empty channel (count 0) is dimmer still so it reads as "no data yet". Geometry comes from internal_console_tab_rect so the drawn cells line up with the click hit-test.

Parameters
[in,out]surfaceClipped composite rectangle sink.
[in]panel_xConsole panel left edge.
[in]panel_wConsole panel width in pixels.
[in]stLive status snapshot (tab names / counts / active index).
Returns
Nothing.
Precondition
st is non-NULL.
surface is valid for its declared composite geometry.
Postcondition
Up to k_overlay_console_tabs_max tab cells are painted.
The console body area below the bar is left untouched.
Note
Not thread-safe; ra8_emulator is single-threaded.
Since
0.1.0

< Console tab caption: "<name> <line count>".

Definition at line 353 of file board_overlay.c.

References board_status_t::console_active_ch, board_status_t::console_ch_count, board_status_t::console_ch_count_lines, board_status_t::console_ch_name, internal_console_tab_rect(), k_con_tab_cap_y, k_con_tab_txt, k_overlay_console_tabs_max, k_ovl_tab_empty_txt, k_ovl_tab_off_bg, k_ovl_tab_off_txt, k_ovl_tab_on_bg, k_ovl_tab_on_txt, priv_draw_text(), priv_fill_rect(), and RA8_INTERNAL.

Referenced by internal_draw_console().

◆ internal_draw_core()

void internal_draw_core ( board_overlay_surface_t * surface,
int32_t x,
const board_status_t * st )
static

Paint the primary-core / low-power toggle on the right of the BUTTONS row.

One button captioned "<core> <power>" – "M85 FULL" by default, "M33 LP" under –primary-core m33 + low-power. The core half is read-only (set by –primary-core); a click toggles the low-power half (bright when on). It shares the BUTTONS row, sitting to the right of SW1/SW2; the geometry matches board_overlay_hit_button.

Parameters
[in,out]surfaceDescriptor-backed presentation surface to access.
[in]xHorizontal coordinate in pixels.
[in]stBoard-status snapshot used to render or report state.
Precondition
Arguments satisfy the ranges documented for draw core.
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 697 of file board_overlay.c.

References board_status_t::core_is_m33, k_btn_h, k_btn_label_x, k_btn_label_y, k_btn_y, k_core_lp_off, k_core_lp_w, k_ovl_btn_border, k_ovl_btn_down, k_ovl_btn_label, k_ovl_btn_up, board_status_t::low_power, priv_draw_text(), and priv_fill_rect().

Referenced by board_overlay_draw_sidebar().

◆ internal_draw_io_block()

int32_t internal_draw_io_block ( board_overlay_surface_t * surface,
int32_t x,
int32_t y,
const board_status_t * st )
static

Paint the I/O block (USB / IRQ / touch / SD); returns next free y.

Paint the i/o block (usb / irq / touch / sd); returns next free 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]stBoard-status snapshot used to render or report state.
Returns
The draw io block result produced by the board overlay model.
Return values
valueThe operation-specific draw io block value.
Precondition
Arguments satisfy the ranges documented for draw io block.
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

< Widest I/O row (USB/IRQ/touch/SD summary), plus slack.

Definition at line 175 of file board_overlay.c.

References board_status_t::has_touch, board_status_t::irq0, board_status_t::irq1, board_status_t::irq_total, k_ovl_text, k_sd_unit_div, priv_kv_row(), priv_section_head(), RA8_INTERNAL, board_status_t::sd_attached, board_status_t::sd_bytes, board_status_t::sd_fat_bits, board_status_t::sd_label, board_status_t::touch_x, board_status_t::touch_y, and board_status_t::usb_state.

Referenced by board_overlay_draw_sidebar().

◆ internal_draw_led()

void internal_draw_led ( board_overlay_surface_t * surface,
int32_t x,
int32_t y,
const board_led_status_t * led )
static

Draw one LED indicator dot (filled when on) plus its caption.

Draw one led indicator dot (filled when on) plus its caption; 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]ledLed input used by the operation.
Precondition
Arguments satisfy the ranges documented for draw led.
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

< LED dot side in pixels.

Definition at line 80 of file board_overlay.c.

References board_led_status_t::color, k_led_label_dy, k_ovl_led_off, k_ovl_led_ring, k_ovl_text, board_led_status_t::label, board_led_status_t::on, priv_draw_text(), priv_fill_rect(), and RA8_INTERNAL.

Referenced by internal_draw_leds().

◆ internal_draw_leds()

int32_t internal_draw_leds ( board_overlay_surface_t * surface,
int32_t x,
int32_t y,
const board_status_t * st )
static

Paint the three LED indicators in a row; returns the next free y.

Paint the three led indicators in a row; returns the next free 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]stBoard-status snapshot used to render or report state.
Returns
The draw leds result produced by the board overlay model.
Return values
valueThe operation-specific draw leds value.
Precondition
Arguments satisfy the ranges documented for draw leds.
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 114 of file board_overlay.c.

References internal_draw_led(), k_led_col_dx, k_led_row_h, k_overlay_led_count, board_status_t::leds, and priv_section_head().

Referenced by board_overlay_draw_sidebar().

◆ internal_draw_power()

void internal_draw_power ( board_overlay_surface_t * surface,
int32_t x,
const board_status_t * st )
static

Paint the POWER section: a drag-to-set battery slider and a CHG toggle.

The slider track is a bordered bar whose left portion is filled to the SOC fraction in the level colour (red <=20%, amber <=50%, green above, or green while charging); the "NN%" reading is drawn over it. To the right, a CHG button shows the charge state – green "CHG +" while charging, dim "BATT" on battery. The geometry matches board_overlay_hit_button and board_overlay_battery_pct_at so a click drags the percent or toggles charge.

Parameters
[in,out]surfaceClipped composite rectangle sink.
[in]xSection text origin (sidebar left + padding).
[in]stLive status snapshot (battery_soc / battery_charging).
Precondition
Arguments satisfy the ranges documented for draw power.
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 635 of file board_overlay.c.

References board_status_t::battery_charging, board_status_t::battery_soc, internal_battery_clamp(), internal_battery_fill_color(), k_btn_label_x, k_ovl_btn_border, k_ovl_btn_down, k_ovl_btn_label, k_ovl_btn_up, k_ovl_heading, k_pwr_chg_off, k_pwr_chg_w, k_pwr_h, k_pwr_head_y, k_pwr_label_y, k_pwr_soc_full, k_pwr_track_w, k_pwr_y, priv_draw_text(), priv_fill_rect(), and priv_section_head().

Referenced by board_overlay_draw_sidebar().

◆ internal_draw_run_stats()

int32_t internal_draw_run_stats ( board_overlay_surface_t * surface,
int32_t x,
int32_t y,
const board_status_t * st )
static

Paint the run-stats block (PC / chunks / MMIO / state); next free y.

Paint the run-stats block (pc / chunks / mmio / state); next free 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]stBoard-status snapshot used to render or report state.
Returns
The draw run stats result produced by the board overlay model.
Return values
valueThe operation-specific draw run stats value.
Precondition
Arguments satisfy the ranges documented for draw run stats.
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

< Widest RUN row ("<state> chunk <n>"), plus slack.

Definition at line 137 of file board_overlay.c.

References board_status_t::chunks, k_ovl_dim, k_ovl_heading, k_ovl_ok, k_ovl_text, board_status_t::mmio_reads, board_status_t::mmio_writes, board_status_t::pc, priv_kv_row(), priv_section_head(), RA8_INTERNAL, and board_status_t::running.

Referenced by board_overlay_draw_sidebar().

◆ internal_memory_fill()

bool internal_memory_fill ( void * context,
uint16_t x,
uint16_t y,
uint16_t width,
uint16_t height,
uint16_t color )
static

Fill one already-clipped rectangle in a contiguous RGB565 surface.

Fill one already-clipped rectangle in a contiguous rgb565 surface; this step is contained within the board overlay model and uses bounded caller or module-owned storage.

Parameters
[in,out]contextCallback context registered for this operation.
[in]xHorizontal coordinate in pixels.
[in]yVertical coordinate in pixels.
[in]widthWidth of the affected region in pixels.
[in]heightHeight of the affected region in pixels.
[in]colorRGB color value used by the drawing operation.
Returns
The memory fill result produced by the board overlay model.
Return values
trueThe memory fill condition holds or completed successfully; false otherwise.
Precondition
Arguments satisfy the ranges documented for memory fill.
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 47 of file board_overlay.c.

References overlay_memory_context_t::pixels, RA8_INTERNAL, and overlay_memory_context_t::stride.

Referenced by board_overlay_compose().