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

A bounded back-stack of app ids layered over a registry (zero-heap). More...

#include <ra8_app.h>

Collaboration diagram for ra8_app_nav_t:

Data Fields

ra8_app_registry_treg
 Registry the navigation drives (non-NULL).
uint16_t * stack
 Caller storage: back-stack of app ids.
uint16_t cap
 Capacity of stack.
uint16_t depth
 Number of ids currently on the back-stack.

Detailed Description

A bounded back-stack of app ids layered over a registry (zero-heap).

The registry tracks only the currently focused app. A chrome/shell that lets the user drill in (library -> reader -> settings) and then press "back" needs the trail it came from. ra8_app_nav_t is that trail: ra8_app_nav_go focuses an app and remembers the one it left, and ra8_app_nav_back returns to the most recently remembered app. The history is a caller-owned uint16_t array of app ids – nothing is allocated (NASA Rule 3). The registry's own focus lifecycle (on_leave -> on_enter) still fires under every move, so a navigation layer composes ra8_app_launch rather than reimplementing it.

Invariant
depth <= cap.
stack[0 .. depth) hold app ids the user can go back through, oldest at index 0, most recent at depth - 1.
Example:
uint16_t trail[4];
ra8_app_nav_init(&nav, &reg, trail, 4U);
ra8_app_nav_go(&nav, k_app_reader); // focus reader (trail empty)
ra8_app_nav_go(&nav, k_app_settings); // focus settings (reader pushed)
bool popped = false;
ra8_app_nav_back(&nav, &popped); // back to reader (trail empty again)
ra8_err_t ra8_app_nav_init(ra8_app_nav_t *nav, ra8_app_registry_t *reg, uint16_t *storage, uint16_t cap)
Bind a navigation back-stack to a registry + caller-owned storage.
Definition ra8_app.c:186
ra8_err_t ra8_app_nav_back(ra8_app_nav_t *nav, bool *out_popped)
Return to the most recently pushed app (pop the back-stack).
Definition ra8_app.c:251
ra8_err_t ra8_app_nav_go(ra8_app_nav_t *nav, uint16_t id)
Focus app id, pushing the outgoing app onto the back-stack.
Definition ra8_app.c:201
A bounded back-stack of app ids layered over a registry (zero-heap).
Definition ra8_app.h:485
ra8_app_registry_t * reg
Registry the navigation drives (non-NULL).
Definition ra8_app.h:486
See also
ra8_app_launch The lower-level focus switch this layer composes.
Since
0.1.0

Definition at line 485 of file ra8_app.h.

Field Documentation

◆ cap

uint16_t ra8_app_nav_t::cap

Capacity of stack.

Definition at line 488 of file ra8_app.h.

Referenced by ra8_app_nav_go(), and ra8_app_nav_init().

◆ depth

uint16_t ra8_app_nav_t::depth

Number of ids currently on the back-stack.

Definition at line 489 of file ra8_app.h.

Referenced by ra8_app_nav_back(), ra8_app_nav_depth(), ra8_app_nav_go(), and ra8_app_nav_init().

◆ reg

ra8_app_registry_t* ra8_app_nav_t::reg

Registry the navigation drives (non-NULL).

Definition at line 486 of file ra8_app.h.

Referenced by ra8_app_nav_back(), ra8_app_nav_go(), ra8_app_nav_go_index(), and ra8_app_nav_init().

◆ stack

uint16_t* ra8_app_nav_t::stack

Caller storage: back-stack of app ids.

Definition at line 487 of file ra8_app.h.

Referenced by ra8_app_nav_back(), ra8_app_nav_go(), and ra8_app_nav_init().


The documentation for this struct was generated from the following file: