Embedded SDK
Embedded SDK
ux_layout_pbn.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 "ux_layout_common.h"
21 
22 #ifdef HAVE_UX_FLOW
23 
24 const bagl_element_t *ux_layout_pbn_prepro(const bagl_element_t *element)
25 {
26  const bagl_element_t *e = ux_layout_pbb_prepro(element);
27  if (e && G_ux.tmp_element.component.userid == 0x11) {
28  // The centering depends on the target.
29 #if (BAGL_WIDTH == 128 && BAGL_HEIGHT == 64)
30  G_ux.tmp_element.component.font_id
31  = BAGL_FONT_OPEN_SANS_REGULAR_11px | BAGL_FONT_ALIGNMENT_CENTER;
32 #elif (BAGL_WIDTH == 128 && BAGL_HEIGHT == 32)
33  G_ux.tmp_element.component.font_id = BAGL_FONT_OPEN_SANS_REGULAR_11px;
34 #else
35 #error "BAGL_WIDTH/BAGL_HEIGHT not defined"
36 #endif
37  }
38  return e;
39 }
40 
41 void ux_layout_pbn_init(unsigned int stack_slot)
42 {
43  ux_layout_pbb_init_common(stack_slot);
44  G_ux.stack[stack_slot].screen_before_element_display_callback = ux_layout_pbn_prepro;
45  ux_stack_display(stack_slot);
46 }
47 
48 #endif // HAVE_UX_FLOW
#define G_ux
Definition: ux_bagl.h:345
void ux_stack_display(unsigned int stack_slot)
Definition: ux_stack.c:331