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

Concrete ra8_widget leaf widgets composited on the GLCDC panel (#145). 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 dependency graph for main.c:

Go to the source code of this file.

Enumerations

enum  wk_geom_t : uint16_t {
  k_wk_fb_w = 512U ,
  k_wk_fb_h = 512U ,
  k_wk_title_h = 44U ,
  k_wk_footer_h = 28U ,
  k_wk_body_h = 440U ,
  k_wk_pad = 6U ,
  k_wk_btn_gap = 8U ,
  k_wk_btn_border = 2U
}
 Framebuffer + band geometry (no magic numbers). More...
enum  wk_color_t : uint32_t {
  k_wk_col_clear = 0x000010U ,
  k_wk_col_title_bg = 0x182438U ,
  k_wk_col_footer_bg = 0x101018U ,
  k_wk_col_text = 0xFFFFFFU ,
  k_wk_col_dim = 0xA8A8B8U ,
  k_wk_col_btn_a = 0x204060U ,
  k_wk_col_btn_a_hi = 0x3A6CB0U ,
  k_wk_col_btn_b = 0x603020U ,
  k_wk_col_btn_b_hi = 0xB06030U ,
  k_wk_col_btn_brd = 0x05080CU
}
 0xRRGGBB palette (ra8_gfx packs to RGB565). More...
enum  wk_widget_idx_t : uint16_t {
  k_wk_w_title = 0U ,
  k_wk_w_body = 1U ,
  k_wk_w_footer = 2U ,
  k_wk_root_n = 3U ,
  k_wk_root_cap = 4U ,
  k_wk_w_btn_a = 0U ,
  k_wk_w_btn_b = 1U ,
  k_wk_body_n = 2U ,
  k_wk_body_cap = 3U ,
  k_wk_act_a = 10U ,
  k_wk_act_b = 11U
}
 Index + action id of each widget within its parent array. More...
enum  wk_touch_t : int32_t {
  k_wk_touch_ax = 120 ,
  k_wk_touch_bx = 392 ,
  k_wk_touch_y = 264
}
 Synthetic touch points used by the self-check + live loop. More...
enum  wk_console_t : uint32_t {
  k_wk_uart_baud = 115200U ,
  k_wk_frame_ms = 500U ,
  k_wk_fnv_offset = 2166136261U ,
  k_wk_fnv_prime = 16777619U ,
  k_wk_hex_nibbles = 8U ,
  k_wk_nibble_bits = 4U ,
  k_wk_nibble_mask = 0x0FU ,
  k_wk_dec_ten = 10U
}
 Console baud + text-format constants. More...

Functions

static void wk_paint_fill (void *user, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color)
 Paint backend fill: a solid ra8_gfx rectangle.
static void wk_paint_text (void *user, int32_t x, int32_t y, const char *str, uint32_t fg, uint32_t bg)
 Paint backend text: an 8x16 ra8_gfx string.
static void wk_paint_size (void *user, const char *str, int32_t *out_w, int32_t *out_h)
 Paint backend measure: 8x16 ra8_gfx string size (for centring).
static void wk_on_button_press (ra8_widget_t *w)
 Mark the body band dirty so a button press flushes only that rect.
static void wk_print (const uint8_t *msg, uint32_t len)
 Emit a byte run on the board console.
static void wk_fail_halt (const uint8_t *msg, uint32_t len)
 Print a fail banner and park forever in WFI.
static void wk_print_hex (uint32_t value)
 Print value as 8 uppercase hex digits.
static uint32_t wk_framebuffer_hash (void)
 FNV-1a-32 over the composited framebuffer bytes.
static bool wk_build_tree (void)
 Assemble the nested widget tree; return false on a bind error.
static void wk_invalidate_all (ra8_widget_refresh_t refresh)
 Mark every root child dirty so the next compose repaints the tree.
static ra8_err_t wk_compose (ra8_ui_rect_t *dmg, ra8_widget_refresh_t *hint, uint16_t *dirty)
 Compose the tree into the framebuffer; report the flush rect.
static bool wk_route_touch (int32_t x, int32_t y)
 Route a synthetic touch through the root panel to a leaf widget.
static bool wk_panel_up (void)
 Bring up the GLCDC panel and bind ra8_gfx to its framebuffer.
static display_refresh_hint_t wk_map_hint (ra8_widget_refresh_t hint)
 Map a widget refresh hint to the display PAL refresh hint.
static void wk_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 wk_check_full (uint32_t *out_crc)
 Assert the full compose: clear, 3 dirty, full-frame quality.
static bool wk_check_press (void)
 Assert button A latches a routed touch + invalidates the body.
static bool wk_check_partial (uint32_t *out_crc)
 Assert the partial compose: body-only damage, fast hint.
static bool wk_selfcheck (uint32_t *crc0, uint32_t *crc1)
 Run the whole deterministic surface; return both composites' CRCs.
static void wk_setup_or_halt (void)
 Bring up clocks/MSTP/time and the console.
static void wk_print_banner (uint32_t crc0, uint32_t crc1)
 Emit the PASS banner once every self-check assertion holds.
static void wk_tick_live (void)
 Alternate-tap a button and partial-flush only the body band.
void main (void)
 App entry: bring the panel up, self-check, then run the live loop.

Variables

static uint16_t s_framebuffer [(uint32_t) k_wk_fb_w *(uint32_t) k_wk_fb_h]
 GLCDC-scanned render target in SRAM, AXI-burst aligned.
static const ra8_widget_paint_t k_wk_paint
 The shared paint backend every leaf widget draws through.
static ra8_widget_label_t s_title
 Title label: a centred heading over the slate band.
static ra8_widget_label_t s_footer
 Footer label: a left-aligned hint line.
static ra8_widget_button_t s_btn_a
 Button A ("Prev"): blue face, latches + flushes the body on tap.
static ra8_widget_button_t s_btn_b
 Button B ("Next"): brown face, latches + flushes the body on tap.
static ra8_widget_t s_root_kids [k_wk_root_n]
 [title, body, footer].
static ra8_widget_t s_body_kids [k_wk_body_n]
 [button A, button B].
static ra8_box_t s_body_scratch [k_wk_body_cap]
 Body layout scratch.
static ra8_box_t s_root_scratch [k_wk_root_cap]
 Root layout scratch.
static ra8_widget_panel_t s_body_panel
 Body row-panel descriptor (the nested panel of buttons).
static ra8_widget_panel_t s_root_panel
 Root column-panel descriptor.
static ra8_widget_t s_root
 The root panel widget (composed each frame).
static display_handle_ts_display = nullptr
 Live display handle once the GLCDC panel is up.
static uint32_t s_tick = 0U
 Live-loop tick used to alternate which button is tapped.
static const uint8_t k_wk_msg_boot [] = "widget-kit-demo: boot\r\n"
static const uint8_t k_wk_msg_finit [] = "widget-kit-demo: FAIL init\r\n"
static const uint8_t k_wk_msg_fpanl [] = "widget-kit-demo: FAIL panel\r\n"
static const uint8_t k_wk_msg_ftree [] = "widget-kit-demo: FAIL tree\r\n"
static const uint8_t k_wk_msg_fchk [] = "widget-kit-demo: FAIL selfcheck\r\n"
static const uint8_t k_wk_msg_pre [] = "widget-kit-demo: dirty0=3 crc0="
static const uint8_t k_wk_msg_mid [] = " press=1 dirty1=1 crc1="
static const uint8_t k_wk_msg_tail [] = " flush=512x440 hint=fast PASS\r\n"
static const display_cfg_t k_wk_display_cfg
 Display PAL config: GLCDC LCD backend bound to the SRAM framebuffer.

Detailed Description

Concrete ra8_widget leaf widgets composited on the GLCDC panel (#145).

widget_compose_demo proved the ra8_widget_panel compositor with anonymous tile leaves. This app is the Phase-2 demonstration of the concrete leaf widgets the panel can now composite: ra8_widget_label_t (a background fill plus aligned text) and ra8_widget_button_t (a bordered face + label that latches on a tap and reports the press through on_input). Both draw through an injected ra8_widget_paint_t backend wired to ra8_gfx, so ra8_widget itself stays graphics free.

The tree (dwm-style, each piece opt-in):

root (column panel) |- title (LABEL, fixed) – centred heading |- body (ROW PANEL) – a nested panel ... | |- button A (BUTTON, flex) – "Prev" | |- button B (BUTTON, flex) – "Next" |- footer (LABEL, fixed) – a left-aligned hint line

One ra8_widget_panel_compose call lays the children out, computes the minimal damage rect + refresh hint, and renders only the dirty children – a dirty nested panel repaints its whole subtree.

A deterministic self-check runs before the live loop:

  • Full compose: clear, mark the whole tree dirty -> 3 dirty root children, damage covers the full 512x512 frame, quality hint; the label and button leaves all paint (a stable composite CRC).
  • Press: a synthetic touch routed through the root panel lands on button A, which latches (presses == 1, pressed == true) and – via its on_press callback – invalidates only the body band.
  • Partial compose: exactly 1 dirty root child (the body), damage is just the 512x440 body rect with the fast hint, and the composite CRC changes (button A now shows its pressed face). This is the issue #145 partial-flush acceptance, driven by the concrete button widget.

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

widget-kit-demo: dirty0=3 crc0=<8hex> press=1 dirty1=1 crc1=<8hex> flush=512x440 hint=fast PASS

Any failed assertion prints FAIL ... and parks. After the banner the loop alternately taps button A / button B and partial-composes the body band, so the panel visibly toggles a button live (the damage-tracked A2 path).

[Ring 6 / APP] {World: S}

Since
0.1.0

Definition in file main.c.

Enumeration Type Documentation

◆ wk_color_t

enum wk_color_t : uint32_t

0xRRGGBB palette (ra8_gfx packs to RGB565).

Since
0.1.0
Enumerator
k_wk_col_clear 

Whole-frame clear (near black).

k_wk_col_title_bg 

Title-label fill (slate).

k_wk_col_footer_bg 

Footer-label fill (dark).

k_wk_col_text 

Primary text (white).

k_wk_col_dim 

Secondary text (gray).

k_wk_col_btn_a 

Button A face, released (blue).

k_wk_col_btn_a_hi 

Button A face, pressed (bright).

k_wk_col_btn_b 

Button B face, released (brown).

k_wk_col_btn_b_hi 

Button B face, pressed (warm).

k_wk_col_btn_brd 

Button outline (near black).

Definition at line 97 of file main.c.

◆ wk_console_t

enum wk_console_t : uint32_t

Console baud + text-format constants.

Since
0.1.0
Enumerator
k_wk_uart_baud 

Console baud.

k_wk_frame_ms 

Live repaint cadence (ms).

k_wk_fnv_offset 

FNV-1a-32 offset basis.

k_wk_fnv_prime 

FNV-1a-32 prime.

k_wk_hex_nibbles 

Hex digits per 32-bit.

k_wk_nibble_bits 

Bits per hex nibble.

k_wk_nibble_mask 

Low-nibble mask.

k_wk_dec_ten 

Decimal radix.

Definition at line 145 of file main.c.

◆ wk_geom_t

enum wk_geom_t : uint16_t

Framebuffer + band geometry (no magic numbers).

Since
0.1.0
Enumerator
k_wk_fb_w 

Framebuffer width, pixels.

k_wk_fb_h 

Framebuffer height, pixels.

k_wk_title_h 

Title-label band height, pixels.

k_wk_footer_h 

Footer-label band height, pixels.

k_wk_body_h 

Body band height (fb_h - title - footer).

k_wk_pad 

Inner text padding, pixels.

k_wk_btn_gap 

Gap between the two body buttons.

k_wk_btn_border 

Button outline thickness, pixels.

Definition at line 81 of file main.c.

◆ wk_touch_t

enum wk_touch_t : int32_t

Synthetic touch points used by the self-check + live loop.

Since
0.1.0
Enumerator
k_wk_touch_ax 

X inside button A (left half of body).

k_wk_touch_bx 

X inside button B (right half of body).

k_wk_touch_y 

Y at the body vertical centre.

Definition at line 134 of file main.c.

◆ wk_widget_idx_t

enum wk_widget_idx_t : uint16_t

Index + action id of each widget within its parent array.

Since
0.1.0
Enumerator
k_wk_w_title 

Root child 0: title label (fixed).

k_wk_w_body 

Root child 1: nested body panel.

k_wk_w_footer 

Root child 2: footer label (fixed).

k_wk_root_n 

Root child count.

k_wk_root_cap 

Root ra8_box scratch (count + 1).

k_wk_w_btn_a 

Body child 0: button A (flex).

k_wk_w_btn_b 

Body child 1: button B (flex).

k_wk_body_n 

Body child count.

k_wk_body_cap 

Body ra8_box scratch (count + 1).

k_wk_act_a 

Button A hit-routing action id.

k_wk_act_b 

Button B hit-routing action id.

Definition at line 115 of file main.c.

Function Documentation

◆ main()

void main ( void )

App entry: bring the panel up, self-check, then 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 widget kit; the loop alternately taps a button and partial-flushes the body band so the panel updates a button live (the damage-tracked path).
Since
0.1.0

Definition at line 617 of file main.c.

References k_ra8_ok, k_ra8_widget_refresh_none, k_ra8_widget_refresh_quality, k_wk_col_clear, k_wk_frame_ms, k_wk_msg_boot, k_wk_msg_fchk, k_wk_msg_fpanl, k_wk_msg_ftree, ra8_delay_ms(), ra8_gfx_clear(), ra8_isr_globals_enable(), wk_build_tree(), wk_compose(), wk_fail_halt(), wk_flush_rect(), wk_invalidate_all(), wk_panel_up(), wk_print(), wk_print_banner(), wk_selfcheck(), wk_setup_or_halt(), and wk_tick_live().

◆ wk_build_tree()

bool wk_build_tree ( void )
static

◆ wk_check_full()

bool wk_check_full ( uint32_t * out_crc)
static

◆ wk_check_partial()

bool wk_check_partial ( uint32_t * out_crc)
static

Assert the partial compose: body-only damage, fast hint.

Definition at line 521 of file main.c.

References ra8_ui_rect_t::h, k_ra8_ok, k_ra8_widget_refresh_fast, k_ra8_widget_refresh_none, k_wk_body_h, k_wk_title_h, wk_compose(), wk_framebuffer_hash(), and ra8_ui_rect_t::y.

Referenced by wk_selfcheck().

◆ wk_check_press()

bool wk_check_press ( void )
static

Assert button A latches a routed touch + invalidates the body.

Definition at line 509 of file main.c.

References k_wk_touch_ax, k_wk_touch_y, s_btn_a, and wk_route_touch().

Referenced by wk_selfcheck().

◆ wk_compose()

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

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

Definition at line 391 of file main.c.

References k_wk_fb_h, k_wk_fb_w, ra8_widget_panel_compose(), and s_root.

Referenced by main(), wk_check_full(), wk_check_partial(), and wk_tick_live().

◆ wk_fail_halt()

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

Print a fail banner and park forever in WFI.

Definition at line 310 of file main.c.

References wk_print().

Referenced by main(), and wk_setup_or_halt().

◆ wk_flush_rect()

void wk_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 458 of file main.c.

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

Referenced by main(), and wk_tick_live().

◆ wk_framebuffer_hash()

uint32_t wk_framebuffer_hash ( void )
static

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

Definition at line 331 of file main.c.

References k_wk_fnv_offset, k_wk_fnv_prime, and s_framebuffer.

Referenced by wk_check_full(), and wk_check_partial().

◆ wk_invalidate_all()

void wk_invalidate_all ( ra8_widget_refresh_t refresh)
static

Mark every root child dirty so the next compose repaints the tree.

Definition at line 383 of file main.c.

References k_wk_root_n, ra8_widget_invalidate(), and s_root_kids.

Referenced by main(), and wk_check_full().

◆ wk_map_hint()

display_refresh_hint_t wk_map_hint ( ra8_widget_refresh_t hint)
static

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

Definition at line 449 of file main.c.

References k_display_refresh_fast, k_display_refresh_quality, and k_ra8_widget_refresh_fast.

Referenced by wk_flush_rect().

◆ wk_on_button_press()

void wk_on_button_press ( ra8_widget_t * w)
static

Mark the body band dirty so a button press flushes only that rect.

Definition at line 348 of file main.c.

References k_ra8_widget_refresh_fast, k_wk_w_body, ra8_widget_invalidate(), and s_root_kids.

◆ wk_paint_fill()

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

Paint backend fill: a solid ra8_gfx rectangle.

Definition at line 169 of file main.c.

References ra8_gfx_rect().

◆ wk_paint_size()

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

Paint backend measure: 8x16 ra8_gfx string size (for centring).

Definition at line 184 of file main.c.

References ra8_gfx_font_8x16, and ra8_gfx_text_size().

◆ wk_paint_text()

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

Paint backend text: an 8x16 ra8_gfx string.

Definition at line 177 of file main.c.

References ra8_gfx_font_8x16, and ra8_gfx_text_out().

◆ wk_panel_up()

bool wk_panel_up ( void )
static

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

Definition at line 427 of file main.c.

References display_get_framebuffer(), display_init(), k_ra8_gfx_format_rgb565, k_ra8_ok, k_wk_display_cfg, k_wk_fb_h, k_wk_fb_w, display_fb_t::pixels, ra8_gfx_init(), s_display, and s_framebuffer.

Referenced by main().

◆ wk_print()

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

Emit a byte run on the board console.

Definition at line 304 of file main.c.

References ra8_board_uart_console_write().

Referenced by main(), wk_fail_halt(), wk_print_banner(), and wk_print_hex().

◆ wk_print_banner()

void wk_print_banner ( uint32_t crc0,
uint32_t crc1 )
static

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

Definition at line 584 of file main.c.

References k_wk_msg_mid, k_wk_msg_pre, k_wk_msg_tail, wk_print(), and wk_print_hex().

Referenced by main().

◆ wk_print_hex()

void wk_print_hex ( uint32_t value)
static

Print value as 8 uppercase hex digits.

Definition at line 319 of file main.c.

References k_wk_dec_ten, k_wk_hex_nibbles, k_wk_nibble_bits, k_wk_nibble_mask, and wk_print().

Referenced by wk_print_banner().

◆ wk_route_touch()

bool wk_route_touch ( int32_t x,
int32_t y )
static

Route a synthetic touch through the root panel to a leaf widget.

Definition at line 398 of file main.c.

References k_ra8_widget_ev_touch, and s_root.

Referenced by wk_check_press(), and wk_tick_live().

◆ wk_selfcheck()

bool wk_selfcheck ( uint32_t * crc0,
uint32_t * crc1 )
static

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

Definition at line 546 of file main.c.

References wk_check_full(), wk_check_partial(), and wk_check_press().

Referenced by main().

◆ wk_setup_or_halt()

void wk_setup_or_halt ( void )
static

Bring up clocks/MSTP/time and the console.

Definition at line 566 of file main.c.

References k_ra8_clock_id_cpuclk0, k_ra8_ok, k_wk_msg_finit, k_wk_uart_baud, ra8_board_uart_console_init(), ra8_cgc_get_clock_hz(), ra8_cgc_init(), ra8_mstp_init(), ra8_time_init(), and wk_fail_halt().

Referenced by main().

◆ wk_tick_live()

void wk_tick_live ( void )
static

Alternate-tap a button and partial-flush only the body band.

Definition at line 594 of file main.c.

References k_ra8_ok, k_ra8_widget_refresh_none, k_wk_touch_ax, k_wk_touch_bx, k_wk_touch_y, s_tick, wk_compose(), wk_flush_rect(), and wk_route_touch().

Referenced by main().

Variable Documentation

◆ k_wk_display_cfg

const display_cfg_t k_wk_display_cfg
static
Initial value:
= {
.framebuffer = s_framebuffer,
.framebuffer_bytes = sizeof(s_framebuffer),
.width_px = (uint16_t)k_wk_fb_w,
.height_px = (uint16_t)k_wk_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_wk_fb_w
Framebuffer width, pixels.
Definition main.c:82
@ k_wk_fb_h
Framebuffer height, pixels.
Definition main.c:83
@ 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 416 of file main.c.

Referenced by wk_panel_up().

◆ k_wk_msg_boot

const uint8_t k_wk_msg_boot[] = "widget-kit-demo: boot\r\n"
static

Definition at line 289 of file main.c.

Referenced by main().

◆ k_wk_msg_fchk

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

Definition at line 293 of file main.c.

Referenced by main().

◆ k_wk_msg_finit

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

Definition at line 290 of file main.c.

Referenced by wk_setup_or_halt().

◆ k_wk_msg_fpanl

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

Definition at line 291 of file main.c.

Referenced by main().

◆ k_wk_msg_ftree

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

Definition at line 292 of file main.c.

Referenced by main().

◆ k_wk_msg_mid

const uint8_t k_wk_msg_mid[] = " press=1 dirty1=1 crc1="
static

Definition at line 295 of file main.c.

Referenced by wk_print_banner().

◆ k_wk_msg_pre

const uint8_t k_wk_msg_pre[] = "widget-kit-demo: dirty0=3 crc0="
static

Definition at line 294 of file main.c.

Referenced by wk_print_banner().

◆ k_wk_msg_tail

const uint8_t k_wk_msg_tail[] = " flush=512x440 hint=fast PASS\r\n"
static

Definition at line 296 of file main.c.

Referenced by wk_print_banner().

◆ k_wk_paint

const ra8_widget_paint_t k_wk_paint
static
Initial value:
= {
.user = nullptr,
.fill_rect = wk_paint_fill,
.draw_text = wk_paint_text,
.text_size = wk_paint_size,
}
static void wk_paint_fill(void *user, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color)
Paint backend fill: a solid ra8_gfx rectangle.
Definition main.c:169
static void wk_paint_text(void *user, int32_t x, int32_t y, const char *str, uint32_t fg, uint32_t bg)
Paint backend text: an 8x16 ra8_gfx string.
Definition main.c:177
static void wk_paint_size(void *user, const char *str, int32_t *out_w, int32_t *out_h)
Paint backend measure: 8x16 ra8_gfx string size (for centring).
Definition main.c:184

The shared paint backend every leaf widget draws through.

Definition at line 195 of file main.c.

◆ s_body_kids

ra8_widget_t s_body_kids[k_wk_body_n]
static

[button A, button B].

Definition at line 258 of file main.c.

◆ s_body_panel

ra8_widget_panel_t s_body_panel
static
Initial value:
= {.children = s_body_kids,
.box_scratch = s_body_scratch,
.count = (uint16_t)k_wk_body_n,
.box_cap = (uint16_t)k_wk_body_cap,
.gap = (int16_t)k_wk_btn_gap,
.pad = 0,
.reserved = 0U}
static ra8_box_t s_body_scratch[k_wc_body_cap]
Body layout scratch.
Definition main.c:173
static ra8_widget_t s_body_kids[k_wc_body_n]
[left tile, right tile].
Definition main.c:172
@ k_wk_body_n
Body child count.
Definition main.c:123
@ k_wk_body_cap
Body ra8_box scratch (count + 1).
Definition main.c:124
@ k_wk_btn_gap
Gap between the two body buttons.
Definition main.c:88
@ k_ra8_widget_axis_row
Horizontal stack (left -> right).
Definition ra8_widget.h:177

Body row-panel descriptor (the nested panel of buttons).

Definition at line 263 of file main.c.

◆ s_body_scratch

ra8_box_t s_body_scratch[k_wk_body_cap]
static

Body layout scratch.

Definition at line 259 of file main.c.

◆ s_btn_a

ra8_widget_button_t s_btn_a
static
Initial value:
= {.paint = &k_wk_paint,
.text = "Prev",
.on_press = wk_on_button_press,
.fg = (uint32_t)k_wk_col_text,
.face = (uint32_t)k_wk_col_btn_a,
.face_pressed = (uint32_t)k_wk_col_btn_a_hi,
.border = (uint32_t)k_wk_col_btn_brd,
.presses = 0U,
.pad = (int16_t)k_wk_pad,
.border_w = (int16_t)k_wk_btn_border,
.pressed = false,
.reserved = 0U}
static const ra8_widget_paint_t k_wk_paint
The shared paint backend every leaf widget draws through.
Definition main.c:195
@ k_wk_col_text
Primary text (white).
Definition main.c:101
@ k_wk_col_btn_a_hi
Button A face, pressed (bright).
Definition main.c:104
@ k_wk_col_btn_a
Button A face, released (blue).
Definition main.c:103
@ k_wk_col_btn_brd
Button outline (near black).
Definition main.c:107
@ k_wk_pad
Inner text padding, pixels.
Definition main.c:87
@ k_wk_btn_border
Button outline thickness, pixels.
Definition main.c:89
static void wk_on_button_press(ra8_widget_t *w)
Mark the body band dirty so a button press flushes only that rect.
Definition main.c:348
@ k_ra8_widget_align_center
Centre horizontally in the rect.
Definition ra8_widget.h:542

Button A ("Prev"): blue face, latches + flushes the body on tap.

Definition at line 228 of file main.c.

Referenced by wk_build_tree(), and wk_check_press().

◆ s_btn_b

ra8_widget_button_t s_btn_b
static
Initial value:
= {.paint = &k_wk_paint,
.text = "Next",
.on_press = wk_on_button_press,
.fg = (uint32_t)k_wk_col_text,
.face = (uint32_t)k_wk_col_btn_b,
.face_pressed = (uint32_t)k_wk_col_btn_b_hi,
.border = (uint32_t)k_wk_col_btn_brd,
.presses = 0U,
.pad = (int16_t)k_wk_pad,
.border_w = (int16_t)k_wk_btn_border,
.pressed = false,
.reserved = 0U}
@ k_wk_col_btn_b
Button B face, released (brown).
Definition main.c:105
@ k_wk_col_btn_b_hi
Button B face, pressed (warm).
Definition main.c:106

Button B ("Next"): brown face, latches + flushes the body on tap.

Definition at line 243 of file main.c.

Referenced by wk_build_tree().

◆ s_display

display_handle_t* s_display = nullptr
static

Live display handle once the GLCDC panel is up.

Definition at line 285 of file main.c.

◆ s_footer

ra8_widget_label_t s_footer
static
Initial value:
= {.paint = &k_wk_paint,
.text = "label + button leaves on ra8_widget_panel",
.fg = (uint32_t)k_wk_col_dim,
.bg = (uint32_t)k_wk_col_footer_bg,
.pad = (int16_t)k_wk_pad,
.reserved = 0U}
@ k_wk_col_footer_bg
Footer-label fill (dark).
Definition main.c:100
@ k_wk_col_dim
Secondary text (gray).
Definition main.c:102
@ k_ra8_widget_align_left
Hug the left inner inset.
Definition ra8_widget.h:541

Footer label: a left-aligned hint line.

Definition at line 219 of file main.c.

Referenced by wk_build_tree().

◆ s_framebuffer

uint16_t s_framebuffer[(uint32_t) k_wk_fb_w *(uint32_t) k_wk_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_root

ra8_widget_t s_root
static

The root panel widget (composed each frame).

Definition at line 283 of file main.c.

◆ s_root_kids

ra8_widget_t s_root_kids[k_wk_root_n]
static

[title, body, footer].

Definition at line 257 of file main.c.

◆ 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_wk_root_n,
.box_cap = (uint16_t)k_wk_root_cap,
.gap = 0,
.pad = 0,
.reserved = 0U}
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_wk_root_n
Root child count.
Definition main.c:119
@ k_wk_root_cap
Root ra8_box scratch (count + 1).
Definition main.c:120
@ k_ra8_widget_axis_col
Vertical stack (top -> bottom).
Definition ra8_widget.h:176

Root column-panel descriptor.

Definition at line 273 of file main.c.

◆ s_root_scratch

ra8_box_t s_root_scratch[k_wk_root_cap]
static

Root layout scratch.

Definition at line 260 of file main.c.

◆ s_tick

uint32_t s_tick = 0U
static

Live-loop tick used to alternate which button is tapped.

Definition at line 287 of file main.c.

Referenced by wk_tick_live().

◆ s_title

ra8_widget_label_t s_title
static
Initial value:
= {.paint = &k_wk_paint,
.text = "widget_kit_demo",
.fg = (uint32_t)k_wk_col_text,
.bg = (uint32_t)k_wk_col_title_bg,
.pad = (int16_t)k_wk_pad,
.reserved = 0U}
@ k_wk_col_title_bg
Title-label fill (slate).
Definition main.c:99

Title label: a centred heading over the slate band.

Definition at line 210 of file main.c.

Referenced by wk_build_tree().