Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
ux_layout_bb.c
Go to the documentation of this file.
1
2/*******************************************************************************
3 * Ledger Nano S - Secure firmware
4 * (c) 2022 Ledger
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 ********************************************************************************/
18
19#include "ux.h"
20#include "os_utils.h"
21#include "ux_layout_common.h"
22
23#ifdef HAVE_UX_FLOW
24
25/*********************************************************************************
26 * 2 bold text lines
27 */
28
29// clang-format off
30const bagl_element_t ux_layout_bb_elements[] = {
31#if (BAGL_WIDTH==128 && BAGL_HEIGHT==64)
32 // erase
33 {{BAGL_RECTANGLE , 0x00, 0, 0, 128, 64, 0, 0, BAGL_FILL, 0x000000, 0xFFFFFF, 0, 0}, .text=NULL},
34
35 // left/right icons
36 {{BAGL_ICON , 0x01, 2, 28, 4, 7, 0, 0, 0 , 0xFFFFFF, 0x000000, 0, 0 }, .text=(const char*)&C_icon_left, },
37 {{BAGL_ICON , 0x02, 122, 28, 4, 7, 0, 0, 0 , 0xFFFFFF, 0x000000, 0, 0 }, .text=(const char*)&C_icon_right,},
38
39 {{BAGL_LABELINE , 0x10, 6, 29, 116, 32, 0, 0, 0 , 0xFFFFFF, 0x000000, BAGL_FONT_OPEN_SANS_EXTRABOLD_11px|BAGL_FONT_ALIGNMENT_CENTER, 0 }, .text=NULL},
40 {{BAGL_LABELINE , 0x11, 6, 43, 116, 32, 0, 0, 0 , 0xFFFFFF, 0x000000, BAGL_FONT_OPEN_SANS_EXTRABOLD_11px|BAGL_FONT_ALIGNMENT_CENTER, 0 }, .text=NULL},
41#elif (BAGL_WIDTH==128 && BAGL_HEIGHT==32)
42 // erase
43 {{BAGL_RECTANGLE , 0x00, 0, 0, 128, 32, 0, 0, BAGL_FILL, 0x000000, 0xFFFFFF, 0, 0}, .text=NULL},
44
45 // left/right icons
46 {{BAGL_ICON , 0x01, 2, 12, 4, 7, 0, 0, 0 , 0xFFFFFF, 0x000000, 0, 0 }, .text=(const char*)&C_icon_left},
47 {{BAGL_ICON , 0x02, 122, 12, 4, 7, 0, 0, 0 , 0xFFFFFF, 0x000000, 0, 0 }, .text=(const char*)&C_icon_right},
48
49 {{BAGL_LABELINE , 0x10, 6, 12, 116, 32, 0, 0, 0 , 0xFFFFFF, 0x000000, BAGL_FONT_OPEN_SANS_EXTRABOLD_11px|BAGL_FONT_ALIGNMENT_CENTER, 0 }, .text=NULL},
50 {{BAGL_LABELINE , 0x11, 6, 26, 116, 32, 0, 0, 0 , 0xFFFFFF, 0x000000, BAGL_FONT_OPEN_SANS_EXTRABOLD_11px|BAGL_FONT_ALIGNMENT_CENTER, 0 }, .text=NULL},
51#else
52 #error "BAGL_WIDTH/BAGL_HEIGHT not defined"
53#endif
54};
55// clang-format on
56
57void ux_layout_bb_init_common(unsigned int stack_slot)
58{
59 ux_stack_init(stack_slot);
60 G_ux.stack[stack_slot].element_arrays[0].element_array = ux_layout_bb_elements;
61 G_ux.stack[stack_slot].element_arrays[0].element_array_count = ARRAYLEN(ux_layout_bb_elements);
62 G_ux.stack[stack_slot].element_arrays_count = 1;
63 G_ux.stack[stack_slot].button_push_callback = ux_flow_button_callback;
64}
65
66void ux_layout_bb_init(unsigned int stack_slot)
67{
68 ux_layout_bb_init_common(stack_slot);
69 G_ux.stack[stack_slot].screen_before_element_display_callback = ux_layout_strings_prepro;
70 ux_stack_display(stack_slot);
71}
72
73#endif // HAVE_UX_FLOW
const char * text
Definition ux_bagl.h:68
#define G_ux
Definition ux_bagl.h:345
void ux_stack_display(unsigned int stack_slot)
Definition ux_stack.c:331
const bagl_element_t * ux_layout_strings_prepro(const bagl_element_t *element)
void ux_stack_init(unsigned int stack_slot)
Definition ux_stack.c:171
unsigned int ux_flow_button_callback(unsigned int button_mask, unsigned int button_mask_counter)