|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Composite board-view renderer: panel framebuffer + a status sidebar. More...
Go to the source code of this file.
Data Structures | |
| struct | board_led_status_t |
| One board LED's live state for the status sidebar. More... | |
| struct | board_status_t |
| Live peripheral snapshot the status sidebar renders each frame. More... | |
| struct | board_overlay_surface_t |
| Non-owning drawing surface used by memory and raw-fd compositors. More... | |
Typedefs | |
| typedef bool(* | board_overlay_fill_fn) (void *context, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) |
| Rectangle-fill operation supplied by a bounded presentation surface. | |
Enumerations | |
| enum | board_overlay_dims_t : uint32_t { k_overlay_led_count = 3U } |
| Number of board LED indicators shown in the status sidebar. More... | |
| enum | board_overlay_console_t : uint32_t { k_overlay_console_rows = 18U , k_overlay_line_cap = 128U , k_overlay_console_tabs_max = 16U } |
| Console-panel sizing for the board view. More... | |
| enum | board_overlay_geometry_t : uint16_t { k_board_overlay_sidebar_width_px = 520U , k_board_overlay_min_height_px = 600U } |
| Fixed composite sidebar geometry shared with checked planners. More... | |
| enum | board_overlay_btn_t : uint32_t { k_board_overlay_btn_none = 0U , k_board_overlay_btn_sw1 = 1U , k_board_overlay_btn_sw2 = 2U , k_board_overlay_btn_console = 3U , k_board_overlay_btn_battery = 4U , k_board_overlay_btn_batt_chg = 5U , k_board_overlay_btn_lowpower = 6U } |
| On-screen sidebar control a click landed on. More... | |
Functions | |
| bool | board_overlay_draw_sidebar (board_overlay_surface_t *surface, uint16_t panel_w, const board_status_t *st) |
| Draw the status sidebar through a bounded rectangle sink. | |
| 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 | 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. | |
Composite board-view renderer: panel framebuffer + a status sidebar.
Builds the graphical BOARD VIEW the emulator presents: the emulated GLCDC panel framebuffer on the left, plus a Cocoa-blitted status sidebar on the right that makes a NON-display example observable – three LED indicators that light in the real GPIO LED colour, and text lines for the live USB / UART / timer-IRQ / touch state. The whole composite is rendered into one RGB565 buffer in portable C (a tiny embedded 5x7 ASCII font draws the text and filled rectangles draw the LED dots), so the exact same pixels the macOS window shows are what --ppm writes out – the status overlay is therefore verifiable headlessly with a region/pixel check, not just visible on screen.
This module owns no Unicorn engine and no AppKit dependency: main.c reads the peripheral state out of board_periph / board_usb, fills a board_status_t, and calls board_overlay_compose; board_view.m only blits the result. Plain C so it builds and tests on any host.
Definition in file board_overlay.h.
| typedef bool(* board_overlay_fill_fn) (void *context, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) |
Rectangle-fill operation supplied by a bounded presentation surface.
Definition at line 140 of file board_overlay.h.
| enum board_overlay_btn_t : uint32_t |
On-screen sidebar control a click landed on.
board_overlay_hit_button classifies a composite-space click into one of the sidebar's interactive controls (or none), so the caller can route a window / --click tap to the user-switch model instead of the touch panel.
Definition at line 61 of file board_overlay.h.
| enum board_overlay_console_t : uint32_t |
Console-panel sizing for the board view.
| Enumerator | |
|---|---|
| k_overlay_console_rows | Console lines shown (newest at bottom). |
| k_overlay_line_cap | Max chars copied per console line. |
| k_overlay_console_tabs_max | Tab-bar capacity (channels = tabs). |
Definition at line 42 of file board_overlay.h.
| enum board_overlay_dims_t : uint32_t |
Number of board LED indicators shown in the status sidebar.
| Enumerator | |
|---|---|
| k_overlay_led_count | LED1 / LED2 / LED3 (mirrors the BSP). |
Definition at line 37 of file board_overlay.h.
| enum board_overlay_geometry_t : uint16_t |
Fixed composite sidebar geometry shared with checked planners.
| Enumerator | |
|---|---|
| k_board_overlay_sidebar_width_px | Pixels added right of panel. |
| k_board_overlay_min_height_px | Minimum composite height. |
Definition at line 49 of file board_overlay.h.
| 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.
| [in] | x | Click column in composite pixels (top-left origin). |
| [in] | panel_w | Panel width the composite was built with (sidebar origin). |
| [out] | out_pct | Receives the mapped state-of-charge percent (0..100). |
out_pct was written, false if out_pct is NULL. | true | The board overlay battery pct at condition holds or completed successfully; false otherwise. |
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().
| 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.
| [out] | out | Composite RGB565 buffer, board_overlay_total_width by board_overlay_total_height pixels (row-major, no gap). |
| [in] | panel | Panel framebuffer (RGB565), or NULL for a blank panel. |
| [in] | panel_w | Panel width in pixels. |
| [in] | panel_h | Panel height in pixels. |
| [in] | st | Live peripheral snapshot to render (NULL draws no status). |
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().
| bool board_overlay_draw_sidebar | ( | board_overlay_surface_t * | surface, |
| uint16_t | panel_w, | ||
| const board_status_t * | st ) |
Draw the status sidebar through a bounded rectangle sink.
| [in,out] | surface | Complete composite surface and sticky write state. |
| [in] | panel_w | Displayed panel width and sidebar origin. |
| [in] | st | Live peripheral status, or nullptr for a blank sidebar. |
| true | The exact sidebar was rendered. |
| false | Surface validation or a sink operation failed. |
surface and its fill operation are non-null. panel_w. surface->ok. Draw the status sidebar through a bounded rectangle sink; this step is contained within the board overlay model and uses bounded caller or module-owned storage.
Draw the status sidebar through a bounded rectangle sink.
Definition at line 723 of file board_overlay.c.
References board_status_t::app_name, board_overlay_total_height(), board_overlay_total_width(), board_overlay_surface_t::fill, board_overlay_surface_t::height, internal_draw_buttons(), internal_draw_console(), internal_draw_core(), internal_draw_io_block(), internal_draw_leds(), internal_draw_power(), internal_draw_run_stats(), k_io_head_y, k_ovl_accent, k_ovl_bg, k_ovl_bg_alt, k_ovl_divider, k_ovl_heading, k_ovl_sidebar_w, k_pad_x, k_section_gap, k_sidebar_top, k_title_bar_h, k_title_gap, board_overlay_surface_t::ok, priv_draw_text(), priv_fill_rect(), and board_overlay_surface_t::width.
Referenced by board_overlay_compose(), and priv_emu_view_surface_build().
| 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.
| [in] | x | Click column in composite pixels (top-left origin). |
| [in] | y | Click row in composite pixels (top-left origin). |
| [in] | panel_w | Panel width the composite was built with (sidebar origin). |
| value | The operation-specific board overlay hit button value. |
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().
| 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.
| [in] | x | Click column in composite pixels (top-left origin). |
| [in] | y | Click row in composite pixels (top-left origin). |
| [in] | panel_w | Panel width the composite was built with (sidebar origin). |
| [in] | tab_count | Number of tabs drawn (1 .. k_overlay_console_tabs_max). |
| [out] | out_idx | Receives the hit tab index (0 .. tab_count - 1). |
out_idx written; false otherwise. | true | The board overlay hit console tab condition holds or completed successfully; false otherwise. |
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().
| uint16_t board_overlay_sidebar_width | ( | void | ) |
Width in pixels the status sidebar adds to the right of the panel.
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.
| value | The operation-specific board overlay sidebar width value. |
Definition at line 119 of file board_overlay_draw.c.
References k_ovl_sidebar_w.
| 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).
| [in] | panel_h | Panel framebuffer height in pixels. |
panel_h and the sidebar's minimum height. | value | The operation-specific board overlay total height value. |
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().
| uint16_t board_overlay_total_width | ( | uint16_t | panel_w | ) |
Total composite width for a panel of width panel_w.
| [in] | panel_w | Panel framebuffer width in pixels. |
panel_w plus the sidebar width. 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.
| value | The operation-specific board overlay total width value. |
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().