Embedded SDK
Embedded SDK
ux_layout_pnn.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 /*********************************************************************************
25  * 4 text lines
26  */
27 
28 const bagl_element_t *ux_layout_pnn_prepro(const bagl_element_t *element)
29 {
30  const bagl_element_t *e = ux_layout_pbb_prepro(element);
31  if (e && G_ux.tmp_element.component.userid >= 0x10) {
32  // The centering depends on the screensize.
33 #if (BAGL_WIDTH == 128 && BAGL_HEIGHT == 64)
34  G_ux.tmp_element.component.font_id
35  = BAGL_FONT_OPEN_SANS_REGULAR_11px | BAGL_FONT_ALIGNMENT_CENTER;
36 #elif (BAGL_WIDTH == 128 && BAGL_HEIGHT == 32)
37  G_ux.tmp_element.component.font_id = BAGL_FONT_OPEN_SANS_REGULAR_11px;
38 #else
39 #error "BAGL_WIDTH/BAGL_HEIGHT not defined"
40 #endif
41  }
42  return e;
43 }
44 
45 void ux_layout_pnn_init(unsigned int stack_slot)
46 {
47  ux_layout_pbb_init_common(stack_slot);
48  G_ux.stack[stack_slot].screen_before_element_display_callback = ux_layout_pnn_prepro;
49  ux_stack_display(stack_slot);
50 }
51 
52 #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