Embedded SDK
Embedded SDK
Macros | Enumerations | Functions
nbgl_layout_keypad.c File Reference

Implementation of keypad management of predefined layouts management for Applications. More...

#include <string.h>
#include <stdlib.h>
#include "nbgl_debug.h"
#include "nbgl_front.h"
#include "nbgl_layout_internal.h"
#include "nbgl_obj.h"
#include "nbgl_draw.h"
#include "nbgl_screen.h"
#include "nbgl_touch.h"
#include "glyphs.h"
#include "os_pic.h"
#include "os_helpers.h"
Include dependency graph for nbgl_layout_keypad.c:

Go to the source code of this file.

Macros

#define DIGIT_ICON   C_pin_24
 

Enumerations

enum  { TITLE_INDEX = 0 , INPUT_INDEX , LINE_INDEX , NB_CHILDREN }
 

Functions

int nbgl_layoutAddKeypad (nbgl_layout_t *layout, keyboardCallback_t callback, bool shuffled)
 Adds a keypad on bottom of the screen, with the associated callback. More...
 
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. More...
 
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, as full circles The placeholder is "underligned" with a thin horizontal line of the expected full length. More...
 
int nbgl_layoutUpdateHiddenDigits (nbgl_layout_t *layout, uint8_t index, uint8_t nbActive)
 Updates an existing set of hidden digits, with the given configuration. More...
 
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 entered digits as small discs. On Stax, the placeholder is "underligned" with a thin horizontal line of the expected full length. More...
 
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. More...
 

Detailed Description

Implementation of keypad management of predefined layouts management for Applications.

Note
This file applies only to wallet size products (Stax, Flex...)

Definition in file nbgl_layout_keypad.c.

Macro Definition Documentation

◆ DIGIT_ICON

#define DIGIT_ICON   C_pin_24

Definition at line 31 of file nbgl_layout_keypad.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
TITLE_INDEX 
INPUT_INDEX 
LINE_INDEX 
NB_CHILDREN 

Definition at line 34 of file nbgl_layout_keypad.c.

Function Documentation

◆ nbgl_layoutAddHiddenDigits()

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, as full circles The placeholder is "underligned" with a thin horizontal line of the expected full length.

Deprecated:
Use nbgl_layoutAddKeypadContent instead
Note
It must be the last added object, after potential back key, title, and keypad. Vertical positions of title and hidden digits will be computed here
Parameters
layoutthe current layout
nbDigitsnumber of digits to be displayed
Returns
the index of digits set, to use in nbgl_layoutUpdateHiddenDigits()

Definition at line 179 of file nbgl_layout_keypad.c.

◆ nbgl_layoutAddKeypad()

int nbgl_layoutAddKeypad ( nbgl_layout_t layout,
keyboardCallback_t  callback,
bool  shuffled 
)

Adds a keypad on bottom of the screen, with the associated callback.

Note
Validate and Backspace keys are not enabled at start-up
Parameters
layoutthe current layout
callbackfunction called when any of the key is touched
shuffledif set to true, digits are shuffled in keypad
Returns
the index of keypad, to use in nbgl_layoutUpdateKeypad()

Definition at line 71 of file nbgl_layout_keypad.c.

◆ nbgl_layoutAddKeypadContent()

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 entered digits as small discs. On Stax, the placeholder is "underligned" with a thin horizontal line of the expected full length.

Note
It shall be the only object added in the layout, beside a potential header and the keypad itself
Parameters
layoutthe current layout
titlethe text to use on top of the digits
hiddenif set to true, digits appear as discs, otherwise as visible digits (given in text param)
nbDigitsnumber of digits to be displayed (only used if hidden is true)
textonly used if hidden is false
Returns
the height of this area, if no error, < 0 otherwise

Definition at line 337 of file nbgl_layout_keypad.c.

◆ nbgl_layoutUpdateHiddenDigits()

int nbgl_layoutUpdateHiddenDigits ( nbgl_layout_t layout,
uint8_t  index,
uint8_t  nbActive 
)

Updates an existing set of hidden digits, with the given configuration.

Deprecated:
Use nbgl_layoutUpdateKeypadContent instead
Parameters
layoutthe current layout
indexindex returned by nbgl_layoutAddHiddenDigits()
nbActivenumber of "active" digits (represented by discs instead of circles)
Returns
>=0 if OK

Definition at line 266 of file nbgl_layout_keypad.c.

◆ nbgl_layoutUpdateKeypad()

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.

Parameters
layoutthe current layout
indexindex returned by nbgl_layoutAddKeypad() (unused, for compatibility)
enableValidateif true, enable Validate key
enableBackspaceif true, enable Backspace key
enableDigitsif true, enable all digit keys
Returns
>=0 if OK

Definition at line 132 of file nbgl_layout_keypad.c.

◆ nbgl_layoutUpdateKeypadContent()

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.

Parameters
layoutthe current layout
hiddenif set to true, digits appear as discs, otherwise as visible digits (given in text param)
nbActiveDigitsnumber of "active" digits (represented by discs instead of circles) (only used if hidden is true)
textonly used if hidden is false
Returns
>=0 if OK

Definition at line 484 of file nbgl_layout_keypad.c.