Skip to content

Commit

Permalink
Support assert_display_exit() for apps for Nano built on NBGL
Browse files Browse the repository at this point in the history
  • Loading branch information
nroggeman-ledger committed Jan 15, 2024
1 parent 438bcdf commit b794d87
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/ledger_assert.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
#include "os_io_seproxyhal.h"

#ifdef HAVE_NBGL
#ifdef TARGET_STAX
#include "nbgl_use_case.h"
#else // TARGET_STAX
#include "nbgl_flow.h"
#endif // TARGET_STAX
#endif

#ifndef ASSERT_BUFFER_LEN
Expand Down Expand Up @@ -127,6 +131,18 @@ UX_STEP_CB(ux_error,
});
UX_FLOW(ux_error_flow, &ux_error);
#endif
#ifdef HAVE_NBGL
#ifndef TARGET_STAX
static void assert_exit_true(void)
{
assert_exit(true);
}

static const nbgl_stepDesc_t error_flow[] = {
{.text = "\bApp error", .subText = assert_buffer, .callback = assert_exit_true}
};
#endif // TARGET_STAX
#endif

void __attribute__((noreturn)) assert_display_exit(void)
{
Expand All @@ -135,8 +151,12 @@ void __attribute__((noreturn)) assert_display_exit(void)
#endif

#ifdef HAVE_NBGL
#ifdef TARGET_STAX
nbgl_useCaseChoice(
&C_round_warning_64px, "App error", assert_buffer, "Exit app", "Exit app", assert_exit);
#else // TARGET_STAX
nbgl_flowDraw(error_flow, 1, 0, false, false);
#endif // TARGET_STAX
#endif

// Block until the user approve and the app is quit
Expand Down

0 comments on commit b794d87

Please sign in to comment.