21 #define NB_MAX_LAYERS 3
26 typedef struct FlowContext_s {
38 static FlowContext_t contexts[NB_MAX_LAYERS];
50 static FlowContext_t *getFreeContext(
bool modal)
52 FlowContext_t *ctx = NULL;
60 while (i < NB_MAX_LAYERS) {
61 if (contexts[i].stepCtx == NULL) {
79 static FlowContext_t *getContextFromStepCtx(
nbgl_step_t stepCtx)
81 FlowContext_t *ctx = NULL;
83 while (i < NB_MAX_LAYERS) {
84 if (contexts[i].stepCtx == stepCtx) {
97 static void drawStep(FlowContext_t *ctx,
105 if ((ctx->loop) && (ctx->nbSteps > 1)) {
114 =
nbgl_stepDrawText(pos, actionCallback, NULL, txt, subTxt, REGULAR_INFO, modal);
121 info.
style = REGULAR_INFO;
131 FlowContext_t *ctx = getContextFromStepCtx(stepCtx);
149 if (ctx->steps[ctx->curStep].callback != NULL) {
150 ctx->steps[ctx->curStep].callback();
158 #ifdef HAVE_LANGUAGE_PACK
159 const char *txt = (step->
text != NULL)
163 const char *txt = step->
text;
167 if (step->
init != NULL) {
170 drawStep(ctx, pos, ctx->modal, step->
icon, txt, step->
subText);
195 #ifdef HAVE_LANGUAGE_PACK
196 const char *txt = (step->
text != NULL)
200 const char *txt = step->
text;
203 FlowContext_t *ctx = getFreeContext(modal);
209 ctx->nbSteps = nbSteps;
210 ctx->curStep = initStep;
213 if (step->
init != NULL) {
217 drawStep(ctx, pos, ctx->modal, step->
icon, txt, step->
subText);
229 FlowContext_t *ctx = (FlowContext_t *) flow;
#define LOG_WARN(__logger,...)
#define LOG_DEBUG(__logger,...)
#define LOG_FATAL(__logger,...)
Flow construction API of NBGL.
void nbgl_flowRelease(nbgl_flow_t flow)
void * nbgl_flow_t
type shared externally
nbgl_flow_t nbgl_flowDraw(const nbgl_stepDesc_t *steps, uint8_t nbSteps, uint8_t initStep, bool loop, bool modal)
const char * get_ux_loc_string(uint32_t index)
void nbgl_refresh(void)
This functions refreshes the actual screen on display with what has changed since the last refresh.
@ BUTTON_BOTH_PRESSED
Sent when both buttons are released.
@ BUTTON_LEFT_PRESSED
Sent when Left button is released.
@ BUTTON_RIGHT_PRESSED
Send when Right button is released.
#define GET_POS_OF_STEP(_step, _nb_steps)
@ NEITHER_FIRST_NOR_LAST_STEP
neither first nor last in a multiple steps flow
void * nbgl_step_t
type shared externally
uint8_t nbgl_stepPosition_t
this type contains nbgl_layoutNavIndication_t in its LSBs and direction in its MSB (using FORWARD_DIR...
int nbgl_stepRelease(nbgl_step_t step)
#define FORWARD_DIRECTION
When the flow is navigated from last to first step.
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)
nbgl_step_t nbgl_stepDrawCenteredInfo(nbgl_stepPosition_t pos, nbgl_stepButtonCallback_t onActionCallback, nbgl_screenTickerConfiguration_t *ticker, nbgl_layoutCenteredInfo_t *info, bool modal)
#define BACKWARD_DIRECTION
struct PACKED__ nbgl_icon_details_s nbgl_icon_details_t
Represents all information about an icon.
This structure contains info to build a centered (vertically and horizontally) area,...
const char * text2
second text (can be null)
const char * text1
first text (can be null)
bool onTop
if set to true, align only horizontally
nbgl_contentCenteredInfoStyle_t style
style to apply to this info
const nbgl_icon_details_t * icon
a buffer containing the 1BPP icon
Structure containing all specific information when creating a NBGL step.
const char * subText
sub-text to display in step (NULL most of the time)
const nbgl_icon_details_t * icon
icon to display in step (text must be single-page)
nbgl_stepCallback_t init
if not NULL, function to be called when the step is entered
const char * text
text to display in step (can be multi-pages if icon == NULL)