27static const char*
const s_tag =
"ra8_ui";
39 return ((px >= r->
x) && (px < (r->
x + r->
w)) && (py >= r->
y) && (py < (r->
y + r->
h)));
56 for (uint16_t i = 0U; i < count; ++i) {
58 *out_action = targets[i].action_id;
74 nav->
stack[0] = root_screen;
82 if (nav->
depth == 0U) {
97 if (nav->
depth <= 1U) {
108 if (nav->
depth == 0U) {
119 if (nav->
depth == 0U) {
150 *out_changed =
false;
163 *out_changed =
false;
172 uint16_t target = page;
173 if ((p->
total > 0U) && (target > (uint16_t)(p->
total - 1U))) {
174 target = (uint16_t)(p->
total - 1U);
176 *out_changed = (target != p->
current);
static const char * s_tag
Logging / check tag.
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_no_mem
Static buffer exhausted (no dynamic memory on this project).
@ k_ra8_err_invalid_arg
Invalid function argument.
@ k_ra8_err_invalid_state
Module in wrong state for requested operation.
@ 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.
ra8_err_t ra8_ui_nav_init(ra8_ui_nav_t *nav, uint16_t root_screen)
Initialise a navigation stack with a root screen.
ra8_err_t ra8_ui_nav_push(ra8_ui_nav_t *nav, uint16_t screen)
Push a new screen onto the stack.
ra8_err_t ra8_ui_nav_replace(ra8_ui_nav_t *nav, uint16_t screen)
Replace the top screen in place (no depth change).
ra8_err_t ra8_ui_pager_init(ra8_ui_pager_t *p, uint16_t total)
Initialise a pager over total pages at page 0.
ra8_err_t ra8_ui_pager_next(ra8_ui_pager_t *p, bool *out_changed)
Advance to the next page, clamping at the last page.
ra8_err_t ra8_ui_nav_pop(ra8_ui_nav_t *nav, uint16_t *out_screen)
Pop the top screen, revealing the one beneath.
bool ra8_ui_rect_contains(const ra8_ui_rect_t *r, int32_t px, int32_t py)
Test whether a point lies inside a rectangle.
ra8_err_t ra8_ui_nav_top(const ra8_ui_nav_t *nav, uint16_t *out_screen)
Read the current (top) screen id.
ra8_err_t ra8_ui_pager_prev(ra8_ui_pager_t *p, bool *out_changed)
Step to the previous page, clamping at page 0.
ra8_err_t ra8_ui_hit_test(const ra8_ui_target_t *targets, uint16_t count, int32_t px, int32_t py, uint16_t *out_action, bool *out_hit)
Find the first tap target containing a point.
ra8_err_t ra8_ui_pager_goto(ra8_ui_pager_t *p, uint16_t page, bool *out_changed)
Jump to an absolute page, clamping into [0, total-1].
Bounded UI interaction core: hit-testing, screen stack, paging.
@ k_ra8_ui_nav_max_depth
Max screen-stack depth.
Fixed-depth screen-id stack (caller-owned).
uint8_t depth
Occupied slots (1..max).
uint16_t stack[k_ra8_ui_nav_max_depth]
Screen-id stack.
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).
One tap target: a rectangle bound to an opaque action id.