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

Concrete ereader chrome widgets composited on the live GLCDC panel (#145 Phase 2). More...

#include <stddef.h>
#include <stdint.h>
#include "ra8_board_ek_ra8d2.h"
#include "ra8_boot_entry.h"
#include "ra8_box.h"
#include "ra8_cgc.h"
#include "ra8_display_pal.h"
#include "ra8_display_pal_lcd.h"
#include "ra8_err.h"
#include "ra8_gfx.h"
#include "ra8_gfx_font.h"
#include "ra8_glcdc.h"
#include "ra8_isr.h"
#include "ra8_mstp.h"
#include "ra8_panel.h"
#include "ra8_panel_timing.h"
#include "ra8_time.h"
#include "ra8_ui.h"
#include "ra8_widget.h"
#include "ra8_widget_book.h"
#include "ra8_widget_nav_bar.h"
#include "ra8_widget_progress_bar.h"
#include "ra8_widget_status_bar.h"
#include "ra8_widget_toolbar.h"
Include dependency graph for main.c:

Go to the source code of this file.

Enumerations

enum  wd_geom_t : uint16_t {
  k_wd_fb_w = 512U ,
  k_wd_fb_h = 512U ,
  k_wd_status_h = 44U ,
  k_wd_toolbar_h = 40U ,
  k_wd_prog_h = 12U ,
  k_wd_nav_h = 40U ,
  k_wd_pad = 8U ,
  k_wd_gap = 8U ,
  k_wd_label_h = 18U ,
  k_wd_bar_h = 6U ,
  k_wd_count_w = 96U
}
 Framebuffer + band geometry (no magic numbers). More...
enum  wd_color_t : uint32_t {
  k_wd_col_clear = 0x000008U ,
  k_wd_col_paper = 0xF4F0E8U ,
  k_wd_col_status = 0x1E2A40U ,
  k_wd_col_toolbar = 0x14141AU ,
  k_wd_col_field = 0x2A2A34U ,
  k_wd_col_rule = 0x50607AU ,
  k_wd_col_ink = 0x101018U ,
  k_wd_col_dim = 0x808494U ,
  k_wd_col_white = 0xFFFFFFU ,
  k_wd_col_cover_a = 0x806040U ,
  k_wd_col_cover_b = 0x404060U ,
  k_wd_col_cover_c = 0x406050U ,
  k_wd_col_cover_d = 0x604048U ,
  k_wd_col_track = 0x303038U ,
  k_wd_col_fill = 0xE0A020U ,
  k_wd_col_nav = 0x14141AU
}
 0xRRGGBB palette (ra8_gfx packs to RGB565). More...
enum  wd_child_idx_t : uint16_t {
  k_wd_w_status = 0U ,
  k_wd_w_toolbar = 1U ,
  k_wd_w_grid = 2U ,
  k_wd_w_prog = 3U ,
  k_wd_w_nav = 4U ,
  k_wd_root_n = 5U ,
  k_wd_root_cap = 6U
}
 Index of each chrome band within the root panel array. More...
enum  wd_data_t : uint32_t {
  k_wd_book_count = 4U ,
  k_wd_grid_cols = 2U ,
  k_wd_prog_value = 3U ,
  k_wd_prog_total = 10U ,
  k_wd_uart_baud = 115200U ,
  k_wd_frame_ms = 500U ,
  k_wd_fnv_offset = 2166136261U ,
  k_wd_fnv_prime = 16777619U ,
  k_wd_hex_nibbles = 8U ,
  k_wd_nibble_bits = 4U ,
  k_wd_nibble_mask = 0x0FU ,
  k_wd_dec_ten = 10U ,
  k_wd_clock_len = 6U
}
 Book count + progress + console constants. More...
enum  wd_book_pct_t : uint8_t {
  k_wd_pct_dune = 42U ,
  k_wd_pct_1984 = 100U ,
  k_wd_pct_solaris = 12U ,
  k_wd_pct_neuromancer = 70U
}
 Sample reading-progress percentages for the four demo books. More...

Functions

static void wd_fill (void *user, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color)
 Paint backend: fill a rectangle through ra8_gfx.
static void wd_text (void *user, int32_t x, int32_t y, const char *str, uint32_t fg, uint32_t bg)
 Paint backend: draw ASCII text through ra8_gfx.
static void wd_size (void *user, const char *str, int32_t *out_w, int32_t *out_h)
 Paint backend: measure a string's pixel size through ra8_gfx.
static void wd_print (const uint8_t *msg, uint32_t len)
 Emit a byte run on the board console.
static void wd_fail_halt (const uint8_t *msg, uint32_t len)
 Print a fail banner and park forever in WFI.
static void wd_print_hex (uint32_t value)
 Print value as 8 uppercase hex digits.
static void wd_print_uint (uint32_t value)
 Print a small unsigned integer in decimal.
static uint32_t wd_framebuffer_hash (void)
 FNV-1a-32 over the composited framebuffer bytes.
static void wd_clock_fmt (void)
 Reformat s_clock as the decimal s_clock_val (bounded, NUL-term).
static void wd_leaf_init (ra8_widget_t *w, const ra8_widget_vtable_t *vt, void *ctx, int16_t fixed, uint16_t flex)
 Build a leaf widget bound to a vtable + context.
static bool wd_build_tree (void)
 Assemble the chrome panel tree; return false on a bind error.
static ra8_err_t wd_compose (ra8_ui_rect_t *dmg, ra8_widget_refresh_t *hint, uint16_t *dirty)
 Compose the chrome tree into the framebuffer; report the flush rect.
static void wd_invalidate_all (ra8_widget_refresh_t refresh)
 Mark every chrome band dirty so the next compose repaints the tree.
static bool wd_panel_up (void)
 Bring up the GLCDC panel and bind ra8_gfx to its framebuffer.
static display_refresh_hint_t wd_map_hint (ra8_widget_refresh_t hint)
 Map a widget refresh hint to the display PAL refresh hint.
static void wd_flush_rect (const ra8_ui_rect_t *dmg, ra8_widget_refresh_t hint)
 Flush only dmg to the panel with the mapped refresh hint.
static bool wd_check_full (uint32_t *out_crc, uint16_t *out_dirty)
 Assert the full compose: all 5 chrome bands dirty, full-frame quality.
static bool wd_check_partial (uint32_t *out_crc, uint16_t *out_dirty)
 Assert the partial compose: status-only damage, fast hint.
static bool wd_selfcheck (uint32_t *crc0, uint16_t *d0, uint32_t *crc1, uint16_t *d1)
 Run the whole deterministic surface; return both composites' CRCs.
static void wd_setup_or_halt (void)
 Bring up clocks/MSTP/time and the console.
static void wd_print_banner (uint16_t d0, uint32_t crc0, uint16_t d1, uint32_t crc1)
 Emit the PASS banner once every self-check assertion holds.
static void wd_tick_live (void)
 Advance the clock and partial-flush only the status band.
void main (void)
 App entry: bring the panel up, self-check the chrome, run the live loop.

Variables

static uint16_t s_framebuffer [(uint32_t) k_wd_fb_w *(uint32_t) k_wd_fb_h]
 GLCDC-scanned render target in SRAM, AXI-burst aligned.
static display_handle_ts_display = nullptr
 Live display handle once the GLCDC panel is up.
static char s_clock [k_wd_clock_len] = "0"
 Status-bar right-side clock string (advances each partial flush).
static uint32_t s_clock_val = 0U
 Monotonic clock counter shown in the status bar.
static const ra8_widget_book_t s_books [k_wd_book_count]
 The four book records shown in the grid.
static const char *const s_nav_items [] = {"Library", "Store", "Settings"}
 Nav-strip destinations.
static const ra8_widget_paint_t k_wd_paint
 The single paint backend the chrome widgets share.
static ra8_widget_status_bar_t s_status
static ra8_widget_toolbar_t s_toolbar
static ra8_widget_book_grid_t s_grid
static ra8_widget_progress_bar_t s_prog
static ra8_widget_nav_bar_t s_nav
static ra8_widget_t s_root_kids [k_wd_root_n]
 The five chrome bands.
static ra8_box_t s_root_scratch [k_wd_root_cap]
 Root layout scratch.
static ra8_widget_panel_t s_root_panel
 Root column-panel descriptor tiling the five chrome bands.
static ra8_widget_t s_root
 The root panel widget (composed each frame).
static const uint8_t k_wd_msg_boot [] = "widget-chrome-demo: boot\r\n"
static const uint8_t k_wd_msg_finit [] = "widget-chrome-demo: FAIL init\r\n"
static const uint8_t k_wd_msg_fpanl [] = "widget-chrome-demo: FAIL panel\r\n"
static const uint8_t k_wd_msg_ftree [] = "widget-chrome-demo: FAIL tree\r\n"
static const uint8_t k_wd_msg_fchk [] = "widget-chrome-demo: FAIL selfcheck\r\n"
static const uint8_t k_wd_msg_pre [] = "widget-chrome-demo: dirty0="
static const uint8_t k_wd_msg_crc0 [] = " crc0="
static const uint8_t k_wd_msg_d1 [] = " dirty1="
static const uint8_t k_wd_msg_crc1 [] = " crc1="
static const uint8_t k_wd_msg_tail [] = " flush=512x44 hint=fast"
static const uint8_t k_wd_msg_pass [] = " PASS\r\n"
static const display_cfg_t k_wd_display_cfg
 Display PAL config: GLCDC LCD backend bound to the SRAM framebuffer.

Detailed Description

Concrete ereader chrome widgets composited on the live GLCDC panel (#145 Phase 2).

The sibling widget_compose_demo proves the ra8_widget_panel compositor primitive with generic tiles. This app is the focused demonstration of issue #145 Phase 2: the concrete ereader chrome widgets now extracted into the ra8_widget library, each a reusable leaf that paints through the injected ra8_widget_paint_t backend. It composes them into one panel tree on the GLCDC panel:

root (column panel) |- status bar (ra8_widget_status_bar_t, fixed) – title + live clock + rule |- toolbar (ra8_widget_toolbar_t, fixed) – search field + count chip |- book grid (ra8_widget_book_grid_t, flex) – 2-column cover / title / bar |- progress bar (ra8_widget_progress_bar_t,fixed) – an overall read gauge |- nav strip (ra8_widget_nav_bar_t, fixed) – Library / Store / Settings

The whole tree is composed by one ra8_widget_panel_compose call, which lays the children out, computes the minimal damage rect + refresh hint, and renders only the dirty children. The leaf renders go through a single ra8_widget_paint_t backend bound to ra8_gfx – the same DI seam the host unit tests bind to a recording mock, so the widgets run byte-for-byte the same logic on the host and on the M85.

A deterministic self-check runs before the live loop:

  • Full compose: mark the whole tree dirty -> all 5 chrome children dirty, damage covers the full 512x512 frame, quality hint.
  • Partial compose: advance the clock and invalidate only the status bar -> exactly 1 dirty child, damage is just the status-bar rect with the fast hint, and the composite CRC changes (the clock advanced). This is the Phase-1 partial-flush acceptance, now driven by a real chrome widget.

It then emits one banner so the app doubles as a ra8_emulator gate:

widget-chrome-demo: dirty0=5 crc0=<8hex> dirty1=1 crc1=<8hex> flush=512x44 hint=fast PASS

Any failed assertion prints FAIL ... and parks. After the banner the loop advances the clock and partial-composes the status bar live, so the panel visibly updates only its top band (the damage-tracked A2 path).

[Ring 6 / APP] {World: S}

Since
0.1.0

Definition in file main.c.

Enumeration Type Documentation

◆ wd_book_pct_t

enum wd_book_pct_t : uint8_t

Sample reading-progress percentages for the four demo books.

Since
0.1.0
Enumerator
k_wd_pct_dune 

"Dune" read progress, percent.

k_wd_pct_1984 

"1984" read progress, percent.

k_wd_pct_solaris 

"Solaris" read progress, percent.

k_wd_pct_neuromancer 

"Neuromancer" read progress, percent.

Definition at line 176 of file main.c.

◆ wd_child_idx_t

enum wd_child_idx_t : uint16_t

Index of each chrome band within the root panel array.

Since
0.1.0
Enumerator
k_wd_w_status 

Root child 0: status bar (fixed).

k_wd_w_toolbar 

Root child 1: toolbar (fixed).

k_wd_w_grid 

Root child 2: book grid (flex).

k_wd_w_prog 

Root child 3: progress (fixed).

k_wd_w_nav 

Root child 4: nav strip (fixed).

k_wd_root_n 

Root child count.

k_wd_root_cap 

Root ra8_box scratch (count + 1).

Definition at line 125 of file main.c.

◆ wd_color_t

enum wd_color_t : uint32_t

0xRRGGBB palette (ra8_gfx packs to RGB565).

Since
0.1.0
Enumerator
k_wd_col_clear 

Whole-frame clear (near black).

k_wd_col_paper 

Grid / page background.

k_wd_col_status 

Status-bar fill (slate).

k_wd_col_toolbar 

Toolbar fill (dark).

k_wd_col_field 

Search-field fill.

k_wd_col_rule 

Hairline / border.

k_wd_col_ink 

Primary ink.

k_wd_col_dim 

Secondary text (gray).

k_wd_col_white 

White text.

k_wd_col_cover_a 

Cover swatch A.

k_wd_col_cover_b 

Cover swatch B.

k_wd_col_cover_c 

Cover swatch C.

k_wd_col_cover_d 

Cover swatch D.

k_wd_col_track 

Progress track.

k_wd_col_fill 

Progress fill (amber).

k_wd_col_nav 

Nav-strip fill.

Definition at line 101 of file main.c.

◆ wd_data_t

enum wd_data_t : uint32_t

Book count + progress + console constants.

Since
0.1.0
Enumerator
k_wd_book_count 

Book records in the grid.

k_wd_grid_cols 

Grid columns.

k_wd_prog_value 

Overall progress value.

k_wd_prog_total 

Overall progress full-scale.

k_wd_uart_baud 

Console baud.

k_wd_frame_ms 

Live status repaint (ms).

k_wd_fnv_offset 

FNV-1a-32 offset basis.

k_wd_fnv_prime 

FNV-1a-32 prime.

k_wd_hex_nibbles 

Hex digits per 32-bit.

k_wd_nibble_bits 

Bits per hex nibble.

k_wd_nibble_mask 

Low-nibble mask.

k_wd_dec_ten 

Decimal radix + buffer size.

k_wd_clock_len 

"NNNNN" clock buffer + NUL.

Definition at line 140 of file main.c.

◆ wd_geom_t

enum wd_geom_t : uint16_t

Framebuffer + band geometry (no magic numbers).

Since
0.1.0
Enumerator
k_wd_fb_w 

Framebuffer width, pixels.

k_wd_fb_h 

Framebuffer height, pixels.

k_wd_status_h 

Status-bar band height, pixels.

k_wd_toolbar_h 

Toolbar band height, pixels.

k_wd_prog_h 

Overall progress band height, pixels.

k_wd_nav_h 

Nav-strip band height, pixels.

k_wd_pad 

Inner padding, pixels.

k_wd_gap 

Grid gap, pixels.

k_wd_label_h 

Card title / author row height.

k_wd_bar_h 

Card progress-bar height.

k_wd_count_w 

Toolbar count-chip width.

Definition at line 82 of file main.c.

Function Documentation

◆ main()

void main ( void )

App entry: bring the panel up, self-check the chrome, run the live loop.

The application entry point Reset_Handler hands control to.

Precondition
Reset_Handler copied .data and zeroed .bss.
SystemInit set VTOR / FPU / priority grouping.
Postcondition
The PASS banner is emitted and the panel shows the composed chrome; the loop partial-flushes only the status band so the panel updates its clock live (the damage-tracked path), otherwise idling.
Since
0.1.0

Definition at line 714 of file main.c.

References k_ra8_ok, k_ra8_widget_refresh_none, k_ra8_widget_refresh_quality, k_wd_col_clear, k_wd_frame_ms, k_wd_msg_boot, k_wd_msg_fchk, k_wd_msg_fpanl, k_wd_msg_ftree, ra8_delay_ms(), ra8_gfx_clear(), ra8_isr_globals_enable(), wd_build_tree(), wd_compose(), wd_fail_halt(), wd_flush_rect(), wd_invalidate_all(), wd_panel_up(), wd_print(), wd_print_banner(), wd_selfcheck(), wd_setup_or_halt(), and wd_tick_live().

◆ wd_build_tree()

◆ wd_check_full()

bool wd_check_full ( uint32_t * out_crc,
uint16_t * out_dirty )
static

Assert the full compose: all 5 chrome bands dirty, full-frame quality.

Definition at line 588 of file main.c.

References ra8_ui_rect_t::h, k_ra8_ok, k_ra8_widget_refresh_none, k_ra8_widget_refresh_quality, k_wd_fb_h, k_wd_fb_w, k_wd_root_n, ra8_ui_rect_t::w, wd_compose(), wd_framebuffer_hash(), and wd_invalidate_all().

Referenced by wd_selfcheck().

◆ wd_check_partial()

bool wd_check_partial ( uint32_t * out_crc,
uint16_t * out_dirty )
static

◆ wd_clock_fmt()

void wd_clock_fmt ( void )
static

Reformat s_clock as the decimal s_clock_val (bounded, NUL-term).

Definition at line 442 of file main.c.

References k_wd_clock_len, k_wd_dec_ten, s_clock, and s_clock_val.

Referenced by wd_check_partial(), and wd_tick_live().

◆ wd_compose()

ra8_err_t wd_compose ( ra8_ui_rect_t * dmg,
ra8_widget_refresh_t * hint,
uint16_t * dirty )
static

Compose the chrome tree into the framebuffer; report the flush rect.

Definition at line 505 of file main.c.

References k_wd_fb_h, k_wd_fb_w, ra8_widget_panel_compose(), and s_root.

Referenced by main(), wd_check_full(), wd_check_partial(), and wd_tick_live().

◆ wd_fail_halt()

void wd_fail_halt ( const uint8_t * msg,
uint32_t len )
static

Print a fail banner and park forever in WFI.

Definition at line 385 of file main.c.

References wd_print().

◆ wd_fill()

void wd_fill ( void * user,
int32_t x,
int32_t y,
int32_t w,
int32_t h,
uint32_t color )
static

Paint backend: fill a rectangle through ra8_gfx.

Parameters
[in]userUnused backend handle.
[in]xLeft edge, pixels.
[in]yTop edge, pixels.
[in]wWidth, pixels.
[in]hHeight, pixels.
[in]colorFill colour, 0xRRGGBB.
Returns
Nothing.
Precondition
ra8_gfx is bound to the framebuffer.
w and h are the widget rect extents.
Postcondition
The rectangle is filled in the framebuffer.
No other pixels are touched.
Note
Not thread-safe (single-threaded UI loop).
Since
0.1.0

Definition at line 227 of file main.c.

References ra8_gfx_rect().

◆ wd_flush_rect()

void wd_flush_rect ( const ra8_ui_rect_t * dmg,
ra8_widget_refresh_t hint )
static

Flush only dmg to the panel with the mapped refresh hint.

Definition at line 567 of file main.c.

References display_flush(), ra8_ui_rect_t::h, s_display, ra8_ui_rect_t::w, wd_map_hint(), ra8_ui_rect_t::x, and ra8_ui_rect_t::y.

Referenced by main(), and wd_tick_live().

◆ wd_framebuffer_hash()

uint32_t wd_framebuffer_hash ( void )
static

FNV-1a-32 over the composited framebuffer bytes.

Definition at line 425 of file main.c.

References k_wd_fnv_offset, k_wd_fnv_prime, and s_framebuffer.

◆ wd_invalidate_all()

void wd_invalidate_all ( ra8_widget_refresh_t refresh)
static

Mark every chrome band dirty so the next compose repaints the tree.

Definition at line 512 of file main.c.

References k_wd_root_n, ra8_widget_invalidate(), and s_root_kids.

Referenced by main(), and wd_check_full().

◆ wd_leaf_init()

void wd_leaf_init ( ra8_widget_t * w,
const ra8_widget_vtable_t * vt,
void * ctx,
int16_t fixed,
uint16_t flex )
static

Build a leaf widget bound to a vtable + context.

Definition at line 463 of file main.c.

Referenced by wd_build_tree().

◆ wd_map_hint()

display_refresh_hint_t wd_map_hint ( ra8_widget_refresh_t hint)
static

Map a widget refresh hint to the display PAL refresh hint.

Definition at line 558 of file main.c.

References k_display_refresh_fast, k_display_refresh_quality, and k_ra8_widget_refresh_fast.

Referenced by wd_flush_rect().

◆ wd_panel_up()

bool wd_panel_up ( void )
static

Bring up the GLCDC panel and bind ra8_gfx to its framebuffer.

Definition at line 536 of file main.c.

References display_get_framebuffer(), display_init(), k_ra8_gfx_format_rgb565, k_ra8_ok, k_wd_display_cfg, k_wd_fb_h, k_wd_fb_w, display_fb_t::pixels, ra8_gfx_init(), s_display, and s_framebuffer.

◆ wd_print()

void wd_print ( const uint8_t * msg,
uint32_t len )
static

Emit a byte run on the board console.

Definition at line 379 of file main.c.

References ra8_board_uart_console_write().

◆ wd_print_banner()

void wd_print_banner ( uint16_t d0,
uint32_t crc0,
uint16_t d1,
uint32_t crc1 )
static

Emit the PASS banner once every self-check assertion holds.

Definition at line 676 of file main.c.

References k_wd_msg_crc0, k_wd_msg_crc1, k_wd_msg_d1, k_wd_msg_pass, k_wd_msg_pre, k_wd_msg_tail, wd_print(), wd_print_hex(), and wd_print_uint().

◆ wd_print_hex()

void wd_print_hex ( uint32_t value)
static

Print value as 8 uppercase hex digits.

Definition at line 394 of file main.c.

References k_wd_dec_ten, k_wd_hex_nibbles, k_wd_nibble_bits, k_wd_nibble_mask, and wd_print().

◆ wd_print_uint()

void wd_print_uint ( uint32_t value)
static

Print a small unsigned integer in decimal.

Definition at line 406 of file main.c.

References k_wd_dec_ten, and wd_print().

◆ wd_selfcheck()

bool wd_selfcheck ( uint32_t * crc0,
uint16_t * d0,
uint32_t * crc1,
uint16_t * d1 )
static

Run the whole deterministic surface; return both composites' CRCs.

Definition at line 641 of file main.c.

References wd_check_full(), and wd_check_partial().

◆ wd_setup_or_halt()

void wd_setup_or_halt ( void )
static

◆ wd_size()

void wd_size ( void * user,
const char * str,
int32_t * out_w,
int32_t * out_h )
static

Paint backend: measure a string's pixel size through ra8_gfx.

Parameters
[in]userUnused backend handle.
[in]strNUL-terminated ASCII string.
[out]out_wReceives the pixel width.
[out]out_hReceives the pixel height.
Returns
Nothing.
Precondition
str, out_w, out_h are non-NULL.
The bundled font is available.
Postcondition
*out_w / *out_h hold the measured size (0 on a measure error).
No pixels are touched.
Note
Not thread-safe.
Since
0.1.0

Definition at line 269 of file main.c.

References ra8_gfx_font_8x16, and ra8_gfx_text_size().

◆ wd_text()

void wd_text ( void * user,
int32_t x,
int32_t y,
const char * str,
uint32_t fg,
uint32_t bg )
static

Paint backend: draw ASCII text through ra8_gfx.

Parameters
[in]userUnused backend handle.
[in]xPen X, pixels.
[in]yPen Y, pixels.
[in]strNUL-terminated ASCII string.
[in]fgText colour, 0xRRGGBB.
[in]bgBackground colour behind the glyphs, 0xRRGGBB.
Returns
Nothing.
Precondition
ra8_gfx is bound to the framebuffer.
str is NUL-terminated.
Postcondition
The string is drawn at (x, y).
No other pixels are touched.
Note
Not thread-safe.
Since
0.1.0

Definition at line 249 of file main.c.

References ra8_gfx_font_8x16, and ra8_gfx_text_out().

◆ wd_tick_live()

void wd_tick_live ( void )
static

Advance the clock and partial-flush only the status band.

Definition at line 691 of file main.c.

References k_ra8_ok, k_ra8_widget_refresh_fast, k_ra8_widget_refresh_none, k_wd_w_status, ra8_widget_invalidate(), s_clock_val, s_root_kids, wd_clock_fmt(), wd_compose(), and wd_flush_rect().

Referenced by main().

Variable Documentation

◆ k_wd_display_cfg

const display_cfg_t k_wd_display_cfg
static
Initial value:
= {
.framebuffer = s_framebuffer,
.framebuffer_bytes = sizeof(s_framebuffer),
.width_px = (uint16_t)k_wd_fb_w,
.height_px = (uint16_t)k_wd_fb_h,
.panel_timing = &s_ra8_panel_ek_ra8d2_timing,
}
static uint16_t s_framebuffer[(size_t) k_panel_height_px *(size_t) k_panel_width_px]
1024x600 RGB565 framebuffer in external SDRAM (GLCDC scans this).
Definition main.c:67
@ k_wd_fb_h
Framebuffer height, pixels.
Definition main.c:83
@ k_wd_fb_w
Framebuffer width, pixels.
Definition main.c:82
@ k_display_pixfmt_rgb565
16 bpp, 5/6/5 packed.
const display_backend_iface_t k_display_backend_lcd_ra8_glcdc
LCD backend vtable – pass its address through display_cfg_t.iface to drive the EK-RA8D2 panel.
static const ra8_glcdc_timing_t s_ra8_panel_ek_ra8d2_timing
EK-RA8D2 ER-TFT070-6 RGB timing for ra8_glcdc_init / the LCD backend.

Display PAL config: GLCDC LCD backend bound to the SRAM framebuffer.

Definition at line 525 of file main.c.

◆ k_wd_msg_boot

const uint8_t k_wd_msg_boot[] = "widget-chrome-demo: boot\r\n"
static

Definition at line 361 of file main.c.

◆ k_wd_msg_crc0

const uint8_t k_wd_msg_crc0[] = " crc0="
static

Definition at line 367 of file main.c.

Referenced by wd_print_banner().

◆ k_wd_msg_crc1

const uint8_t k_wd_msg_crc1[] = " crc1="
static

Definition at line 369 of file main.c.

Referenced by wd_print_banner().

◆ k_wd_msg_d1

const uint8_t k_wd_msg_d1[] = " dirty1="
static

Definition at line 368 of file main.c.

Referenced by wd_print_banner().

◆ k_wd_msg_fchk

const uint8_t k_wd_msg_fchk[] = "widget-chrome-demo: FAIL selfcheck\r\n"
static

Definition at line 365 of file main.c.

◆ k_wd_msg_finit

const uint8_t k_wd_msg_finit[] = "widget-chrome-demo: FAIL init\r\n"
static

Definition at line 362 of file main.c.

◆ k_wd_msg_fpanl

const uint8_t k_wd_msg_fpanl[] = "widget-chrome-demo: FAIL panel\r\n"
static

Definition at line 363 of file main.c.

◆ k_wd_msg_ftree

const uint8_t k_wd_msg_ftree[] = "widget-chrome-demo: FAIL tree\r\n"
static

Definition at line 364 of file main.c.

Referenced by main().

◆ k_wd_msg_pass

const uint8_t k_wd_msg_pass[] = " PASS\r\n"
static

Definition at line 371 of file main.c.

◆ k_wd_msg_pre

const uint8_t k_wd_msg_pre[] = "widget-chrome-demo: dirty0="
static

Definition at line 366 of file main.c.

◆ k_wd_msg_tail

const uint8_t k_wd_msg_tail[] = " flush=512x44 hint=fast"
static

Definition at line 370 of file main.c.

Referenced by wd_print_banner().

◆ k_wd_paint

const ra8_widget_paint_t k_wd_paint
static
Initial value:
= {
.user = nullptr,
.fill_rect = wd_fill,
.draw_text = wd_text,
.text_size = wd_size,
}
static void wd_fill(void *user, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color)
Paint backend: fill a rectangle through ra8_gfx.
Definition main.c:227
static void wd_size(void *user, const char *str, int32_t *out_w, int32_t *out_h)
Paint backend: measure a string's pixel size through ra8_gfx.
Definition main.c:269
static void wd_text(void *user, int32_t x, int32_t y, const char *str, uint32_t fg, uint32_t bg)
Paint backend: draw ASCII text through ra8_gfx.
Definition main.c:249

The single paint backend the chrome widgets share.

Definition at line 280 of file main.c.

◆ s_books

const ra8_widget_book_t s_books[k_wd_book_count]
static
Initial value:
= {
{.title = "Dune",
.author = "Herbert",
.cover = (uint32_t)k_wd_col_cover_a,
.percent = k_wd_pct_dune},
{.title = "1984",
.author = "Orwell",
.cover = (uint32_t)k_wd_col_cover_b,
.percent = k_wd_pct_1984},
{.title = "Solaris",
.author = "Lem",
.cover = (uint32_t)k_wd_col_cover_c,
.percent = k_wd_pct_solaris},
{.title = "Neuromancer",
.author = "Gibson",
.cover = (uint32_t)k_wd_col_cover_d,
.percent = k_wd_pct_neuromancer},
}
@ k_wd_col_cover_c
Cover swatch C.
Definition main.c:113
@ k_wd_col_cover_a
Cover swatch A.
Definition main.c:111
@ k_wd_col_cover_d
Cover swatch D.
Definition main.c:114
@ k_wd_col_cover_b
Cover swatch B.
Definition main.c:112
@ k_wd_pct_dune
"Dune" read progress, percent.
Definition main.c:177
@ k_wd_pct_solaris
"Solaris" read progress, percent.
Definition main.c:179
@ k_wd_pct_1984
"1984" read progress, percent.
Definition main.c:178
@ k_wd_pct_neuromancer
"Neuromancer" read progress, percent.
Definition main.c:180

The four book records shown in the grid.

Definition at line 184 of file main.c.

◆ s_clock

char s_clock[k_wd_clock_len] = "0"
static

Status-bar right-side clock string (advances each partial flush).

Definition at line 167 of file main.c.

◆ s_clock_val

uint32_t s_clock_val = 0U
static

Monotonic clock counter shown in the status bar.

Definition at line 170 of file main.c.

Referenced by wd_check_partial(), wd_clock_fmt(), and wd_tick_live().

◆ s_display

display_handle_t* s_display = nullptr
static

Live display handle once the GLCDC panel is up.

Definition at line 164 of file main.c.

◆ s_framebuffer

uint16_t s_framebuffer[(uint32_t) k_wd_fb_w *(uint32_t) k_wd_fb_h]
static

GLCDC-scanned render target in SRAM, AXI-burst aligned.

Since
0.1.0

Definition at line 161 of file main.c.

◆ s_grid

ra8_widget_book_grid_t s_grid
static
Initial value:
= {.paint = &k_wd_paint,
.books = s_books,
.on_open = nullptr,
.bg = (uint32_t)k_wd_col_paper,
.title_fg = (uint32_t)k_wd_col_ink,
.author_fg = (uint32_t)k_wd_col_dim,
.bar_track = (uint32_t)k_wd_col_track,
.bar_fill = (uint32_t)k_wd_col_fill,
.count = (uint16_t)k_wd_book_count,
.cols = (uint16_t)k_wd_grid_cols,
.pad = (int16_t)k_wd_pad,
.gap = (int16_t)k_wd_gap,
.label_h = (int16_t)k_wd_label_h,
.bar_h = (int16_t)k_wd_bar_h}
@ k_wd_pad
Inner text padding, pixels.
Definition main.c:86
@ k_wd_col_dim
Secondary text (gray).
Definition main.c:103
static const ra8_widget_paint_t k_wd_paint
The single paint backend the chrome widgets share.
Definition main.c:280
@ k_wd_gap
Grid gap, pixels.
Definition main.c:90
@ k_wd_label_h
Card title / author row height.
Definition main.c:91
@ k_wd_bar_h
Card progress-bar height.
Definition main.c:92
@ k_wd_col_track
Progress track.
Definition main.c:115
@ k_wd_col_ink
Primary ink.
Definition main.c:108
@ k_wd_col_fill
Progress fill (amber).
Definition main.c:116
@ k_wd_col_paper
Grid / page background.
Definition main.c:103
@ k_wd_grid_cols
Grid columns.
Definition main.c:142
@ k_wd_book_count
Book records in the grid.
Definition main.c:141
static const ra8_widget_book_t s_books[k_wd_book_count]
The four book records shown in the grid.
Definition main.c:184

Definition at line 315 of file main.c.

Referenced by wd_build_tree().

◆ s_nav

ra8_widget_nav_bar_t s_nav
static
Initial value:
= {.paint = &k_wd_paint,
.items = s_nav_items,
.on_select = nullptr,
.bg = (uint32_t)k_wd_col_nav,
.fg_active = (uint32_t)k_wd_col_white,
.fg_muted = (uint32_t)k_wd_col_dim,
.count = 3U,
.active = 0U}
@ k_wd_col_white
White text.
Definition main.c:110
@ k_wd_col_nav
Nav-strip fill.
Definition main.c:117
static const char *const s_nav_items[]
Nav-strip destinations.
Definition main.c:204

Definition at line 336 of file main.c.

◆ s_nav_items

const char* const s_nav_items[] = {"Library", "Store", "Settings"}
static

Nav-strip destinations.

Definition at line 204 of file main.c.

◆ s_prog

Initial value:
= {.paint = &k_wd_paint,
.track = (uint32_t)k_wd_col_track,
.fill = (uint32_t)k_wd_col_fill,
.value = (uint16_t)k_wd_prog_value,
.total = (uint16_t)k_wd_prog_total}
@ k_wd_prog_total
Overall progress full-scale.
Definition main.c:144
@ k_wd_prog_value
Overall progress value.
Definition main.c:143

Definition at line 330 of file main.c.

Referenced by wd_build_tree().

◆ s_root

ra8_widget_t s_root
static

The root panel widget (composed each frame).

Definition at line 359 of file main.c.

Referenced by wc_build_tree(), wc_compose(), wd_build_tree(), wd_compose(), wk_build_tree(), wk_compose(), and wk_route_touch().

◆ s_root_kids

◆ s_root_panel

ra8_widget_panel_t s_root_panel
static
Initial value:
= {.children = s_root_kids,
.box_scratch = s_root_scratch,
.count = (uint16_t)k_wd_root_n,
.box_cap = (uint16_t)k_wd_root_cap,
.gap = 0,
.pad = 0,
.reserved = 0U}
@ k_wd_root_cap
Root ra8_box scratch (count + 1).
Definition main.c:132
@ k_wd_root_n
Root child count.
Definition main.c:131
static ra8_widget_t s_root_kids[k_wd_root_n]
The five chrome bands.
Definition main.c:345
static ra8_box_t s_root_scratch[k_wd_root_cap]
Root layout scratch.
Definition main.c:346
@ k_ra8_widget_axis_col
Vertical stack (top -> bottom).
Definition ra8_widget.h:176

Root column-panel descriptor tiling the five chrome bands.

Definition at line 349 of file main.c.

Referenced by wc_build_tree(), wd_build_tree(), and wk_build_tree().

◆ s_root_scratch

ra8_box_t s_root_scratch[k_wd_root_cap]
static

Root layout scratch.

Definition at line 346 of file main.c.

◆ s_status

ra8_widget_status_bar_t s_status
static
Initial value:
= {.paint = &k_wd_paint,
.left = "widget-chrome-demo Library",
.right = s_clock,
.bg = (uint32_t)k_wd_col_status,
.fg = (uint32_t)k_wd_col_white,
.fg_right = (uint32_t)k_wd_col_dim,
.rule = (uint32_t)k_wd_col_rule,
.pad = (int16_t)k_wd_pad,
.rule_h = 1}
@ k_wd_col_status
Status-bar fill (slate).
Definition main.c:104
@ k_wd_col_rule
Hairline / border.
Definition main.c:107
static ra8_fs_clock_t s_clock
The installed calendar binding; meaningful only when s_clock_bound.

Definition at line 292 of file main.c.

Referenced by wc_build_tree(), wc_check_partial(), wc_tick_live(), and wd_build_tree().

◆ s_toolbar

ra8_widget_toolbar_t s_toolbar
static
Initial value:
= {.paint = &k_wd_paint,
.hint = "Search",
.count = "4 books",
.on_search = nullptr,
.bg = (uint32_t)k_wd_col_toolbar,
.field = (uint32_t)k_wd_col_field,
.border = (uint32_t)k_wd_col_rule,
.hint_fg = (uint32_t)k_wd_col_dim,
.count_fg = (uint32_t)k_wd_col_dim,
.pad = (int16_t)k_wd_pad,
.border_w = 1,
.count_w = (int16_t)k_wd_count_w}
@ k_wd_count_w
Toolbar count-chip width.
Definition main.c:93
@ k_wd_col_toolbar
Toolbar fill (dark).
Definition main.c:105
@ k_wd_col_field
Search-field fill.
Definition main.c:106

Definition at line 302 of file main.c.

Referenced by wd_build_tree().