ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
board_overlay.h
Go to the documentation of this file.
1
25
26#pragma once
27
28#include <stdint.h>
29
30#include "ra8_attributes.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
37typedef enum : uint32_t {
40
47
53
70
77typedef struct {
78 bool on;
79 uint16_t color;
80 const char* label;
82
90typedef struct {
92 const char* usb_state;
93 const char* uart_line;
94 uint32_t irq_total;
95 uint32_t irq0;
96 uint32_t irq1;
97 bool has_touch;
98 uint16_t touch_x;
99 uint16_t touch_y;
102 uint8_t battery_soc;
106 const char* app_name;
108 uint64_t sd_bytes;
109 uint8_t sd_fat_bits;
110 const char* sd_label;
111 /* Console window: console[0] is the newest *visible* line (the firmware ring
112 * is deeper -- see console_total -- and console_scroll says how far back this
113 * window starts). Unused rows are empty strings. */
116 uint32_t console_count;
117 uint32_t console_scroll;
118 uint32_t console_total;
120 /* Tabbed-console bar: one tab per board_console channel. console_active_ch is
121 * the channel the console body shows; the names + per-tab line counts caption
122 * the bar. Borrowed name pointers valid for the compose call only. */
131 uint32_t pc;
132 uint32_t chunks;
133 uint32_t mmio_reads;
134 uint32_t mmio_writes;
135 uint32_t uart_tx_total;
136 bool running;
138
140typedef bool (*board_overlay_fill_fn)(void* context,
141 uint16_t x,
142 uint16_t y,
143 uint16_t width,
144 uint16_t height,
145 uint16_t color);
146
148typedef struct {
149 void* context;
151 uint16_t width;
152 uint16_t height;
153 bool ok;
155
173 uint16_t panel_w,
174 const board_status_t* st);
175
187uint16_t board_overlay_sidebar_width(void);
188
201uint16_t board_overlay_total_width(uint16_t panel_w);
202
217uint16_t board_overlay_total_height(uint16_t panel_h);
218
240void board_overlay_compose(uint16_t* out,
241 const uint16_t* panel,
242 uint16_t panel_w,
243 uint16_t panel_h,
244 const board_status_t* st);
245
266board_overlay_btn_t board_overlay_hit_button(uint16_t x, uint16_t y, uint16_t panel_w);
267
290bool board_overlay_battery_pct_at(uint16_t x, uint16_t panel_w, uint8_t* out_pct);
291
316bool board_overlay_hit_console_tab(uint16_t x,
317 uint16_t y,
318 uint16_t panel_w,
319 uint32_t tab_count,
320 uint32_t* out_idx);
321
322#ifdef __cplusplus
323}
324#endif
board_overlay_geometry_t
Fixed composite sidebar geometry shared with checked planners.
@ k_board_overlay_min_height_px
Minimum composite height.
@ k_board_overlay_sidebar_width_px
Pixels added right of panel.
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.
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.
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.
board_overlay_btn_t
On-screen sidebar control a click landed on.
@ k_board_overlay_btn_sw2
On-screen SW2 (P008) push-button.
@ k_board_overlay_btn_console
Console panel: toggle autoscroll.
@ k_board_overlay_btn_battery
Battery slider track: set SOC.
@ k_board_overlay_btn_batt_chg
Battery CHG button: toggle charge.
@ k_board_overlay_btn_none
Click did not land on a control.
@ k_board_overlay_btn_lowpower
CORE low-power toggle button.
@ k_board_overlay_btn_sw1
On-screen SW1 (P009) push-button.
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.
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_console_t
Console-panel sizing for the board view.
@ k_overlay_console_tabs_max
Tab-bar capacity (channels = tabs).
@ k_overlay_line_cap
Max chars copied per console line.
@ k_overlay_console_rows
Console lines shown (newest at bottom).
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.
uint16_t board_overlay_total_height(uint16_t panel_h)
Total composite height for a panel of height panel_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.
board_overlay_dims_t
Number of board LED indicators shown in the status sidebar.
@ k_overlay_led_count
LED1 / LED2 / LED3 (mirrors the BSP).
Annotation-attribute framework macros for ra8-firmware.
One board LED's live state for the status sidebar.
const char * label
Short ASCII caption (e.g.
uint16_t color
RGB565 lit colour (blue / green / red).
bool on
True when the GPIO pin is driven high.
Non-owning drawing surface used by memory and raw-fd compositors.
void * context
Caller-owned sink context.
board_overlay_fill_fn fill
Clipped solid-rectangle writer.
bool ok
Sticky false after a sink write fault.
uint16_t width
Complete composite width in pixels.
uint16_t height
Complete composite height in pixels.
Live peripheral snapshot the status sidebar renders each frame.
uint16_t touch_y
Last touch Y (if any).
char console[k_overlay_console_rows][k_overlay_line_cap]
Visible lines (active tab).
const char * app_name
App / window title.
uint32_t console_ch_count
Tabs to draw (<= max).
bool battery_charging
Fuel gauge reports charge.
uint32_t irq1
IRQ1 taken count.
uint32_t mmio_writes
Modelled-peripheral MMIO writes served.
uint16_t touch_x
Last touch X (if any).
uint8_t battery_soc
Fuel-gauge SOC percent.
bool core_is_m33
Primary core is the M33.
uint32_t console_active_ch
Active tab index.
bool console_autoscroll
True = following live tail; false=paused.
board_led_status_t leds[k_overlay_led_count]
Per-LED indicator state.
uint32_t console_total
Total lines in the active channel ring.
uint32_t console_ch_count_lines[k_overlay_console_tabs_max]
Per-tab line count.
uint32_t uart_tx_total
Total UART TX bytes the firmware emitted.
uint32_t irq0
IRQ0 taken count.
uint64_t sd_bytes
SD card size in bytes (>4GB).
bool sw1_pressed
On-screen SW1 held down.
const char * uart_line
Last captured UART line.
bool sd_attached
A microSD card is attached.
uint32_t console_count
Visible lines populated (<= rows).
const char * console_ch_name[k_overlay_console_tabs_max]
Per-tab caption.
const char * sd_label
SD volume label (–sd-new).
bool low_power
Low-power (M33 4:1 clock) on.
uint32_t console_scroll
Lines scrolled back from newest (0=live).
uint8_t sd_fat_bits
12/16/32 if –sd-new, else 0.
uint32_t chunks
Emulation chunks run so far.
bool running
True while the run loop is live (not parked).
uint32_t pc
Current emulated program counter.
const char * usb_state
USB device state string.
uint32_t mmio_reads
Modelled-peripheral MMIO reads served.
bool has_touch
A touch has been drained.
bool sw2_pressed
On-screen SW2 held down.
uint32_t irq_total
Total NVIC IRQs taken.