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

Board-view presentation implementation (see emu_view.h). More...

#include "emu_view.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "board_console.h"
#include "board_periph.h"
#include "board_periph_sd.h"
#include "board_usb.h"
#include "emu_exc.h"
#include "emu_host_io_internal.h"
#include "emu_mmio.h"
#include "emu_view_surface_internal.h"
Include dependency graph for emu_view.c:

Go to the source code of this file.

Functions

static void internal_fill_status_hw (board_status_t *st, const char *app_name)
 Snapshot the LED / USB / UART / IRQ / switch / battery / SD state.
static void internal_fill_console_tabs (board_status_t *st)
 Populate the console tab-bar metadata in st.
static uint32_t internal_console_advance_scroll (uint32_t avail, uint32_t total)
 Advance and clamp the console scroll offset, returning where to read.
static void internal_fill_status_console (board_status_t *st)
 Perform fill status console for the emu view model.
static void internal_fill_status (board_status_t *st, const char *app_name)
 Snapshot the live peripheral state into a board-view status struct.
void unrotate_click (uint16_t cx, uint16_t cy, uint16_t panel_w, uint16_t panel_h, uint32_t deg, uint16_t *nx, uint16_t *ny)
 Map a click in the rotated displayed panel back to native panel coords.
void set_switch (board_overlay_btn_t btn, bool pressed)
 Toggle a user switch's pressed level (active-low) for an on-screen button.
void apply_battery_click (board_overlay_btn_t btn, uint16_t cx, uint16_t disp_w)
 Apply a POWER-section click to the fuel-gauge model.
board_overlay_btn_t route_click (uint16_t cx, uint16_t cy, uint16_t panel_w, uint16_t panel_h, uint16_t disp_w, uint32_t rotate_deg)
 Route a composite-space click to the right input model.
bool build_composite (uc_engine *uc, emu_presentation_workspace_t *presentation, const char *app_name)
 Stream the panel and status sidebar into a raw-fd surface.
static void internal_panel_rstrip (char *s)
 Trim trailing space/tab/CR/LF in place.
static bool internal_panel_split_kv (char *line, char **key, char **val)
 Split one config line into a trimmed key / value pair, in place.
static void internal_panel_set_name (board_panel_t *out, const char *val)
 Copy the panel name value into out, stripping optional quotes.
static void internal_panel_apply_kv (board_panel_t *out, const char *key, const char *val)
 Apply one recognised key=value pair to out; unknown keys are ignored.
static bool internal_parse_panel (char *text, board_panel_t *out)
 Parse bounded panel-config text already loaded into memory.
bool load_panel (const char *path, board_panel_t *out)
 Load a panel descriptor (name / width / height) from a TOML-ish file.
void emu_view_publish (uint32_t pc, uint32_t chunks)
 Implementation of emu_view_publish() – run-loop telemetry.
void emu_view_mark_stopped (uint32_t pc)
 Implementation of emu_view_mark_stopped() – final held frame.
void emu_view_wheel (int32_t notches)
 Implementation of emu_view_wheel() – scrollback paging.
void emu_view_select_console_tab (uint32_t tab_idx)
 Implementation of emu_view_select_console_tab() – tab switch.
void emu_view_reset_console (void)
 Implementation of emu_view_reset_console() – warm-reboot view reset.
board_primary_core_t emu_primary_core (void)
 Implementation of emu_primary_core() – plain state read.
void emu_set_primary_core (board_primary_core_t core)
 Implementation of emu_set_primary_core() – plain state write.
bool emu_low_power (void)
 Implementation of emu_low_power() – plain state read.
void emu_set_low_power (bool on)
 Implementation of emu_set_low_power() – plain state write.

Variables

static uint32_t s_view_pc
static uint32_t s_view_chunks
static bool s_view_running = true
static uint32_t s_view_scroll
static bool s_view_autoscroll = true
static uint32_t s_view_log_seen
static board_console_ch_t s_view_console_ch = k_board_console_ch_all
static board_primary_core_t s_primary_core = k_core_m85
static bool s_low_power = false

Detailed Description

Board-view presentation implementation (see emu_view.h).

Frame building from live GLCDC state, PPM writing, the status-sidebar snapshot, rotation/unrotation, input routing shared by the window and the headless –click, the panel-descriptor loader, and the console-scrollback

  • core-control state – moved verbatim out of the ra8_emulator main translation unit.
Since
0.1.0

Definition in file emu_view.c.

Function Documentation

◆ apply_battery_click()

void apply_battery_click ( board_overlay_btn_t btn,
uint16_t cx,
uint16_t disp_w )

Apply a POWER-section click to the fuel-gauge model.

Apply a POWER-section click to the fuel-gauge / core model.

A click on the battery slider track maps the click column to a 0..100 percent (board_overlay_battery_pct_at) and writes it while preserving the charge state; a click on the CHG toggle flips charging while preserving SOC. Shared by the live window and the headless --click so both behave alike.

Parameters
[in]btnThe POWER button hit (battery slider or CHG toggle).
[in]cxClick column in composite pixels (for the slider map).
[in]disp_wDisplayed panel width (the sidebar origin).

Definition at line 289 of file emu_view.c.

References board_overlay_battery_pct_at(), board_periph_battery_get(), board_periph_battery_set(), k_board_overlay_btn_batt_chg, k_board_overlay_btn_battery, k_board_overlay_btn_lowpower, and s_low_power.

Referenced by internal_run_loop_tick_inputs(), internal_run_loop_view(), and route_click().

◆ build_composite()

bool build_composite ( uc_engine * uc,
emu_presentation_workspace_t * presentation,
const char * app_name )

Stream the panel and status sidebar into a raw-fd surface.

Clears and fills the fd-backed composite, copies the live GLCDC layer through bounded rotation tiles, then renders the exact legacy sidebar through its clipped rectangle sink.

Parameters
[in,out]ucUnicorn engine (read for the GLCDC framebuffer).
[in,out]presentationOwned fd and caller-owned tile scratch.
[in]app_nameWindow / app title for the sidebar caption.
Returns
Whether every emulated read and raw surface write completed.
Return values
trueThe exact composite is ready.
falseAn engine read or raw-fd sink operation failed.
Precondition
presentation is active, open, and outlives the operation.
Postcondition
Success leaves a complete RGB565 frame in the owned descriptor.
Note
Not thread-safe; the emulator is single-threaded host-side.
Since
0.1.0
Precondition
The call executes on the emulator's single owning thread.
Postcondition
Ownership of caller-supplied storage is unchanged.

Definition at line 371 of file emu_view.c.

References internal_fill_status(), and priv_emu_view_surface_build().

Referenced by internal_run_loop_record(), internal_run_view_maybe_present(), priv_run_hold_view(), and priv_run_write_outputs().

◆ emu_low_power()

bool emu_low_power ( void )

Implementation of emu_low_power() – plain state read.

Whether the M33 4:1-slower low-power clock model is active.

Definition at line 645 of file emu_view.c.

References s_low_power.

Referenced by internal_main_load_primary(), and internal_run_inner_budget().

◆ emu_primary_core()

board_primary_core_t emu_primary_core ( void )

Implementation of emu_primary_core() – plain state read.

The primary core the firmware targets (label + seam gating).

Definition at line 633 of file emu_view.c.

References s_primary_core.

Referenced by internal_main_install_run_seams(), and internal_main_load_primary().

◆ emu_set_low_power()

void emu_set_low_power ( bool on)

Implementation of emu_set_low_power() – plain state write.

Set the low-power clock model (CLI –low-power / GUI toggle).

Definition at line 651 of file emu_view.c.

References s_low_power.

Referenced by internal_args_try_mode().

◆ emu_set_primary_core()

void emu_set_primary_core ( board_primary_core_t core)

Implementation of emu_set_primary_core() – plain state write.

Select the primary core (CLI –primary-core).

Definition at line 639 of file emu_view.c.

References s_primary_core.

Referenced by internal_args_try_mode().

◆ emu_view_mark_stopped()

void emu_view_mark_stopped ( uint32_t pc)

Implementation of emu_view_mark_stopped() – final held frame.

Mark the run ended: the held frame shows "parked" at pc.

Definition at line 591 of file emu_view.c.

References s_view_pc, and s_view_running.

Referenced by priv_run_report().

◆ emu_view_publish()

void emu_view_publish ( uint32_t pc,
uint32_t chunks )

Implementation of emu_view_publish() – run-loop telemetry.

Publish the run-loop telemetry the board view shows.

Definition at line 584 of file emu_view.c.

References s_view_chunks, and s_view_pc.

Referenced by internal_run_loop_prologue().

◆ emu_view_reset_console()

void emu_view_reset_console ( void )

Implementation of emu_view_reset_console() – warm-reboot view reset.

Reset the console-scrollback view (warm-reboot support).

Definition at line 624 of file emu_view.c.

References k_board_console_ch_all, s_view_autoscroll, s_view_console_ch, s_view_log_seen, and s_view_scroll.

Referenced by warm_reboot().

◆ emu_view_select_console_tab()

void emu_view_select_console_tab ( uint32_t tab_idx)

Implementation of emu_view_select_console_tab() – tab switch.

Switch the visible console channel to tab_idx (tab-bar click).

Definition at line 615 of file emu_view.c.

References board_console_total(), s_view_autoscroll, s_view_console_ch, s_view_log_seen, and s_view_scroll.

Referenced by internal_run_classify_click().

◆ emu_view_wheel()

void emu_view_wheel ( int32_t notches)

Implementation of emu_view_wheel() – scrollback paging.

Page the console scrollback by mouse-wheel notches.

Definition at line 598 of file emu_view.c.

References s_view_autoscroll, and s_view_scroll.

Referenced by internal_run_loop_view().

◆ internal_console_advance_scroll()

uint32_t internal_console_advance_scroll ( uint32_t avail,
uint32_t total )
static

Advance and clamp the console scroll offset, returning where to read.

While autoscroll is on the view follows the live tail. While paused, new lines push the tail forward, so the back-offset advances by the same amount to keep the reader's current lines on screen – capped at the ring depth, because anything older than the ring has already aged out. The result is re-clamped so a shrunken or shallow history cannot scroll past its top.

Parameters
[in]availLines currently held in the active channel's ring.
[in]totalLines ever pushed to that channel (monotonic).
Returns
The back-offset to start reading the visible window from.
Precondition
s_view_log_seen holds the previous frame's total.
The active channel is s_view_console_ch.
Postcondition
s_view_scroll is <= the maximum scroll for avail.
s_view_log_seen is updated to total.
Note
Not thread-safe; the viewer is single-threaded host-side.
Return values
valueThe operation-specific console advance scroll value.
Since
0.1.0

Definition at line 157 of file emu_view.c.

References k_overlay_console_rows, k_uart_log_max, RA8_INTERNAL, s_view_autoscroll, s_view_log_seen, and s_view_scroll.

Referenced by internal_fill_status_console().

◆ internal_fill_console_tabs()

void internal_fill_console_tabs ( board_status_t * st)
static

Populate the console tab-bar metadata in st.

Each board_console channel (ALL | UART | ITM | SPI | I2C) is a tab. The overlay needs each tab's name and live line count, plus which tab is active, to draw the bar and hit-test clicks on it.

Parameters
[out]stStatus block whose console_ch_* fields are filled.
Precondition
st is non-NULL.
s_view_console_ch names a valid channel.
Postcondition
At most k_overlay_console_tabs_max tabs are described.
st->console_active_ch reflects the current channel.
Note
Not thread-safe; the viewer is single-threaded host-side.
Since
0.1.0

Definition at line 120 of file emu_view.c.

References board_console_count(), board_console_name(), 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, k_board_console_ch_count, k_overlay_console_tabs_max, RA8_INTERNAL, and s_view_console_ch.

Referenced by internal_fill_status_console().

◆ internal_fill_status()

void internal_fill_status ( board_status_t * st,
const char * app_name )
static

Snapshot the live peripheral state into a board-view status struct.

Reads the read-only board_periph / board_usb getters – per-LED level + lit colour, the USB device-state string, the last captured UART line, the NVIC IRQ totals, and the last drained touch point – so the overlay can render the status sidebar without reaching into any model's internals.

Parameters
[out]stStatus struct to fill.
[in]app_nameWindow / app title to caption the sidebar with.
Returns
Nothing.
Precondition
Arguments satisfy the ranges documented for fill status.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the emu view 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 235 of file emu_view.c.

References internal_fill_status_console(), internal_fill_status_hw(), and RA8_INTERNAL.

Referenced by build_composite().

◆ internal_fill_status_console()

void internal_fill_status_console ( board_status_t * st)
static

Perform fill status console for the emu view model.

Perform fill status console for the emu view model; this step is contained within the emu view model and uses bounded caller or module-owned storage.

Parameters
[in,out]stBoard-status snapshot used to render or report state.
Precondition
Arguments satisfy the ranges documented for fill status console.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the emu view 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 186 of file emu_view.c.

References board_console_count(), board_console_line(), board_console_total(), board_periph_uart_tx_total(), board_status_t::chunks, board_status_t::console, board_status_t::console_autoscroll, board_status_t::console_count, board_status_t::console_scroll, board_status_t::console_total, emu_mmio_reads(), emu_mmio_writes(), internal_console_advance_scroll(), internal_fill_console_tabs(), k_overlay_console_rows, k_overlay_line_cap, board_status_t::mmio_reads, board_status_t::mmio_writes, board_status_t::pc, RA8_INTERNAL, board_status_t::running, s_view_autoscroll, s_view_chunks, s_view_console_ch, s_view_pc, s_view_running, and board_status_t::uart_tx_total.

Referenced by internal_fill_status().

◆ internal_fill_status_hw()

void internal_fill_status_hw ( board_status_t * st,
const char * app_name )
static

Snapshot the LED / USB / UART / IRQ / switch / battery / SD state.

Snapshot the led / usb / uart / irq / switch / battery / sd state; this step is contained within the emu view model and uses bounded caller or module-owned storage.

Parameters
[in,out]stBoard-status snapshot used to render or report state.
[in]app_nameApp name input used by the operation.
Precondition
Arguments satisfy the ranges documented for fill status hw.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the emu view 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 76 of file emu_view.c.

References board_status_t::app_name, board_status_t::battery_charging, board_status_t::battery_soc, board_periph_battery_get(), board_periph_gpio_get_input(), board_periph_irq_count(), board_periph_irq_total(), board_periph_led_color_rgb565(), board_periph_led_level(), board_periph_touch_last(), board_periph_uart_last_line(), board_sd_info(), board_usb_state_string(), board_led_status_t::color, board_status_t::core_is_m33, board_status_t::has_touch, board_status_t::irq0, board_status_t::irq1, board_status_t::irq_total, k_core_m33, k_emu_sw1_pin, k_emu_sw2_pin, k_emu_sw_port, k_overlay_led_count, board_led_status_t::label, board_status_t::leds, board_status_t::low_power, board_led_status_t::on, RA8_INTERNAL, s_low_power, s_primary_core, board_status_t::sd_attached, board_status_t::sd_bytes, board_status_t::sd_fat_bits, board_status_t::sd_label, board_status_t::sw1_pressed, board_status_t::sw2_pressed, board_status_t::touch_x, board_status_t::touch_y, board_status_t::uart_line, and board_status_t::usb_state.

Referenced by internal_fill_status().

◆ internal_panel_apply_kv()

void internal_panel_apply_kv ( board_panel_t * out,
const char * key,
const char * val )
static

Apply one recognised key=value pair to out; unknown keys are ignored.

Parameters
[in,out]outPanel description being built.
[in]keyTrimmed key text.
[in]valTrimmed value text.
Precondition
out, key and val are non-NULL.
key and val are NUL-terminated.
Postcondition
Exactly one field of out is written, or none for an unknown key.
Unknown keys are ignored so newer configs stay loadable.
Note
Not thread-safe; the viewer is single-threaded host-side.

Apply one recognised key=value pair to out; unknown keys are ignored; this step is contained within the emu view model and uses bounded caller or module-owned storage.

Since
0.1.0

Definition at line 497 of file emu_view.c.

References board_panel_t::height, internal_panel_set_name(), k_strtol_base10, strncmp(), and board_panel_t::width.

Referenced by internal_parse_panel().

◆ internal_panel_rstrip()

void internal_panel_rstrip ( char * s)
static

Trim trailing space/tab/CR/LF in place.

Trim trailing space/tab/cr/lf in place; this step is contained within the emu view model and uses bounded caller or module-owned storage.

Parameters
[in,out]sModule state instance processed by the operation.
Precondition
Arguments satisfy the ranges documented for panel rstrip.
The call executes on the emulator's single owning thread.
Postcondition
State changes remain confined to the emu view 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 389 of file emu_view.c.

References RA8_INTERNAL, and strlen().

Referenced by internal_panel_split_kv().

◆ internal_panel_set_name()

void internal_panel_set_name ( board_panel_t * out,
const char * val )
static

Copy the panel name value into out, stripping optional quotes.

Parameters
[out]outPanel description receiving the name.
[in]valRaw value text, optionally wrapped in double quotes.
Precondition
out and val are non-NULL.
val is NUL-terminated.
Postcondition
out->name is NUL-terminated and never overruns its buffer.
A value longer than the field is truncated rather than rejected.
Note
Not thread-safe; the viewer is single-threaded host-side.

Copy the panel name value into out, stripping optional quotes; this step is contained within the emu view model and uses bounded caller or module-owned storage.

Since
0.1.0

Definition at line 465 of file emu_view.c.

References memcpy(), board_panel_t::name, RA8_INTERNAL, and strlen().

Referenced by internal_panel_apply_kv().

◆ internal_panel_split_kv()

bool internal_panel_split_kv ( char * line,
char ** key,
char ** val )
static

Split one config line into a trimmed key / value pair, in place.

Skips leading blanks, ignores comment and blank lines, splits on the first =, then right-trims both halves. The line buffer is modified: the = becomes the key's terminator and key / val point into it.

Parameters
[in,out]lineMutable line buffer from the config file.
[out]keyReceives a pointer to the trimmed key.
[out]valReceives a pointer to the trimmed value.
Returns
True when a key=value pair was found, false for a blank, comment, or =-less line the caller should skip.
Precondition
line, key and val are non-NULL.
line is NUL-terminated and writable.
Postcondition
On true, both *key and *val point inside line.
On false, *key and *val are untouched.
Note
Not thread-safe; the viewer is single-threaded host-side.
Return values
trueThe panel split kv condition holds or completed successfully; false otherwise.
Since
0.1.0

Definition at line 425 of file emu_view.c.

References internal_panel_rstrip(), RA8_INTERNAL, and strchr().

Referenced by internal_parse_panel().

◆ internal_parse_panel()

bool internal_parse_panel ( char * text,
board_panel_t * out )
static

Parse bounded panel-config text already loaded into memory.

Splits newline-delimited records in place and applies recognised key/value pairs.

Parameters
[in,out]textWritable NUL-terminated config text.
[in,out]outDescriptor receiving recognised values.
Returns
True when every input line respected the configured bound.
Return values
trueAll lines were bounded and parsed or ignored.
falseAt least one line exceeded k_panel_line_max.
Precondition
text is non-null, writable, and NUL-terminated.
out is non-null and initialised by the caller.
Postcondition
Newline separators inspected by the parser are replaced with NUL.
Recognised keys update out in input order.
Note
Not thread-safe; the viewer is single-threaded host-side.
Since
0.1.0

Definition at line 525 of file emu_view.c.

References internal_panel_apply_kv(), internal_panel_split_kv(), k_panel_line_max, RA8_INTERNAL, strchr(), and strlen().

Referenced by load_panel().

◆ load_panel()

bool load_panel ( const char * path,
board_panel_t * out )

Load a panel descriptor (name / width / height) from a TOML-ish file.

A flat key = value panel descriptor (see tools/ra8_emulator/panels/), so the board emulator becomes whatever display a config describes – not just the EK-RA8D2 1024x600. The raw descriptor backend rejects files over 4096 bytes, reads into a fixed stack buffer, and parses bounded lines without allocation. Blank lines and '#' comments are ignored and quotes are stripped from the name.

Parameters
[in]pathPanel config path.
[out]outFilled descriptor on success.
Returns
true if a valid width/height were parsed.
Return values
falseThe file was unreadable or the dimensions were out of range.
Precondition
out is non-null.
path is NUL-terminated.
Postcondition
On true out holds the descriptor; on false a diagnostic printed.
Every opened raw descriptor is closed before return.
Note
Not thread-safe; call during single-threaded setup.
Since
0.1.0

< Maximum accepted panel-description byte count.

Definition at line 550 of file emu_view.c.

References board_panel_t::height, internal_parse_panel(), k_emu_io_ok, k_panel_dim_max, memset(), priv_emu_io_close(), priv_emu_io_errf(), priv_emu_io_open_read(), priv_emu_io_read_exact(), emu_io_result_t::status, and board_panel_t::width.

Referenced by internal_main_apply_panel().

◆ route_click()

board_overlay_btn_t route_click ( uint16_t cx,
uint16_t cy,
uint16_t panel_w,
uint16_t panel_h,
uint16_t disp_w,
uint32_t rotate_deg )

Route a composite-space click to the right input model.

An on-screen SW1 / SW2 button toggles that user switch (active-low); any other click is mapped back through unrotate_click and injected as a GT911 touch – the same path the firmware's real ra8_touch_read drains. This is shared by the live window and the headless --click so both behave alike.

Parameters
[in]cxClick column in composite pixels.
[in]cyClick row in composite pixels.
[in]panel_wNative panel width (for the touch unrotate).
[in]panel_hNative panel height (for the touch unrotate).
[in]disp_wDisplayed panel width (the sidebar origin for buttons).
[in]rotate_degActive display rotation.
Returns
The button hit, or k_board_overlay_btn_none for a panel touch.

Definition at line 326 of file emu_view.c.

References apply_battery_click(), board_console_total(), board_overlay_hit_button(), board_overlay_hit_console_tab(), board_periph_touch_inject(), k_board_console_ch_count, 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, s_view_autoscroll, s_view_console_ch, s_view_log_seen, s_view_scroll, set_switch(), and unrotate_click().

Referenced by internal_run_loop_view().

◆ set_switch()

void set_switch ( board_overlay_btn_t btn,
bool pressed )

Toggle a user switch's pressed level (active-low) for an on-screen button.

SW1/SW2 are momentary push-buttons wired active-low: held down drives the pin LOW, released returns it HIGH. Driving the level directly makes a click behave as a real button (press on mouse-down, release on mouse-up), not a latching switch.

Parameters
[in]btnThe overlay button hit (SW1 or SW2).
[in]pressedtrue while held down, false on release.
Returns
Nothing.
Precondition
btn is one of the switch buttons.
The GPIO input model is initialised.
Postcondition
The switch pin level reflects pressed.
Note
Not thread-safe; the emulator is single-threaded host-side.
Since
0.1.0
Postcondition
Ownership of caller-supplied storage is unchanged.

Definition at line 266 of file emu_view.c.

References board_periph_gpio_set_input(), k_board_overlay_btn_sw2, k_emu_sw1_pin, k_emu_sw2_pin, k_emu_sw_port, and pin.

Referenced by internal_run_loop_tick_inputs(), internal_run_loop_view(), and route_click().

◆ unrotate_click()

void unrotate_click ( uint16_t cx,
uint16_t cy,
uint16_t panel_w,
uint16_t panel_h,
uint32_t deg,
uint16_t * nx,
uint16_t * ny )

Map a click in the rotated displayed panel back to native panel coords.

Parameters
[in]cxClick column in displayed-panel pixels.
[in]cyClick row in displayed-panel pixels.
[in]panel_wNative panel width.
[in]panel_hNative panel height.
[in]degActive display rotation (0/90/180/270).
[out]nxReceives the native column.
[out]nyReceives the native row.
Returns
Nothing.
Precondition
nx and ny are non-null.
deg is one of the panel_rotate_t values.
Postcondition
The native coordinates are written.
Note
Pure mapping; thread-safe.
Since
0.1.0

Map a click in the rotated displayed panel back to native panel coords; this step is contained within the emu view model and uses bounded caller or module-owned storage.

Postcondition
Ownership of caller-supplied storage is unchanged.

Definition at line 242 of file emu_view.c.

References k_rotate_180, k_rotate_270, and k_rotate_90.

Referenced by internal_run_loop_tick_inputs(), and route_click().

Variable Documentation

◆ s_low_power

bool s_low_power = false
static

◆ s_primary_core

board_primary_core_t s_primary_core = k_core_m85
static

Definition at line 63 of file emu_view.c.

Referenced by emu_primary_core(), emu_set_primary_core(), and internal_fill_status_hw().

◆ s_view_autoscroll

◆ s_view_chunks

uint32_t s_view_chunks
static

Definition at line 43 of file emu_view.c.

Referenced by emu_view_publish(), and internal_fill_status_console().

◆ s_view_console_ch

◆ s_view_log_seen

uint32_t s_view_log_seen
static

◆ s_view_pc

uint32_t s_view_pc
static

◆ s_view_running

bool s_view_running = true
static

Definition at line 44 of file emu_view.c.

Referenced by emu_view_mark_stopped(), and internal_fill_status_console().

◆ s_view_scroll

uint32_t s_view_scroll
static