Skip to content

Commit

Permalink
Add setter functions in ux_sync lib for synchronous call return code …
Browse files Browse the repository at this point in the history
…and "end of flow" variables.
  • Loading branch information
agrojean-ledger committed Jun 24, 2024
1 parent 2e56806 commit 7ab8b0b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib_ux_sync/include/ux_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ typedef enum {
UX_SYNC_RET_ERROR
} ux_sync_ret_t;

void ux_sync_setReturnCode(ux_sync_ret_t ret);

void ux_sync_setEnded(bool ended);

ux_sync_ret_t ux_sync_homeAndSettings(const char *appName,
const nbgl_icon_details_t *appIcon,
const char *tagline,
Expand Down
23 changes: 23 additions & 0 deletions lib_ux_sync/src/ux_sync.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifdef HAVE_NBGL

#include "ux_sync.h"
#include "os_helpers.h"

static ux_sync_ret_t g_ret;
static bool g_ended;
Expand Down Expand Up @@ -49,6 +50,28 @@ static ux_sync_ret_t ux_sync_wait(bool exitOnApdu)
return g_ret;
}

/**
* @brief Sets the return code of synchronous UX calls. Can be used by content action callbacks
* defined by application code.
*
* @param ret return code to set.
*/
void ux_sync_setReturnCode(ux_sync_ret_t ret)
{
g_ret = ret;
}

/**
* @brief Sets the ended flag of synchronous UX calls. Can be used by content action callbacks
* defined by application code to end the UX flow.
*
* @param ended flag to set.
*/
void ux_sync_setEnded(bool ended)
{
g_ended = ended;
}

/**
* @brief Draws the extended version of home page of an app (page on which we land when launching it
* from dashboard) with automatic support of setting display.
Expand Down

0 comments on commit 7ab8b0b

Please sign in to comment.