22 #include "os_screen.h"
25 #include "os_io_seproxyhal.h"
34 for (i = 0; i < ARRAYLEN(
G_ux.stack) && i <
G_ux.stack_count; i++) {
36 if (
G_ux.stack[i].element_arrays[j].element_array == element_array) {
48 if (
G_ux.stack_count < ARRAYLEN(
G_ux.stack)) {
49 memset(&
G_ux.stack[
G_ux.stack_count], 0,
sizeof(
G_ux.stack[0]));
51 memset(&
G_ux.flow_stack[
G_ux.stack_count], 0,
sizeof(
G_ux.flow_stack[0]));
56 return G_ux.stack_count - 1;
61 unsigned int exit_code = BOLOS_UX_OK;
63 if (
G_ux.stack_count > 0) {
66 exit_code =
G_ux.stack[
G_ux.stack_count].exit_code_after_elements_displayed;
68 memset(&
G_ux.stack[
G_ux.stack_count], 0,
sizeof(
G_ux.stack[0]));
70 memset(&
G_ux.flow_stack[
G_ux.stack_count], 0,
sizeof(
G_ux.flow_stack[0]));
76 if (
G_ux.stack_count == 0) {
77 G_ux.exit_code = exit_code;
83 G_ux.stack[
G_ux.stack_count - 1].element_index = 0;
86 return G_ux.stack_count - 1;
99 if (
G_ux.stack_count > 0 &&
G_ux.stack_count <= ARRAYLEN(
G_ux.stack)) {
100 G_ux.stack[
G_ux.stack_count - 1].element_index = 0;
104 else if (
G_ux.stack_count == 0) {
105 if (
G_ux.exit_code == BOLOS_UX_OK) {
106 G_ux.exit_code = BOLOS_UX_REDRAW;
113 if (stack_slot >= ARRAYLEN(
G_ux.stack)) {
117 if (
G_ux.stack_count < ARRAYLEN(
G_ux.stack)) {
119 if (stack_slot != ARRAYLEN(
G_ux.stack) - 1) {
120 memmove(&
G_ux.stack[stack_slot + 1],
121 &
G_ux.stack[stack_slot],
122 (ARRAYLEN(
G_ux.stack) - (stack_slot + 1)) *
sizeof(
G_ux.stack[0]));
124 memmove(&
G_ux.flow_stack[stack_slot + 1],
125 &
G_ux.flow_stack[stack_slot],
126 (ARRAYLEN(
G_ux.flow_stack) - (stack_slot + 1)) *
sizeof(
G_ux.flow_stack[0]));
142 if (stack_slot > ARRAYLEN(
G_ux.stack) - 1) {
143 stack_slot = ARRAYLEN(
G_ux.stack) - 1;
147 if (stack_slot >=
G_ux.stack_count) {
154 if (stack_slot != ARRAYLEN(
G_ux.stack) - 1) {
155 memmove(&
G_ux.stack[stack_slot],
156 &
G_ux.stack[stack_slot + 1],
157 (ARRAYLEN(
G_ux.stack) - (stack_slot + 1)) *
sizeof(
G_ux.stack[0]));
160 memmove(&
G_ux.flow_stack[stack_slot],
161 &
G_ux.flow_stack[stack_slot + 1],
162 (ARRAYLEN(
G_ux.flow_stack) - (stack_slot + 1)) *
sizeof(
G_ux.flow_stack[0]));
174 io_seproxyhal_init_ux();
185 #ifdef HAVE_UX_STACK_INIT_KEEP_TICKER
187 unsigned int ticker_value =
G_ux.stack[stack_slot].ticker_value;
188 unsigned int ticker_interval =
G_ux.stack[stack_slot].ticker_interval;
192 memset(&
G_ux.stack[stack_slot], 0,
sizeof(
G_ux.stack[0]));
194 #ifdef HAVE_UX_STACK_INIT_KEEP_TICKER
195 G_ux.stack[stack_slot].ticker_callback = ticker_callback;
196 G_ux.stack[stack_slot].ticker_value = ticker_value;
197 G_ux.stack[stack_slot].ticker_interval = ticker_interval;
201 G_ux.stack[stack_slot].exit_code_after_elements_displayed = BOLOS_UX_CONTINUE;
209 if (
G_ux.stack_count) {
210 if (
G_ux.stack[
G_ux.stack_count - 1].screen_before_element_display_callback) {
211 el =
G_ux.stack[
G_ux.stack_count - 1].screen_before_element_display_callback(element);
216 if ((
unsigned int) el != 1) {
225 #ifdef HAVE_SE_SCREEN
228 unsigned int elem_idx;
229 unsigned int total_element_count;
233 total_element_count = 0;
236 if ((os_perso_isonboarded() != BOLOS_UX_OK || os_global_pin_is_validated() == BOLOS_UX_OK))
245 while (elem_idx < slot->element_arrays[i].element_array_count) {
256 G_ux.exit_code != BOLOS_UX_CONTINUE) {
262 if ((
unsigned int) el != 1) {
280 if (slot->displayed_callback) {
283 if (!slot->displayed_callback(0)) {
285 G_ux.exit_code = BOLOS_UX_CONTINUE;
295 #ifndef HAVE_SE_SCREEN
299 #if UX_STACK_SLOT_ARRAY_COUNT == 1
300 unsigned int status = os_sched_last_status(TASK_BOLOS_UX);
301 if (status != BOLOS_UX_IGNORE && status != BOLOS_UX_CONTINUE) {
302 while (
G_ux.stack[stack_slot].element_arrays[0].element_array
303 &&
G_ux.stack[stack_slot].element_index
304 <
G_ux.stack[stack_slot].element_arrays[0].element_array_count
305 && !io_seproxyhal_spi_is_status_sent()
306 && (os_perso_isonboarded() != BOLOS_UX_OK
307 || os_global_pin_is_validated() == BOLOS_UX_OK)) {
309 = &
G_ux.stack[stack_slot]
311 .element_array[
G_ux.stack[stack_slot].element_index];
312 if (!
G_ux.stack[stack_slot].screen_before_element_display_callback
314 =
G_ux.stack[stack_slot].screen_before_element_display_callback(element))) {
315 if ((
unsigned int) element
317 element = &
G_ux.stack[stack_slot]
319 .element_array[
G_ux.stack[stack_slot].element_index];
323 G_ux.stack[stack_slot].element_index++;
334 if (
G_ux.stack_count > 0 && stack_slot + 1 ==
G_ux.stack_count) {
335 io_seproxyhal_init_ux();
338 G_ux.stack[stack_slot].element_index = 0;
339 #ifdef HAVE_SE_SCREEN
340 ux_stack_display_elements(&
G_ux.stack[stack_slot]);
347 else if (stack_slot == -1UL ||
G_ux.stack_count == 0) {
348 if (
G_ux.exit_code == BOLOS_UX_OK) {
349 G_ux.exit_code = BOLOS_UX_REDRAW;
__attribute__((section("._nbgl_fonts_"))) const
return the non-unicode font corresponding to the given font ID
unsigned char element_arrays_count
struct ux_stack_slot_s::@45 element_arrays[UX_STACK_SLOT_ARRAY_COUNT]
bolos_task_status_t exit_code_after_elements_displayed
unsigned short element_index
const bagl_element_t * element_array
unsigned char element_array_count
#define UX_STACK_SLOT_COUNT
void io_seproxyhal_display(const bagl_element_t *element)
#define UX_STACK_SLOT_ARRAY_COUNT
unsigned int(* callback_int_t)(unsigned int)
unsigned int ux_flow_relayout(void)
unsigned int ux_stack_push(void)
const bagl_element_t * ux_stack_display_element_callback(const bagl_element_t *element)
unsigned int ux_stack_is_element_array_present(const bagl_element_t *element_array)
void ux_stack_al_display_next_element(unsigned int stack_slot) __attribute__((weak))
void ux_stack_display(unsigned int stack_slot)
void ux_stack_remove(unsigned int stack_slot)
void ux_stack_insert(unsigned int stack_slot)
void ux_stack_init(unsigned int stack_slot)
void ux_stack_redisplay(void)
unsigned int ux_stack_pop(void)