Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
Macros | Typedefs | Enumerations | Functions
nbgl_step.h File Reference

Step construction API of NBGL. More...

#include "nbgl_layout.h"
#include "nbgl_obj.h"
#include "nbgl_types.h"
Include dependency graph for nbgl_step.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define GET_POS_OF_STEP(_step, _nb_steps)
 
#define FORWARD_DIRECTION   0x00
 When the flow is navigated from last to first step.
 
#define BACKWARD_DIRECTION   0x08
 When action callback applies on any button press.
 
#define ACTION_ON_ANY_BUTTON   0x40
 When action callback applies only on both button press.
 
#define ACTION_ON_BOTH_BUTTONS   0x00
 mask for the position of the step in nbgl_stepPosition_t
 
#define STEP_POSITION_MASK   0x03
 

Typedefs

typedef void * nbgl_step_t
 type shared externally
 
typedef void(* nbgl_stepMenuListCallback_t) (uint8_t choiceIndex)
 prototype of chosen menu list item callback
 
typedef void(* nbgl_stepButtonCallback_t) (nbgl_step_t stepCtx, nbgl_buttonEvent_t event)
 prototype of function to be called when buttons are touched on a screen
 
typedef uint8_t nbgl_stepPosition_t
 this type is a bitfield containing:
 

Enumerations

enum  { SINGLE_STEP , FIRST_STEP , LAST_STEP , NEITHER_FIRST_NOR_LAST_STEP }
 possible position for a step in a flow More...
 

Functions

nbgl_step_t nbgl_stepDrawText (nbgl_stepPosition_t pos, nbgl_stepButtonCallback_t onActionCallback, nbgl_screenTickerConfiguration_t *ticker, const char *text, const char *subText, nbgl_contentCenteredInfoStyle_t style, bool modal)
 draws a text type step, that can be multi-pages, depending of the length of text and subText. The navigation arrows are displayed depending of the given position of this step in a flow, and depending of the page in case of multi-pages
 
nbgl_step_t nbgl_stepDrawCenteredInfo (nbgl_stepPosition_t pos, nbgl_stepButtonCallback_t onActionCallback, nbgl_screenTickerConfiguration_t *ticker, nbgl_layoutCenteredInfo_t *info, bool modal)
 draw a step with a centered info (icon + text). This is always a single page step
 
nbgl_step_t nbgl_stepDrawMenuList (nbgl_stepMenuListCallback_t onActionCallback, nbgl_screenTickerConfiguration_t *ticker, nbgl_layoutMenuList_t *list, bool modal)
 draw a step page with a menu list and navigation arrows to parse it. This step must be alone
 
uint8_t nbgl_stepGetMenuListCurrent (nbgl_step_t step)
 Get the index of the currently selected item in the menulist.
 
nbgl_step_t nbgl_stepDrawSwitch (nbgl_stepPosition_t pos, nbgl_stepButtonCallback_t onActionCallback, nbgl_screenTickerConfiguration_t *ticker, nbgl_layoutSwitch_t *switchInfo, bool modal)
 draw a step page with a switch and navigation arrows to navigate to other pages.
 
int nbgl_stepRelease (nbgl_step_t step)
 Release the step obtained with any of the nbgl_stepDrawXXX() functions.
 

Detailed Description

Step construction API of NBGL.

Definition in file nbgl_step.h.

Macro Definition Documentation

◆ ACTION_ON_ANY_BUTTON

#define ACTION_ON_ANY_BUTTON   0x40

When action callback applies only on both button press.

Definition at line 76 of file nbgl_step.h.

◆ ACTION_ON_BOTH_BUTTONS

#define ACTION_ON_BOTH_BUTTONS   0x00

mask for the position of the step in nbgl_stepPosition_t

Definition at line 78 of file nbgl_step.h.

◆ BACKWARD_DIRECTION

#define BACKWARD_DIRECTION   0x08

When action callback applies on any button press.

Definition at line 74 of file nbgl_step.h.

◆ FORWARD_DIRECTION

#define FORWARD_DIRECTION   0x00

When the flow is navigated from last to first step.

Definition at line 72 of file nbgl_step.h.

◆ GET_POS_OF_STEP

#define GET_POS_OF_STEP (   _step,
  _nb_steps 
)
Value:
(_nb_steps < 2) \
: ((_step == 0) ? FIRST_STEP \
: ((_step == (_nb_steps - 1)) ? LAST_STEP : NEITHER_FIRST_NOR_LAST_STEP))
@ NEITHER_FIRST_NOR_LAST_STEP
neither first nor last in a multiple steps flow
Definition nbgl_step.h:67
@ SINGLE_STEP
single step flow
Definition nbgl_step.h:64
@ LAST_STEP
last in a multiple steps flow
Definition nbgl_step.h:66
@ FIRST_STEP
first in a multiple steps flow
Definition nbgl_step.h:65

get the "position" of a step within a flow of several steps

Parameters
_stepstep index from which to get the position
_nb_stepsnumber of steps in the flow

Definition at line 30 of file nbgl_step.h.

◆ STEP_POSITION_MASK

#define STEP_POSITION_MASK   0x03

Definition at line 79 of file nbgl_step.h.

Typedef Documentation

◆ nbgl_step_t

typedef void* nbgl_step_t

type shared externally

Definition at line 44 of file nbgl_step.h.

◆ nbgl_stepButtonCallback_t

typedef void(* nbgl_stepButtonCallback_t) (nbgl_step_t stepCtx, nbgl_buttonEvent_t event)

prototype of function to be called when buttons are touched on a screen

Parameters
stepCtxcontext returned by the nbgl_stepDrawXXX function
eventtype of button event

Definition at line 57 of file nbgl_step.h.

◆ nbgl_stepMenuListCallback_t

typedef void(* nbgl_stepMenuListCallback_t) (uint8_t choiceIndex)

prototype of chosen menu list item callback

Parameters
choiceIndexindex of the menu list item

Definition at line 50 of file nbgl_step.h.

◆ nbgl_stepPosition_t

typedef uint8_t nbgl_stepPosition_t

this type is a bitfield containing:

  • bit[3]: if 1, backward direction, if 0 forward
  • bit[2]: if 1, action on any button, if 0 action only on double button
  • bit[1:0]: possible positions for a step in a flow

Definition at line 88 of file nbgl_step.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

possible position for a step in a flow

Enumerator
SINGLE_STEP 

single step flow

FIRST_STEP 

first in a multiple steps flow

LAST_STEP 

last in a multiple steps flow

NEITHER_FIRST_NOR_LAST_STEP 

neither first nor last in a multiple steps flow

Definition at line 63 of file nbgl_step.h.

Function Documentation

◆ nbgl_stepDrawCenteredInfo()

nbgl_step_t nbgl_stepDrawCenteredInfo ( nbgl_stepPosition_t  pos,
nbgl_stepButtonCallback_t  onActionCallback,
nbgl_screenTickerConfiguration_t ticker,
nbgl_layoutCenteredInfo_t info,
bool  modal 
)

draw a step with a centered info (icon + text). This is always a single page step

Parameters
posposition of this step in the flow (first, last, single, not_first_nor_last)
onActionCallbackcommon callback for all actions on this page
tickerticker configuration, set to NULL to disable it
infoall information about the centered info to be displayed
modalif true, means this step shall be displayed on top of existing one
Returns
the step context (or NULL if error)

Definition at line 564 of file nbgl_step.c.

◆ nbgl_stepDrawMenuList()

nbgl_step_t nbgl_stepDrawMenuList ( nbgl_stepMenuListCallback_t  onActionCallback,
nbgl_screenTickerConfiguration_t ticker,
nbgl_layoutMenuList_t list,
bool  modal 
)

draw a step page with a menu list and navigation arrows to parse it. This step must be alone

Parameters
onActionCallbackcommon callback for all actions on this page
tickerticker configuration, set to NULL to disable it
listconfiguration of the menu list
modalif true, means this step shall be displayed on top of existing one
Returns
the step context (or NULL if error)

Definition at line 619 of file nbgl_step.c.

◆ nbgl_stepDrawSwitch()

nbgl_step_t nbgl_stepDrawSwitch ( nbgl_stepPosition_t  pos,
nbgl_stepButtonCallback_t  onActionCallback,
nbgl_screenTickerConfiguration_t ticker,
nbgl_layoutSwitch_t switchInfo,
bool  modal 
)

draw a step page with a switch and navigation arrows to navigate to other pages.

Note
Switch name must fit in one line, description on 2 lines max.
Parameters
posposition of this step in the flow (first, last, single, not_first_nor_last)
onActionCallbackcommon callback for all actions on this page
tickerticker configuration, set to NULL to disable it
switchInfoall information about the switch to be displayed
modalif true, means this step shall be displayed on top of existing one
Returns
the step context (or NULL if error)

Definition at line 675 of file nbgl_step.c.

◆ nbgl_stepDrawText()

nbgl_step_t nbgl_stepDrawText ( nbgl_stepPosition_t  pos,
nbgl_stepButtonCallback_t  onActionCallback,
nbgl_screenTickerConfiguration_t ticker,
const char *  text,
const char *  subText,
nbgl_contentCenteredInfoStyle_t  style,
bool  modal 
)

draws a text type step, that can be multi-pages, depending of the length of text and subText. The navigation arrows are displayed depending of the given position of this step in a flow, and depending of the page in case of multi-pages

Parameters
posposition of this step in the flow (first, last, single, not_first_nor_last)
onActionCallbackcommon callback for all actions on this page
tickerticker configuration, set to NULL to disable it
texttext to display (depending of style)
subTexttext to display under text (depending of style)
stylestyle to use for text and subText
modalif true, means this step shall be displayed on top of existing one
Returns
the step context (or NULL if error)

Definition at line 456 of file nbgl_step.c.

◆ nbgl_stepGetMenuListCurrent()

uint8_t nbgl_stepGetMenuListCurrent ( nbgl_step_t  step)

Get the index of the currently selected item in the menulist.

Parameters
stepstep from which to get the current menulist choice
Returns
current menulist choice

Definition at line 654 of file nbgl_step.c.

◆ nbgl_stepRelease()

int nbgl_stepRelease ( nbgl_step_t  step)

Release the step obtained with any of the nbgl_stepDrawXXX() functions.

Parameters
stepstep to release
Returns
>= 0 if OK

Definition at line 726 of file nbgl_step.c.