81typedef enum : uint16_t {
97typedef enum : uint32_t {
115typedef enum : uint16_t {
134typedef enum : int32_t {
145typedef enum : uint32_t {
169static void wk_paint_fill(
void* user, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color)
177wk_paint_text(
void* user, int32_t x, int32_t y,
const char* str, uint32_t fg, uint32_t bg)
184static void wk_paint_size(
void* user,
const char* str, int32_t* out_w, int32_t* out_h)
190 *out_w = (int32_t)pw;
191 *out_h = (int32_t)ph;
211 .text =
"widget_kit_demo",
220 .text =
"label + button leaves on ra8_widget_panel",
293static const uint8_t
k_wk_msg_fchk[] =
"widget-kit-demo: FAIL selfcheck\r\n";
294static const uint8_t
k_wk_msg_pre[] =
"widget-kit-demo: dirty0=3 crc0=";
304static void wk_print(
const uint8_t* msg, uint32_t len)
314 __asm__
volatile(
"wfi");
336 for (
size_t i = 0U; i < n; i++) {
385 for (uint16_t i = 0U; i < (uint16_t)
k_wk_root_n; i++) {
401 if (
s_root.vt ==
nullptr) {
404 if (
s_root.vt->on_input ==
nullptr) {
470 .y = (uint16_t)dmg->
y,
471 .w = (uint16_t)dmg->
w,
472 .h = (uint16_t)dmg->
h};
557 return (*crc0 != *crc1);
568 uint32_t cpuclk0_hz = 0U;
void main(void)
Secure fallback main entry point.
static display_handle_t * s_display
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).
static ra8_widget_panel_t s_root_panel
Root column-panel descriptor tiling the five chrome bands.
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_t s_root
The root panel widget (composed each frame).
static ra8_box_t s_body_scratch[k_wc_body_cap]
Body layout scratch.
static ra8_widget_panel_t s_body_panel
Body row-panel descriptor (the nested panel).
static ra8_widget_t s_body_kids[k_wc_body_n]
[left tile, right tile].
static ra8_widget_label_t s_title
Title label: a centred heading over the slate band.
static bool wk_route_touch(int32_t x, int32_t y)
Route a synthetic touch through the root panel to a leaf widget.
static ra8_widget_button_t s_btn_b
Button B ("Next"): brown face, latches + flushes the body on tap.
wk_touch_t
Synthetic touch points used by the self-check + live loop.
@ k_wk_touch_y
Y at the body vertical centre.
@ k_wk_touch_bx
X inside button B (right half of body).
@ k_wk_touch_ax
X inside button A (left half of body).
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 const ra8_widget_paint_t k_wk_paint
The shared paint backend every leaf widget draws through.
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 ra8_widget_label_t s_footer
Footer label: a left-aligned hint line.
static bool wk_build_tree(void)
Assemble the nested widget tree; return false on a bind error.
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 bool wk_selfcheck(uint32_t *crc0, uint32_t *crc1)
Run the whole deterministic surface; return both composites' CRCs.
static const display_cfg_t k_wk_display_cfg
Display PAL config: GLCDC LCD backend bound to the SRAM 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 bool wk_check_press(void)
Assert button A latches a routed touch + invalidates the body.
static const uint8_t k_wk_msg_pre[]
static void wk_invalidate_all(ra8_widget_refresh_t refresh)
Mark every root child dirty so the next compose repaints the tree.
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 uint32_t wk_framebuffer_hash(void)
FNV-1a-32 over the composited framebuffer bytes.
static void wk_print_hex(uint32_t value)
Print value as 8 uppercase hex digits.
static ra8_widget_button_t s_btn_a
Button A ("Prev"): blue face, latches + flushes the body on tap.
static uint32_t s_tick
Live-loop tick used to alternate which button is tapped.
wk_widget_idx_t
Index + action id of each widget within its parent array.
@ k_wk_w_title
Root child 0: title label (fixed).
@ k_wk_root_n
Root child count.
@ k_wk_body_n
Body child count.
@ k_wk_body_cap
Body ra8_box scratch (count + 1).
@ k_wk_root_cap
Root ra8_box scratch (count + 1).
@ k_wk_w_footer
Root child 2: footer label (fixed).
@ k_wk_w_btn_b
Body child 1: button B (flex).
@ k_wk_act_a
Button A hit-routing action id.
@ k_wk_w_body
Root child 1: nested body panel.
@ k_wk_w_btn_a
Body child 0: button A (flex).
@ k_wk_act_b
Button B hit-routing action id.
wk_color_t
0xRRGGBB palette (ra8_gfx packs to RGB565).
@ k_wk_col_text
Primary text (white).
@ k_wk_col_btn_b
Button B face, released (brown).
@ k_wk_col_btn_a_hi
Button A face, pressed (bright).
@ k_wk_col_btn_a
Button A face, released (blue).
@ k_wk_col_footer_bg
Footer-label fill (dark).
@ k_wk_col_title_bg
Title-label fill (slate).
@ k_wk_col_btn_b_hi
Button B face, pressed (warm).
@ k_wk_col_clear
Whole-frame clear (near black).
@ k_wk_col_dim
Secondary text (gray).
@ k_wk_col_btn_brd
Button outline (near black).
static bool wk_check_full(uint32_t *out_crc)
Assert the full compose: clear, 3 dirty, full-frame quality.
wk_console_t
Console baud + text-format constants.
@ k_wk_nibble_mask
Low-nibble mask.
@ k_wk_dec_ten
Decimal radix.
@ k_wk_frame_ms
Live repaint cadence (ms).
@ k_wk_hex_nibbles
Hex digits per 32-bit.
@ k_wk_uart_baud
Console baud.
@ k_wk_nibble_bits
Bits per hex nibble.
@ k_wk_fnv_offset
FNV-1a-32 offset basis.
@ k_wk_fnv_prime
FNV-1a-32 prime.
static const uint8_t k_wk_msg_fchk[]
static void wk_tick_live(void)
Alternate-tap a button and partial-flush only the body band.
static const uint8_t k_wk_msg_finit[]
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 const uint8_t k_wk_msg_mid[]
static const uint8_t k_wk_msg_fpanl[]
static void wk_print_banner(uint32_t crc0, uint32_t crc1)
Emit the PASS banner once every self-check assertion holds.
static const uint8_t k_wk_msg_ftree[]
wk_geom_t
Framebuffer + band geometry (no magic numbers).
@ k_wk_title_h
Title-label band height, pixels.
@ k_wk_pad
Inner text padding, pixels.
@ k_wk_fb_w
Framebuffer width, pixels.
@ k_wk_fb_h
Framebuffer height, pixels.
@ k_wk_btn_gap
Gap between the two body buttons.
@ k_wk_footer_h
Footer-label band height, pixels.
@ k_wk_body_h
Body band height (fb_h - title - footer).
@ k_wk_btn_border
Button outline thickness, pixels.
static void wk_fail_halt(const uint8_t *msg, uint32_t len)
Print a fail banner and park forever in WFI.
static const uint8_t k_wk_msg_boot[]
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 const uint8_t k_wk_msg_tail[]
static void wk_setup_or_halt(void)
Bring up clocks/MSTP/time and the console.
static bool wk_check_partial(uint32_t *out_crc)
Assert the partial compose: body-only damage, fast hint.
static bool wk_panel_up(void)
Bring up the GLCDC panel and bind ra8_gfx to its framebuffer.
Board-support layer for the Renesas EK-RA8D2 v1 evaluation kit.
ra8_err_t ra8_board_uart_console_write(const uint8_t *data, size_t len)
Polled blocking write to the J-Link OB VCOM console.
ra8_err_t ra8_board_uart_console_init(uint32_t baud)
Configure SCI8 + PD02/PD03 as the debug-console UART.
Boot entry points shared between a vector table and its startup code.
Bounded, allocation-free box-model layout for e-reader chrome.
High-level Clock Generation Circuit driver.
ra8_err_t ra8_cgc_get_clock_hz(ra8_clock_id_t id, uint32_t *out_hz)
Query the current frequency of a clock-tree domain.
@ k_ra8_clock_id_cpuclk0
Cortex-M85 CPUCLK0.
ra8_err_t ra8_cgc_init(void)
Configure the clock tree to a safe default.
Display Platform Abstraction Layer for the RA8D2.
@ k_display_pixfmt_rgb565
16 bpp, 5/6/5 packed.
ra8_err_t display_get_framebuffer(const display_handle_t *d, display_fb_t *out)
Return the framebuffer descriptor the backend is targeting.
ra8_err_t display_flush(const display_handle_t *d, display_rect_t rect, display_refresh_hint_t hint)
Commit pending framebuffer changes to the panel.
struct display_handle display_handle_t
ra8_err_t display_init(const display_cfg_t *cfg, display_handle_t **out_handle)
Initialise the display PAL and bring the selected backend up to a state where display_flush succeeds.
display_refresh_hint_t
Intent passed into display_flush; backends map this onto whatever waveform/mode their controller offe...
@ k_display_refresh_fast
Prioritise latency.
@ k_display_refresh_quality
Prioritise final quality.
LCD backend (ra8_glcdc) for the display PAL.
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.
Error Code Definitions for ra8-firmware.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Software 2D graphics primitives layered on top of a caller-ownedframebuffer (DRW / D/AVE 2D / GLCDC r...
@ k_ra8_gfx_format_rgb565
16-bit RGB565, little-endian in memory.
ra8_err_t ra8_gfx_clear(uint32_t color)
Fill the bound framebuffer's clip region with a single colour.
ra8_err_t ra8_gfx_text_size(const char *str, const ra8_gfx_font_t *font, uint32_t *out_w, uint32_t *out_h)
Compute rendered pixel dimensions of a string.
ra8_err_t ra8_gfx_text_out(int32_t x, int32_t y, const char *str, const ra8_gfx_font_t *font, uint32_t fg_color, uint32_t bg_color)
Render a NUL-terminated ASCII string.
ra8_err_t ra8_gfx_init(void *fb, uint16_t width, uint16_t height, ra8_gfx_format_t format)
Bind ra8_gfx to a caller-owned framebuffer.
ra8_err_t ra8_gfx_rect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color, bool filled)
Draw an axis-aligned rectangle.
Bitmap font descriptor + bundled font handles for ra8_gfx.
const ra8_gfx_font_t ra8_gfx_font_8x16
Bundled 8x16 IBM PC VGA bitmap font, ASCII 0x20..0x7E.
Graphics LCD Controller driver (two-layer with alpha blending).
NVIC + ICU IELSR allocator.
void ra8_isr_globals_enable(void)
Globally enable maskable interrupts (PRIMASK = 0).
Ref-counted Module Stop Control wrapper for the RA8D2.
ra8_err_t ra8_mstp_init(void)
Re-establish the ra8_mstp ref-count table from current hardware state.
Active display-panel descriptor for the EK-RA8D2 (ER-TFT070-6).
@ k_ra8_board_fb_align_bytes
GLCDC AXI burst alignment, in bytes.
EK-RA8D2 panel timing as the HAL's ra8_glcdc_timing_t (ER-TFT070-6).
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.
SysTick-based tick counter, delay and timestamp helpers.
ra8_err_t ra8_time_init(uint32_t cpu_hz)
Initialise SysTick for a 1 kHz tick interrupt.
void ra8_delay_ms(uint32_t ms)
Busy-wait for at least ms milliseconds.
Bounded UI interaction core: hit-testing, screen stack, paging.
Configuration descriptor passed into display_init.
Framebuffer descriptor returned by display_get_framebuffer.
void * pixels
Base of pixel data (RGB565 unless noted).
Rectangle in framebuffer coordinates passed into display_flush.
One node in a box tree (caller-owned).
Axis-aligned rectangle in framebuffer pixel coordinates.
int32_t w
Width (pixels, >= 0).
int32_t h
Height (pixels, >= 0).
int32_t x
Left edge (pixels).
int32_t y
Top edge (pixels).