Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
nbgl_layout_keypad.c
Go to the documentation of this file.
1
7#ifdef HAVE_SE_TOUCH
8#ifdef NBGL_KEYPAD
9/*********************
10 * INCLUDES
11 *********************/
12#include <string.h>
13#include <stdlib.h>
14#include "nbgl_debug.h"
15#include "nbgl_front.h"
17#include "nbgl_obj.h"
18#include "nbgl_draw.h"
19#include "nbgl_screen.h"
20#include "nbgl_touch.h"
21#include "glyphs.h"
22#include "os_pic.h"
23#include "os_helpers.h"
24#include "os.h"
25
26/*********************
27 * DEFINES
28 *********************/
29
30enum {
34};
35
36#if defined(TARGET_STAX)
37#define ENTRY_DIGITS_LINE_WIDTH 288
38#define ENTRY_DIGITS_HEIGHT 52
39#define ENTRY_DIGITS_CONTAINER_HEIGHT 52
40#define INTER_ENTRY_DIGITS 10
41#define TITLE_MARGIN_Y 8
42#define TITLE_MARGIN_Y_SMALL 8
43#elif defined(TARGET_FLEX)
44#define ENTRY_DIGITS_HEIGHT 64
45#define ENTRY_DIGITS_CONTAINER_HEIGHT 64
46#define INTER_ENTRY_DIGITS 12
47#define TITLE_MARGIN_Y 8
48#define TITLE_MARGIN_Y_SMALL 8
49#elif defined(TARGET_APEX)
50#define ENTRY_DIGITS_HEIGHT 40
51#define ENTRY_DIGITS_CONTAINER_HEIGHT 40
52#define INTER_ENTRY_DIGITS 8
53#define TITLE_MARGIN_Y 13
54#define TITLE_MARGIN_Y_SMALL 2
55#endif // TARGETS
56
57/**********************
58 * MACROS
59 **********************/
60
61/**********************
62 * TYPEDEFS
63 **********************/
64
65/**********************
66 * VARIABLES
67 **********************/
68
69/**********************
70 * STATIC PROTOTYPES
71 **********************/
72
73/**********************
74 * GLOBAL API FUNCTIONS
75 **********************/
76
87int nbgl_layoutAddKeypad(nbgl_layout_t *layout, keyboardCallback_t callback, bool shuffled)
88{
89 nbgl_layoutInternal_t *layoutInt = (nbgl_layoutInternal_t *) layout;
90 nbgl_keypad_t *keypad;
91
92 LOG_DEBUG(LAYOUT_LOGGER, "nbgl_layoutAddKeypad():\n");
93 if (layout == NULL) {
94 return -1;
95 }
96 // footer must be empty
97 if (layoutInt->footerContainer != NULL) {
98 LOG_WARN(LAYOUT_LOGGER, "nbgl_layoutAddKeypad(): footer already set\n");
99 return -1;
100 }
101
102 // create keypad
103 keypad = (nbgl_keypad_t *) nbgl_objPoolGet(KEYPAD, layoutInt->layer);
104 keypad->obj.alignmentMarginY = 0;
105 keypad->obj.alignment = BOTTOM_MIDDLE;
106 keypad->obj.alignTo = NULL;
107 keypad->obj.area.width = SCREEN_WIDTH;
108 keypad->obj.area.height = 4 * KEYPAD_KEY_HEIGHT;
109 keypad->callback = PIC(callback);
110 keypad->enableDigits = true;
111 keypad->enableBackspace = false;
112 keypad->enableValidate = false;
113 keypad->shuffled = shuffled;
114 keypad->digitsChanged = true;
115 keypad->validateChanged = true;
116
117 // the keypad occupies the footer
118 layoutInt->footerContainer = (nbgl_container_t *) nbgl_objPoolGet(CONTAINER, layoutInt->layer);
119 layoutInt->footerContainer->obj.area.width = SCREEN_WIDTH;
120 layoutInt->footerContainer->layout = VERTICAL;
121 layoutInt->footerContainer->children
122 = (nbgl_obj_t **) nbgl_containerPoolGet(1, layoutInt->layer);
123 layoutInt->footerContainer->obj.alignment = BOTTOM_MIDDLE;
124 layoutInt->footerContainer->obj.area.height = keypad->obj.area.height;
125 layoutInt->footerContainer->children[layoutInt->footerContainer->nbChildren]
126 = (nbgl_obj_t *) keypad;
127 layoutInt->footerContainer->nbChildren++;
128
129 // add to layout children
130 layoutInt->children[FOOTER_INDEX] = (nbgl_obj_t *) layoutInt->footerContainer;
131
132 // subtract footer height from main container height
133 layoutInt->container->obj.area.height -= layoutInt->footerContainer->obj.area.height;
134
135 layoutInt->footerType = KEYPAD_FOOTER_TYPE;
136
137 return layoutInt->footerContainer->obj.area.height;
138}
139
151 uint8_t index,
152 bool enableValidate,
153 bool enableBackspace,
154 bool enableDigits)
155{
156 nbgl_layoutInternal_t *layoutInt = (nbgl_layoutInternal_t *) layout;
157 nbgl_keypad_t *keypad;
158
160 "nbgl_layoutUpdateKeypad(): enableValidate = %d, enableBackspace = %d\n",
161 enableValidate,
162 enableBackspace);
163 if (layout == NULL) {
164 return -1;
165 }
166 UNUSED(index);
167
168 // get existing keypad (in the footer container)
169 keypad = (nbgl_keypad_t *) layoutInt->footerContainer->children[0];
170 if ((keypad == NULL) || (keypad->obj.type != KEYPAD)) {
171 LOG_WARN(LAYOUT_LOGGER, "nbgl_layoutUpdateKeypad(): keypad not found at index %d\n", index);
172 return -1;
173 }
174 // partial redraw only if only validate and backspace have changed
175 keypad->digitsChanged = (keypad->enableDigits != enableDigits);
176 keypad->validateChanged = (keypad->enableValidate != enableValidate);
177 keypad->enableValidate = enableValidate;
178 keypad->enableBackspace = enableBackspace;
179 keypad->enableDigits = enableDigits;
180
181 nbgl_objDraw((nbgl_obj_t *) keypad);
182
183 return 0;
184}
185
194int nbgl_layoutUpdateKeypadValidation(nbgl_layout_t *layout, bool softValidation)
195{
196 nbgl_layoutInternal_t *layoutInt = (nbgl_layoutInternal_t *) layout;
197 nbgl_keypad_t *keypad;
198
199 LOG_DEBUG(LAYOUT_LOGGER, "nbgl_layoutUpdateKeypad(): softValidation = %d,\n", softValidation);
200 if (layout == NULL) {
201 return -1;
202 }
203 UNUSED(index);
204
205 // get existing keypad (in the footer container)
206 keypad = (nbgl_keypad_t *) layoutInt->footerContainer->children[0];
207 if ((keypad == NULL) || (keypad->obj.type != KEYPAD)) {
208 LOG_WARN(LAYOUT_LOGGER, "nbgl_layoutUpdateKeypadValidation(): keypad not found\n");
209 return -1;
210 }
211 keypad->softValidation = softValidation;
212
213 return 0;
214}
215
229int nbgl_layoutAddHiddenDigits(nbgl_layout_t *layout, uint8_t nbDigits)
230{
231 nbgl_layoutInternal_t *layoutInt = (nbgl_layoutInternal_t *) layout;
232 nbgl_container_t *container;
233 uint8_t space;
234
235 LOG_DEBUG(LAYOUT_LOGGER, "nbgl_layoutAddHiddenDigits():\n");
236 if (layout == NULL) {
237 return -1;
238 }
239 if (nbDigits > KEYPAD_MAX_DIGITS) {
240 return -1;
241 }
242 if (nbDigits > 8) {
243 space = 4;
244 }
245 else {
246 space = 12;
247 }
248
249 // create a container, invisible or bordered
250 container = (nbgl_container_t *) nbgl_objPoolGet(CONTAINER, layoutInt->layer);
251 container->nbChildren = nbDigits;
252#ifdef TARGET_STAX
253 container->nbChildren++; // +1 for the line
254#endif // TARGET_STAX
255 container->children = nbgl_containerPoolGet(container->nbChildren, layoutInt->layer);
256 // <space> pixels between each icon (knowing that the effective round are 18px large and the
257 // icon 24px)
258 container->obj.area.width = nbDigits * DIGIT_ICON.width + (nbDigits - 1) * space;
259 container->obj.area.height = ENTRY_DIGITS_HEIGHT;
260
261 // item N-2 is the title
262 container->obj.alignTo = layoutInt->container->children[layoutInt->container->nbChildren - 2];
263 container->obj.alignment = BOTTOM_MIDDLE;
264
265 // set this new container as child of the main container
266 layoutAddObject(layoutInt, (nbgl_obj_t *) container);
267
268 // create children of the container, as images (empty circles)
269 nbgl_objPoolGetArray(IMAGE, nbDigits, layoutInt->layer, (nbgl_obj_t **) container->children);
270 for (int i = 0; i < nbDigits; i++) {
271 nbgl_image_t *image = (nbgl_image_t *) container->children[i];
272 image->buffer = &DIGIT_ICON;
273 image->foregroundColor = WHITE;
274 if (i > 0) {
275 image->obj.alignment = MID_RIGHT;
276 image->obj.alignTo = (nbgl_obj_t *) container->children[i - 1];
277 image->obj.alignmentMarginX = space;
278 }
279 else {
280 image->obj.alignment = MID_LEFT;
281 }
282 }
283#ifdef TARGET_STAX
284 nbgl_line_t *line;
285 // create gray line
286 line = (nbgl_line_t *) nbgl_objPoolGet(LINE, layoutInt->layer);
287 line->lineColor = LIGHT_GRAY;
288 line->obj.alignmentMarginY = 0;
289 line->obj.alignTo = NULL;
290 line->obj.alignment = BOTTOM_MIDDLE;
291 line->obj.area.width = container->obj.area.width;
292 line->obj.area.height = 4;
293 line->direction = HORIZONTAL;
294 line->thickness = 2;
295 line->offset = 2;
296 container->children[nbDigits] = (nbgl_obj_t *) line;
297#endif // TARGET_STAX
298
299 // return index of keypad to be modified later on
300 return (layoutInt->container->nbChildren - 1);
301}
302
312int nbgl_layoutUpdateHiddenDigits(nbgl_layout_t *layout, uint8_t index, uint8_t nbActive)
313{
314 nbgl_layoutInternal_t *layoutInt = (nbgl_layoutInternal_t *) layout;
315 nbgl_container_t *container;
316 nbgl_image_t *image;
317
318 LOG_DEBUG(LAYOUT_LOGGER, "nbgl_layoutUpdateHiddenDigits(): nbActive = %d\n", nbActive);
319 if (layout == NULL) {
320 return -1;
321 }
322
323 // get container
324 container = (nbgl_container_t *) layoutInt->container->children[index];
325 // sanity check
326 if ((container == NULL) || (container->obj.type != CONTAINER)) {
327 LOG_WARN(LAYOUT_LOGGER, "nbgl_layoutUpdateHiddenDigits(): container not found\n");
328 return -1;
329 }
330 if (nbActive > container->nbChildren) {
332 "nbgl_layoutUpdateHiddenDigits(): nbActive %d > nbChildren %d\n",
333 nbActive,
334 container->nbChildren);
335 return -1;
336 }
337 if (nbActive == 0) {
338 // deactivate the first digit
339 image = (nbgl_image_t *) container->children[0];
340 if ((image == NULL) || (image->obj.type != IMAGE)) {
341 LOG_WARN(LAYOUT_LOGGER, "nbgl_layoutUpdateHiddenDigits(): image not found\n");
342 return -1;
343 }
344 image->foregroundColor = WHITE;
345 }
346 else {
347 image = (nbgl_image_t *) container->children[nbActive - 1];
348 if ((image == NULL) || (image->obj.type != IMAGE)) {
349 LOG_WARN(LAYOUT_LOGGER, "nbgl_layoutUpdateHiddenDigits(): image not found\n");
350 return -1;
351 }
352 // if the last "active" is already active, it means that we are decreasing the number of
353 // active otherwise we are increasing it
354 if (image->foregroundColor == BLACK) {
355 // all digits are already active
356 if (nbActive == container->nbChildren) {
357 return 0;
358 }
359 // deactivate the next digit — guard against the underline object at children[nbDigits]
360 image = (nbgl_image_t *) container->children[nbActive];
361 if ((image == NULL) || (image->obj.type != IMAGE)) {
362 return 0;
363 }
364 image->foregroundColor = WHITE;
365 }
366 else {
367 image->buffer = &DIGIT_ICON;
368 image->foregroundColor = BLACK;
369 }
370 }
371
372 nbgl_objDraw((nbgl_obj_t *) image);
373
374 return 0;
375}
376
394 const char *title,
395 bool hidden,
396 uint8_t nbDigits,
397 const char *text)
398{
399 nbgl_layoutInternal_t *layoutInt = (nbgl_layoutInternal_t *) layout;
400 nbgl_container_t *container;
401 nbgl_text_area_t *textArea;
402
403 LOG_DEBUG(LAYOUT_LOGGER, "nbgl_layoutAddKeypadContent():\n");
404 if (layout == NULL) {
405 return -1;
406 }
407 // create a container, to store both title and "digits" (and line on Stax)
408 container = (nbgl_container_t *) nbgl_objPoolGet(CONTAINER, layoutInt->layer);
409 container->nbChildren = NB_CHILDREN;
410 container->children = nbgl_containerPoolGet(container->nbChildren, layoutInt->layer);
411 container->obj.area.width = AVAILABLE_WIDTH;
412 container->obj.alignment = TOP_MIDDLE;
413
414 // create text area for title
415 textArea = (nbgl_text_area_t *) nbgl_objPoolGet(TEXT_AREA, layoutInt->layer);
416 textArea->textColor = BLACK;
417 textArea->text = title;
418 textArea->textAlignment = CENTER;
419 textArea->fontId = SMALL_REGULAR_FONT;
420 textArea->wrapping = true;
421 textArea->obj.alignment = TOP_MIDDLE;
422 textArea->obj.area.width = AVAILABLE_WIDTH;
423 textArea->obj.area.height = nbgl_getTextHeightInWidth(
424 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
425 if (textArea->obj.area.height > nbgl_getFontHeight(textArea->fontId)) {
426 container->obj.alignmentMarginY = TITLE_MARGIN_Y_SMALL;
427 }
428 else {
429 container->obj.alignmentMarginY = TITLE_MARGIN_Y;
430 }
431 container->children[TITLE_INDEX] = (nbgl_obj_t *) textArea;
432 container->obj.area.height += textArea->obj.area.height;
433
434 if (hidden) {
435 nbgl_container_t *digitsContainer;
436 uint8_t space;
437
438 if (nbDigits > KEYPAD_MAX_DIGITS) {
440 "nbgl_layoutAddKeypadContent(): nbDigits %d > KEYPAD_MAX_DIGITS %d\n",
441 nbDigits,
443 return -1;
444 }
445 // space between "digits"
446 if (nbDigits > 8) {
447 space = 4;
448 }
449 else {
450 space = INTER_ENTRY_DIGITS;
451 }
452
453 // create digits container, to store "discs"
454 digitsContainer = (nbgl_container_t *) nbgl_objPoolGet(CONTAINER, layoutInt->layer);
455 digitsContainer->nbChildren = nbDigits;
456#ifdef TARGET_STAX
457 // for stax, add line as child
458 digitsContainer->nbChildren++;
459#endif // TARGET_STAX
460 digitsContainer->children
461 = nbgl_containerPoolGet(digitsContainer->nbChildren, layoutInt->layer);
462 // <space> pixels between each icon (knowing that the effective round are 18px large and the
463 // icon 24px)
464#ifdef TARGET_STAX
465 digitsContainer->obj.area.width = ENTRY_DIGITS_LINE_WIDTH;
466#else // TARGET_STAX
467 digitsContainer->obj.area.width = nbDigits * DIGIT_ICON.width + (nbDigits - 1) * space;
468#endif // TARGET_STAX
469 digitsContainer->obj.area.height = ENTRY_DIGITS_CONTAINER_HEIGHT;
470 // align at the bottom of title
471 digitsContainer->obj.alignTo = container->children[0];
472 digitsContainer->obj.alignment = BOTTOM_MIDDLE;
473 container->children[INPUT_INDEX] = (nbgl_obj_t *) digitsContainer;
474 container->obj.area.height += digitsContainer->obj.area.height;
475
476 // create children of the container, as images (empty circles)
478 IMAGE, nbDigits, layoutInt->layer, (nbgl_obj_t **) digitsContainer->children);
479 for (int i = 0; i < nbDigits; i++) {
480 nbgl_image_t *image = (nbgl_image_t *) digitsContainer->children[i];
481 image->buffer = &DIGIT_ICON;
482 image->foregroundColor = WHITE;
483 if (i > 0) {
484 image->obj.alignment = MID_RIGHT;
485 image->obj.alignTo = (nbgl_obj_t *) digitsContainer->children[i - 1];
486 image->obj.alignmentMarginX = space;
487 }
488 else {
489 image->obj.alignment = MID_LEFT;
490 }
491 }
492#ifdef TARGET_STAX
493 nbgl_line_t *line;
494 // create gray line
495 line = (nbgl_line_t *) nbgl_objPoolGet(LINE, layoutInt->layer);
496 line->lineColor = LIGHT_GRAY;
497 line->obj.alignTo = container->children[INPUT_INDEX];
498 line->obj.alignment = BOTTOM_MIDDLE;
499 line->obj.area.width = ENTRY_DIGITS_LINE_WIDTH;
500 line->obj.area.height = 4;
501 line->direction = HORIZONTAL;
502 line->thickness = 2;
503 line->offset = 2;
504 digitsContainer->children[nbDigits] = (nbgl_obj_t *) line;
505 digitsContainer->children[0]->alignmentMarginX
506 = (line->obj.area.width - (nbDigits * DIGIT_ICON.width + (nbDigits - 1) * space)) / 2;
507#endif // TARGET_STAX
508 }
509 else {
510 // create text area
511 textArea = (nbgl_text_area_t *) nbgl_objPoolGet(TEXT_AREA, layoutInt->layer);
512 textArea->textColor = BLACK;
513 textArea->text = text;
514 textArea->textAlignment = MID_LEFT;
515 textArea->fontId = LARGE_MEDIUM_1BPP_FONT;
516 textArea->obj.area.width = container->obj.area.width;
517 textArea->obj.area.height = nbgl_getFontLineHeight(textArea->fontId);
518 textArea->autoHideLongLine = true;
519 // align at the bottom of title
520 textArea->obj.alignTo = container->children[TITLE_INDEX];
521 textArea->obj.alignment = BOTTOM_MIDDLE;
522#ifdef TARGET_STAX
523 textArea->obj.alignmentMarginY = 24;
524#endif // TARGET_STAX
525 container->children[INPUT_INDEX] = (nbgl_obj_t *) textArea;
526 container->obj.area.height += textArea->obj.area.height;
527 }
528
529 // set this new container as child of the main container
530 layoutAddObject(layoutInt, (nbgl_obj_t *) container);
531
532 // return height of the area
533 return container->obj.area.height;
534}
535
549 bool hidden,
550 uint8_t nbActiveDigits,
551 const char *text)
552{
553 nbgl_layoutInternal_t *layoutInt = (nbgl_layoutInternal_t *) layout;
554 nbgl_container_t *container;
555 nbgl_image_t *image;
556
557 LOG_DEBUG(LAYOUT_LOGGER, "nbgl_layoutUpdateHiddenDigits(): nbActive = %d\n", nbActiveDigits);
558 if (layout == NULL) {
559 return -1;
560 }
561
562 UNUSED(index);
563
564 if (hidden) {
565 // get digits container (second child of the main container)
566 container = (nbgl_container_t *) ((nbgl_container_t *) layoutInt->container->children[0])
567 ->children[1];
568 // sanity check
569 if ((container == NULL) || (container->obj.type != CONTAINER)) {
570 LOG_WARN(LAYOUT_LOGGER, "nbgl_layoutUpdateKeypadContent(): container not found\n");
571 return -1;
572 }
573 if (nbActiveDigits > container->nbChildren) {
575 "nbgl_layoutUpdateKeypadContent(): nbActive %d > nbChildren %d\n",
576 nbActiveDigits,
577 container->nbChildren);
578 return -1;
579 }
580 if (nbActiveDigits == 0) {
581 // deactivate the first digit
582 image = (nbgl_image_t *) container->children[0];
583 if ((image == NULL) || (image->obj.type != IMAGE)) {
584 LOG_WARN(LAYOUT_LOGGER, "nbgl_layoutUpdateKeypadContent(): image not found\n");
585 return -1;
586 }
587 image->foregroundColor = WHITE;
588 }
589 else {
590 image = (nbgl_image_t *) container->children[nbActiveDigits - 1];
591 if ((image == NULL) || (image->obj.type != IMAGE)) {
592 LOG_WARN(LAYOUT_LOGGER, "nbgl_layoutUpdateKeypadContent(): image not found\n");
593 return -1;
594 }
595 // if the last "active" is already active, it means that we are decreasing the number of
596 // active otherwise we are increasing it
597 if (image->foregroundColor == BLACK) {
598 // all digits are already active
599 if (nbActiveDigits == container->nbChildren) {
600 return 0;
601 }
602 // deactivate the next digit by turning it to white
603 image = (nbgl_image_t *) container->children[nbActiveDigits];
604 image->foregroundColor = WHITE;
605 }
606 else {
607 // activate it the last digit by turning it to black
608 image->foregroundColor = BLACK;
609 }
610 }
611
612 nbgl_objDraw((nbgl_obj_t *) image);
613 }
614 else {
615 // update main text area (second child of the main container)
616 nbgl_text_area_t *textArea
617 = (nbgl_text_area_t *) ((nbgl_container_t *) layoutInt->container->children[0])
618 ->children[1];
619 if ((textArea == NULL) || (textArea->obj.type != TEXT_AREA)) {
620 LOG_WARN(LAYOUT_LOGGER, "nbgl_layoutUpdateKeypadContent(): text area not found\n");
621 return -1;
622 }
623 textArea->text = text;
624 textArea->textColor = BLACK;
625 textArea->textAlignment = MID_LEFT;
626 nbgl_objDraw((nbgl_obj_t *) textArea);
627
628 // if the text doesn't fit, indicate it by returning 1 instead of 0, for different refresh
629 if (nbgl_getSingleLineTextWidth(textArea->fontId, text) > textArea->obj.area.width) {
630 return 1;
631 }
632 }
633
634 return 0;
635}
636#endif // NBGL_KEYPAD
637#endif // HAVE_SE_TOUCH
debug traces management
#define LOG_WARN(__logger,...)
Definition nbgl_debug.h:87
@ LAYOUT_LOGGER
Definition nbgl_debug.h:33
#define LOG_DEBUG(__logger,...)
Definition nbgl_debug.h:86
Middle Level API of the new BOLOS Graphical Library.
uint16_t nbgl_getSingleLineTextWidth(nbgl_font_id_e fontId, const char *text)
uint8_t nbgl_getFontHeight(nbgl_font_id_e fontId)
uint16_t nbgl_getTextHeightInWidth(nbgl_font_id_e fontId, const char *text, uint16_t maxWidth, bool wrapping)
uint8_t nbgl_getFontLineHeight(nbgl_font_id_e fontId)
Font screen low-Level driver API, to draw elementary forms.
void layoutAddObject(nbgl_layoutInternal_t *layout, nbgl_obj_t *obj)
adds the given obj to the main container
#define AVAILABLE_WIDTH
void * nbgl_layout_t
type shared externally
Internal functions/constants of NBGL layout layer.
#define KEYPAD_FOOTER_TYPE
@ FOOTER_INDEX
int nbgl_layoutAddHiddenDigits(nbgl_layout_t *layout, uint8_t nbDigits)
Adds a placeholder for hidden digits on top of a keypad, to represent the entered digits,...
int nbgl_layoutUpdateHiddenDigits(nbgl_layout_t *layout, uint8_t index, uint8_t nbActive)
Updates an existing set of hidden digits, with the given configuration.
int nbgl_layoutUpdateKeypad(nbgl_layout_t *layout, uint8_t index, bool enableValidate, bool enableBackspace, bool enableDigits)
Updates an existing keypad on bottom of the screen, with the given configuration.
int nbgl_layoutUpdateKeypadValidation(nbgl_layout_t *layout, bool softValidation)
Updates an existing keypad on bottom of the screen, with the given configuration, without redraw.
int nbgl_layoutAddKeypadContent(nbgl_layout_t *layout, const char *title, bool hidden, uint8_t nbDigits, const char *text)
Adds an area with a title and a placeholder for hidden digits on top of a keypad, to represent the en...
int nbgl_layoutUpdateKeypadContent(nbgl_layout_t *layout, bool hidden, uint8_t nbActiveDigits, const char *text)
Updates an existing set of hidden digits, with the given configuration.
int nbgl_layoutAddKeypad(nbgl_layout_t *layout, keyboardCallback_t callback, bool shuffled)
Adds a keypad on bottom of the screen, with the associated callback.
@ INPUT_INDEX
@ NB_CHILDREN
@ TITLE_INDEX
API to draw all basic graphic objects.
struct PACKED__ nbgl_line_s nbgl_line_t
struct to represent a vertical or horizontal line
struct PACKED__ nbgl_text_area_s nbgl_text_area_t
struct to represent a text area (TEXT_AREA type)
void nbgl_objDraw(nbgl_obj_t *obj)
nbgl_obj_t ** nbgl_containerPoolGet(uint8_t nbObjs, uint8_t layer)
struct PACKED__ nbgl_keypad_s nbgl_keypad_t
struct to represent a keypad (KEYPAD type)
nbgl_obj_t * nbgl_objPoolGet(nbgl_obj_type_t type, uint8_t layer)
#define KEYPAD_MAX_DIGITS
Definition nbgl_obj.h:73
struct PACKED__ nbgl_image_s nbgl_image_t
struct to represent an image (IMAGE type)
int nbgl_objPoolGetArray(nbgl_obj_type_t type, uint8_t nbObjs, uint8_t layer, nbgl_obj_t **objArray)
void(* keyboardCallback_t)(char touchedKey)
prototype of function to be called when a valid key is pressed on keyboard Backspace is equal to 0x8 ...
Definition nbgl_obj.h:477
struct PACKED__ nbgl_container_s nbgl_container_t
struct to represent a container (CONTAINER type)
struct PACKED__ nbgl_obj_s nbgl_obj_t
Common structure for all graphical objects.
API to manage screens.
@ WHITE
Definition nbgl_types.h:156
@ LIGHT_GRAY
Definition nbgl_types.h:155
@ BLACK
Definition nbgl_types.h:153
@ VERTICAL
from top to bottom
Definition nbgl_types.h:221
@ HORIZONTAL
from left to right
Definition nbgl_types.h:222
@ TOP_MIDDLE
Definition nbgl_types.h:194
@ CENTER
Definition nbgl_types.h:197
@ MID_RIGHT
Definition nbgl_types.h:198
@ MID_LEFT
Definition nbgl_types.h:196
@ BOTTOM_MIDDLE
Definition nbgl_types.h:200
@ KEYPAD
Keypad.
Definition nbgl_types.h:179
@ IMAGE
Bitmap (y and height must be multiple of 4 on Stax)
Definition nbgl_types.h:169
@ LINE
Vertical or Horizontal line.
Definition nbgl_types.h:170
@ CONTAINER
Empty container.
Definition nbgl_types.h:168
@ TEXT_AREA
Area to contain text line(s)
Definition nbgl_types.h:171
Structure containing all information about the current layout.
nbgl_container_t * footerContainer
container used to store footer (buttons, nav....)
uint8_t layer
layer in screen stack
nbgl_container_t * container
nbgl_layoutFooterType_t footerType
type of footer
nbgl_obj_t ** children
children for main screen