Skip to content

Commit e8f68a6

Browse files
Merge pull request #827 from LedgerHQ/nbgl-extensions-for-charon
NBGL extensions for future UX screens
2 parents d59b21f + 59f9125 commit e8f68a6

File tree

11 files changed

+316
-85
lines changed

11 files changed

+316
-85
lines changed

lib_nbgl/include/nbgl_content.h

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ typedef struct {
6868
#endif // HAVE_SE_TOUCH
6969
} nbgl_contentCenteredInfo_t;
7070

71+
/**
72+
* @brief possible types of illustration, for example in @ref nbgl_contentCenter_t
73+
*
74+
*/
75+
typedef enum {
76+
ICON_ILLUSTRATION, ///< simple icon
77+
ANIM_ILLUSTRATION, ///< animation
78+
} nbgl_contentIllustrationType_t;
79+
7180
/**
7281
* @brief This structure contains info to build a centered (vertically and horizontally) area, with
7382
* many fields (if NULL, not used):
@@ -79,9 +88,14 @@ typedef struct {
7988
* - a padding on the bottom
8089
*/
8190
typedef struct {
82-
const nbgl_icon_details_t *icon; ///< the icon (can be null)
83-
const char *title; ///< title in black large (can be null)
84-
const char *smallTitle; ///< sub-title in black small bold case (can be null)
91+
nbgl_contentIllustrationType_t illustrType;
92+
const nbgl_icon_details_t *icon; ///< the icon (can be null)
93+
const nbgl_animation_t
94+
*animation; ///< the animation (can be null), used if illustrType is @ref ANIM_ILLUSTRATION
95+
uint16_t animOffsetX; ///< horizontal offset of animation in icon if integrated (but usually 0)
96+
uint16_t animOffsetY; ///< vertical offset of animation in icon if integrated (but usually 0)
97+
const char *title; ///< title in black large (can be null)
98+
const char *smallTitle; ///< sub-title in black small bold case (can be null)
8599
const char *description; ///< description in black small regular case (can be null)
86100
const char *subText; ///< sub-text in dark gray regular small case
87101
uint16_t iconHug; ///< vertical margin to apply on top and bottom of the icon

lib_nbgl/include/nbgl_layout.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,10 @@ typedef struct {
290290
typedef enum {
291291
ROUNDED_AND_FOOTER_STYLE = 0, ///< A black background button on top of a footer
292292
STRONG_ACTION_AND_FOOTER_STYLE, ///< A black button on top of a footer, with a separation line
293-
SOFT_ACTION_AND_FOOTER_STYLE ///< A white button on top of a footer, with a separation line
293+
SOFT_ACTION_AND_FOOTER_STYLE, ///< A white button on top of a footer, with a separation line
294+
BOTH_ROUNDED_STYLE ///< A black button on top of a white button
294295
} nbgl_layoutChoiceButtonsStyle_t;
295296

296-
// for backward compatibility
297-
#define BOTH_ROUNDED_STYLE SOFT_ACTION_AND_FOOTER_STYLE
298-
299297
/**
300298
* @brief This structure contains info to build a pair of buttons, one on top of the other.
301299
*
@@ -416,10 +414,11 @@ typedef struct {
416414
typedef enum {
417415
HEADER_EMPTY = 0, ///< empty space, to have a better vertical centering of centered info
418416
HEADER_BACK_AND_TEXT, ///< back key and optional text
419-
HEADER_BACK_AND_PROGRESS, ///< optional back key and progress indicator (only on Stax)
420-
HEADER_TITLE, ///< simple centered text
421-
HEADER_EXTENDED_BACK, ///< back key, centered text and touchable key on the right
422-
HEADER_RIGHT_TEXT, ///< touchable text on the right, with a vertical separation line
417+
HEADER_BACK_ICON_AND_TEXT, ///< back key and optional icon and text
418+
HEADER_BACK_AND_PROGRESS, ///< optional back key and progress indicator (only on Stax)
419+
HEADER_TITLE, ///< simple centered text
420+
HEADER_EXTENDED_BACK, ///< back key, centered text and touchable key on the right
421+
HEADER_RIGHT_TEXT, ///< touchable text on the right, with a vertical separation line
423422
NB_HEADER_TYPES
424423
} nbgl_layoutHeaderType_t;
425424

@@ -435,10 +434,12 @@ typedef struct {
435434
uint16_t height;
436435
} emptySpace; ///< if type is @ref HEADER_EMPTY
437436
struct {
437+
const nbgl_icon_details_t
438+
*icon; ///< icon on left of text (only if @ref HEADER_BACK_ICON_AND_TEXT)
438439
const char *text; ///< can be NULL if no text
439440
uint8_t token; ///< when back key is pressed
440441
tune_index_e tuneId; ///< when back key is pressed
441-
} backAndText; ///< if type is @ref HEADER_BACK_AND_TEXT
442+
} backAndText; ///< if type is @ref HEADER_BACK_ICON_AND_TEXT or @ref HEADER_BACK_AND_TEXT
442443
struct {
443444
const nbgl_icon_details_t *actionIcon; ///< right button icon
444445
uint8_t activePage;
@@ -654,7 +655,7 @@ int nbgl_layoutAddProgressIndicator(nbgl_layout_t *layout,
654655
bool withBack,
655656
uint8_t backToken,
656657
tune_index_e tuneId);
657-
int nbgl_layoutAddSpinner(nbgl_layout_t *layout, const char *text, bool fixed);
658+
int nbgl_layoutAddSpinner(nbgl_layout_t *layout, const char *text, const char *subText, bool fixed);
658659
int nbgl_layoutAddSwipe(nbgl_layout_t *layout,
659660
uint16_t swipesMask,
660661
const char *text,
@@ -729,6 +730,7 @@ int nbgl_layoutUpdateKeypad(nbgl_layout_t *layout,
729730
bool enableValidate,
730731
bool enableBackspace,
731732
bool enableDigits);
733+
int nbgl_layoutUpdateKeypadValidation(nbgl_layout_t *layout, bool softValidation);
732734
DEPRECATED int nbgl_layoutAddHiddenDigits(nbgl_layout_t *layout, uint8_t nbDigits);
733735
DEPRECATED int nbgl_layoutUpdateHiddenDigits(nbgl_layout_t *layout,
734736
uint8_t index,

lib_nbgl/include/nbgl_obj.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,8 @@ typedef struct PACKED__ nbgl_keyboard_s {
523523
typedef struct PACKED__ nbgl_keypad_s {
524524
nbgl_obj_t obj; ///< common part
525525
#ifdef HAVE_SE_TOUCH
526-
color_t textColor; ///< color set to digits.
527526
color_t borderColor; ///< color set to key borders
527+
bool softValidation; ///< if true, the "check icon" is replaced by an arrow
528528
bool enableDigits; ///< if true, Digit keys are enabled
529529
bool partial; ///< if true, means that only some keys have changed
530530
uint8_t digitIndexes[5]; ///< array of digits indexes, 4 bits per digit
@@ -552,6 +552,7 @@ enum {
552552
EXTRA_BUTTON_ID,
553553
CHOICE_1_ID,
554554
CHOICE_2_ID,
555+
CHOICE_3_ID,
555556
KEYPAD_ID,
556557
KEYBOARD_ID,
557558
ENTERED_TEXT_ID,

lib_nbgl/include/nbgl_types.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,26 @@ typedef struct PACKED__ nbgl_icon_details_s {
366366
const uint8_t *bitmap; ///< buffer containing pixel values
367367
} nbgl_icon_details_t;
368368

369+
/**
370+
* @brief possible parsings of icons to create animation
371+
*
372+
*/
373+
typedef enum {
374+
LOOP_PARSING, ///< 0, 1, 2, 0, 1, 2, ...
375+
BACK_AND_FORTH_PARSING ///< 0, 1, 2, 1, 2, 0, ...
376+
} nbgl_parsingType_t;
377+
378+
/**
379+
* @brief Represents all information about an animation (succession of icons)
380+
*
381+
*/
382+
typedef struct nbgl_animation_s {
383+
const nbgl_icon_details_t **icons; ///< array of nbIcons pointers on icons
384+
uint8_t nbIcons; ///< number of icons in icons array
385+
nbgl_parsingType_t parsing; // type of parsing of icons
386+
uint16_t delayMs; ///< delay between 2 drawings
387+
} nbgl_animation_t;
388+
369389
#ifdef __cplusplus
370390
} /* extern "C" */
371391
#endif

0 commit comments

Comments
 (0)