27#define BACKSPACE_KEY 8
28#define VALIDATE_KEY '\r'
32#ifdef SCREEN_SIZE_WALLET
33#if defined(TARGET_STAX)
34#define KEYBOARD_KEY_HEIGHT 60
35#elif defined(TARGET_FLEX)
36#define KEYBOARD_KEY_HEIGHT 72
37#elif defined(TARGET_APEX)
38#define KEYBOARD_KEY_HEIGHT 51
42#define SHIFT_KEY_INDEX 26
43#define DIGITS_SWITCH_KEY_INDEX 27
44#define BACKSPACE_KEY_INDEX 28
45#define SPACE_KEY_INDEX 29
46#define SPECIAL_KEYS_INDEX 30
49#define KEYBOARD_KEY_WIDTH 14
50#define KEYBOARD_KEY_HEIGHT 14
51#define KEYBOARD_WIDTH (5 * KEYBOARD_KEY_WIDTH)
53#define BACKSPACE_KEY_INDEX 26
54#define VALIDATE_INDEX 27
55#define SHIFT_KEY_INDEX 28
56#define KEYBOARD_MAX_TITLE 20
61#ifdef SCREEN_SIZE_WALLET
62#if defined(TARGET_STAX)
63#define KEYPAD_KEY_HEIGHT 104
64#elif defined(TARGET_FLEX)
65#define KEYPAD_KEY_HEIGHT 88
66#elif defined(TARGET_APEX)
67#define KEYPAD_KEY_HEIGHT 60
70#define KEYPAD_WIDTH 114
71#define KEYPAD_HEIGHT 18
73#define KEYPAD_MAX_DIGITS 12
75#ifdef SCREEN_SIZE_WALLET
77#if defined(TARGET_STAX)
78#define BORDER_MARGIN 24
79#define VERTICAL_BORDER_MARGIN 24
80#elif defined(TARGET_FLEX)
81#define BORDER_MARGIN 32
82#define VERTICAL_BORDER_MARGIN 24
83#elif defined(TARGET_APEX)
84#define BORDER_MARGIN 16
85#define VERTICAL_BORDER_MARGIN 24
89#if defined(TARGET_STAX)
90#define BACK_BUTTON_HEADER_HEIGHT 88
91#elif defined(TARGET_FLEX)
92#define BACK_BUTTON_HEADER_HEIGHT 96
93#elif defined(TARGET_APEX)
94#define BACK_BUTTON_HEADER_HEIGHT 60
98#if COMMON_RADIUS == 40
99#define BUTTON_RADIUS RADIUS_40_PIXELS
100#elif COMMON_RADIUS == 44
101#define BUTTON_RADIUS RADIUS_44_PIXELS
102#elif COMMON_RADIUS == 28
103#define BUTTON_RADIUS RADIUS_28_PIXELS
105#define BUTTON_DIAMETER (COMMON_RADIUS * 2)
107#if defined(TARGET_APEX)
108#define BUTTON_WIDTH (BUTTON_DIAMETER - 2)
110#define BUTTON_WIDTH BUTTON_DIAMETER
114#if defined(TARGET_STAX)
115#define SPINNER_WIDTH 60
116#define SPINNER_HEIGHT 44
117#elif defined(TARGET_FLEX)
118#define SPINNER_WIDTH 64
119#define SPINNER_HEIGHT 48
120#elif defined(TARGET_APEX)
121#define SPINNER_WIDTH 40
122#define SPINNER_HEIGHT 32
126#if defined(TARGET_STAX)
127#define STEPPER_2_PAGES_WIDTH 136
128#define STEPPER_N_PAGES_WIDTH 184
129#elif defined(TARGET_FLEX)
130#define STEPPER_2_PAGES_WIDTH 136
131#define STEPPER_N_PAGES_WIDTH 184
132#elif defined(TARGET_APEX)
133#define STEPPER_2_PAGES_WIDTH 108
134#define STEPPER_N_PAGES_WIDTH 104
138#if defined(TARGET_STAX)
139#define RADIO_WIDTH 32
140#define RADIO_HEIGHT 32
141#elif defined(TARGET_FLEX)
142#define RADIO_WIDTH 40
143#define RADIO_HEIGHT 40
144#elif defined(TARGET_APEX)
145#define RADIO_WIDTH 24
146#define RADIO_HEIGHT 24
152#define NB_MAX_PAGES_WITH_DASHES 6
155#define NB_SPINNER_POSITIONS 4
158#if NB_COLOR_BITS == 1
159#define INACTIVE_COLOR WHITE
160#define INACTIVE_TEXT_COLOR BLACK
161#define INACTIVE_ARROW_COLOR WHITE
162#define INACTIVE_SMALL_FONT SMALL_REGULAR_FONT
163#define LIGHT_TEXT_COLOR BLACK
164#define BUTTON_STROKE 1
166#define INACTIVE_COLOR LIGHT_GRAY
167#define INACTIVE_TEXT_COLOR LIGHT_GRAY
168#define INACTIVE_ARROW_COLOR LIGHT_GRAY
169#define INACTIVE_SMALL_FONT SMALL_BOLD_FONT
170#define LIGHT_TEXT_COLOR DARK_GRAY
171#define BUTTON_STROKE 2
174#define KEYPAD_REINIT_KEYS 0x1F
181 ((1 << SWIPED_UP) | (1 << SWIPED_DOWN) | (1 << SWIPED_LEFT) | (1 << SWIPED_RIGHT))
187#define LEFT_BUTTON 0x01
188#define RIGHT_BUTTON 0x02
189#define BOTH_BUTTONS 0x03
190#define RELEASED_MASK 0x80
191#define CONTINUOUS_MASK 0x40
219#ifdef HAVE_HW_TOUCH_SWIPE
397typedef char *(*onTextDrawCallback_t)(uint8_t token);
515#ifdef SCREEN_SIZE_WALLET
538#ifdef SCREEN_SIZE_WALLET
539 uint8_t softValidation : 1;
540 uint8_t enableDigits : 1;
541 uint8_t digitsChanged : 1;
542 uint8_t validateChanged : 1;
543 uint8_t enableBackspace : 1;
544 uint8_t enableValidate : 1;
545 uint8_t shuffled : 1;
546 uint8_t digitIndexes[5];
624bool nbgl_keyboardGetPosition(
nbgl_keyboard_t *kbd,
char index, uint16_t *x, uint16_t *y);
625bool nbgl_keypadGetPosition(
nbgl_keypad_t *kbd,
char index, uint16_t *x, uint16_t *y);
Semantic icon defines for NBGL.
struct PACKED__ nbgl_line_s nbgl_line_t
struct to represent a vertical or horizontal line
struct PACKED__ nbgl_navigation_bar_s nbgl_page_indicator_t
struct to represent a navigation bar (PAGE_INDICATOR type) There can be up to 5 page indicators,...
struct PACKED__ nbgl_radio_s nbgl_radio_t
struct to represent a radio button (RADIO_BUTTON type)
void(* nbgl_touchCallback_t)(void *obj, nbgl_touchType_t eventType)
prototype of function to be called when a touch event is received by an object
struct PACKED__ nbgl_text_area_s nbgl_text_area_t
struct to represent a text area (TEXT_AREA type)
uint8_t nbgl_containerPoolGetNbUsed(uint8_t layer)
nbgl_icon_details_t *(* onImageDrawCallback_t)(uint8_t token)
prototype of function to be called when a IMAGE object is drawned, and no buffer was provided
void nbgl_objDraw(nbgl_obj_t *obj)
struct PACKED__ nbgl_progress_bar_s nbgl_progress_bar_t
struct to represent a progress bar (PROGRESS_BAR type)
nbgl_obj_t ** nbgl_containerPoolGet(uint8_t nbObjs, uint8_t layer)
struct PACKED__ nbgl_keypad_s nbgl_keypad_t
struct to represent a keypad (KEYPAD type)
void nbgl_refreshReset(void)
struct PACKED__ nbgl_mask_control_s nbgl_mask_control_t
void nbgl_keyboardCallback(nbgl_obj_t *obj, nbgl_buttonEvent_t buttonEvent)
keyboardCase_t
Letters casing in which to open/set the keyboard.
@ LOCKED_UPPER_CASE
locked upper case mode
@ LOWER_CASE
lower case mode
@ UPPER_CASE
upper case mode for one character
nbgl_obj_t * nbgl_objPoolGet(nbgl_obj_type_t type, uint8_t layer)
void nbgl_objAllowDrawing(bool enable)
struct PACKED__ nbgl_text_entry_s nbgl_text_entry_t
struct to represent a text entry area (TEXT_ENTRY type)
struct PACKED__ nbgl_keyboard_s nbgl_keyboard_t
struct to represent a keyboard (KEYBOARD type)
void nbgl_refreshSpecial(nbgl_refresh_mode_t mode)
@ BUTTON_BOTH_TOUCHED
Sent when both buttons are touched.
@ BUTTON_LEFT_CONTINUOUS_PRESSED
@ BUTTON_BOTH_PRESSED
Sent when both buttons are released.
@ BUTTON_RIGHT_CONTINUOUS_PRESSED
@ BUTTON_LEFT_PRESSED
Sent when Left button is released.
@ BUTTON_RIGHT_PRESSED
Send when Right button is released.
void nbgl_containerPoolRelease(uint8_t layer)
struct PACKED__ nbgl_image_s nbgl_image_t
struct to represent an image (IMAGE type)
int nbgl_objPoolGetArray(nbgl_obj_type_t type, uint8_t nbObjs, uint8_t layer, nbgl_obj_t **objArray)
bool nbgl_objIsUx(nbgl_obj_t *obj)
char *(* onTextDrawCallback_t)(uint8_t token)
prototype of function to be called when a TEXT_AREA object is drawned, and no text was provided
uint8_t nbgl_objPoolGetId(nbgl_obj_t *obj)
void nbgl_keypadCallback(nbgl_obj_t *obj, nbgl_buttonEvent_t buttonEvent)
struct PACKED__ nbgl_button_s nbgl_button_t
struct to represent a button (BUTTON type) that can contain a text and/or an icon
void(* nbgl_buttonCallback_t)(void *obj, nbgl_buttonEvent_t buttonEvent)
prototype of function to be called when a button event is received by an object (TODO: change to scre...
keyboardMode_t
Mode in which to open/set the keyboard.
@ MODE_LOWER_LETTERS
lower case letters mode
@ MODE_NONE
no mode defined (only for Nanos)
@ MODE_DIGITS_AND_SPECIALS
digits and some special characters mode
@ MODE_UPPER_LETTERS
upper case letters mode
void nbgl_objDrawKeyboard(nbgl_keyboard_t *kbd)
void nbgl_refreshSpecialWithPostRefresh(nbgl_refresh_mode_t mode, nbgl_post_refresh_t post_refresh)
uint8_t nbgl_objPoolGetNbUsed(uint8_t layer)
void(* keyboardCallback_t)(char touchedKey)
prototype of function to be called when a valid key is pressed on keyboard Backspace is equal to 0x8 ...
void nbgl_objDrawKeypad(nbgl_keypad_t *kbd)
struct PACKED__ nbgl_container_s nbgl_container_t
struct to represent a container (CONTAINER type)
uint8_t * nbgl_objGetRAMBuffer(void)
nbgl_page_indicator_style_t
Style to apply to nbgl_page_indicator_t.
@ CURRENT_INDICATOR
only current page dash is black
@ PROGRESSIVE_INDICATOR
all dashes before active page are black
void nbgl_objPoolRelease(uint8_t layer)
bool nbgl_refreshIsNeeded(void)
struct PACKED__ nbgl_switch_s nbgl_switch_t
struct to represent a switch (size is fixed) (SWITCH type)
struct PACKED__ nbgl_obj_s nbgl_obj_t
Common structure for all graphical objects.
struct PACKED__ nbgl_spinner_s nbgl_spinner_t
struct to represent a "spinner", represented by the Ledger corners, in gray, with one of the corners ...
struct PACKED__ nbgl_image_file_s nbgl_image_file_t
struct to represent an image file object (IMAGE_FILE type) The source of the data is an image file wi...
struct PACKED__ nbgl_qrcode_s nbgl_qrcode_t
struct to represent a QR code (QR_CODE type), whose size is fixed
common types for Graphical Library
uint8_t nbgl_transformation_t
Represents the transformation to be applied on the bitmap before rendering This is a bitfield using m...
nbgl_state_t
to represent a boolean state.
nbgl_post_refresh_t
Post refresh modes.
nbgl_radius_t
possible radius indexes for objects
nbgl_touchType_t
The different types of Touchscreen events.
nbgl_qrcode_version_t
possible modes for QR Code
nbgl_direction_t
Directions for layout or lines.
struct PACKED__ nbgl_icon_details_s nbgl_icon_details_t
Represents all information about an icon.
nbgl_aligment_t
All types of alignments.
nbgl_hardwareSwipe_t
Hardware powered detected swipe states.
nbgl_obj_type_t
All types of graphical objects.
nbgl_touchState_t
the 2 possible states of a finger on the Touchscreen
nbgl_style_t
possible styles for text area border
struct PACKED__ nbgl_area_s nbgl_area_t
Represents a rectangle area of the screen.
nbgl_refresh_mode_t
different modes of refresh for nbgl_refreshSpecial()
struct to represent a container (CONTAINER type)
nbgl_obj_t obj
common part
nbgl_direction_t layout
layout of children inside this object
bool forceClean
if set to true, a paint will be done with background color
nbgl_obj_t ** children
children of this object (nbChildren size)
struct to represent an image file object (IMAGE_FILE type) The source of the data is an image file wi...
const uint8_t * buffer
buffer containing image file
struct to represent an image (IMAGE type)
nbgl_transformation_t transformation
usually NO_TRANSFORMATION
onImageDrawCallback_t onDrawCallback
uint8_t token
token to use as param of onDrawCallback
const nbgl_icon_details_t * buffer
struct to represent a keyboard (KEYBOARD type)
uint8_t selectedCharIndex
color_t textColor
color set to letters.
bool enableValidate
if true, Validate key is enabled
bool lettersOnly
if true, only display letter keys and Backspace
nbgl_obj_t obj
common part
keyboardMode_t mode
keyboard mode to start with
bool enableBackspace
if true, Backspace key is enabled
color_t borderColor
color set to key borders
keyboardCallback_t callback
function called when an active key is pressed
struct to represent a keypad (KEYPAD type)
nbgl_obj_t obj
common part
uint8_t enableValidate
if true, Validate key is enabled
uint8_t selectedKey
selected key position
uint8_t enableBackspace
if true, Backspace key is enabled
uint8_t shuffled
if true, Digit keys are shuffled
keyboardCallback_t callback
function called when an active key is pressed
struct to represent a vertical or horizontal line
nbgl_obj_t obj
common part
nbgl_direction_t direction
direction of the line, e.g VERTICAL or HORIZONTAL
color_t lineColor
color of the line
nbgl_obj_t obj
common part
bool enableMasking
true: Enable masking of area / false: Disable masking of area
uint8_t maskIndex
index of mask
struct to represent a navigation bar (PAGE_INDICATOR type) There can be up to 5 page indicators,...
nbgl_obj_t obj
common part
nbgl_page_indicator_style_t style
Style to apply.
uint8_t activePage
index of active page (from 0 to nbPages-1).
uint8_t nbPages
number of pages.
Common structure for all graphical objects.
uint8_t objId
id of the obj in the screen (only used externally)
uint16_t touchMask
bit mask to tell engine which touch events are handled by this object
struct nbgl_obj_s * parent
parent of this object (automatically set)
nbgl_obj_type_t type
type of the graphical object, must be explicitly set
int16_t alignmentMarginY
vertical margin when aligning
struct nbgl_obj_s * alignTo
object to align to (parent if NULL)
int16_t alignmentMarginX
horizontal margin when aligning
nbgl_aligment_t alignment
type of alignment
struct to represent a progress bar (PROGRESS_BAR type)
color_t foregroundColor
color of the inner progress bar and border (if applicable)
uint8_t withBorder
if set to true, a border in black surround the whole object
uint8_t partialRedraw
set to true to redraw only partially the object (update state).
uint8_t state
state of the progress, in % (from 0 to 100).
struct to represent a QR code (QR_CODE type), whose size is fixed
nbgl_qrcode_version_t version
const char * text
text single line (NULL terminated)
struct to represent a radio button (RADIO_BUTTON type)
color_t activeColor
color set to to inner circle, when active.
color_t borderColor
color set to border.
nbgl_state_t state
state of the radio button. Active is when state == ON_STATE
struct to represent a "spinner", represented by the Ledger corners, in gray, with one of the corners ...
nbgl_obj_t obj
common part
struct to represent a switch (size is fixed) (SWITCH type)
color_t offColor
color set to border and knob, when OFF (knob on the left).
color_t onColor
color set to border and knob, when ON (knob on the right).
nbgl_state_t state
state of the switch.
struct to represent a text area (TEXT_AREA type)
onTextDrawCallback_t onDrawCallback
function called if not NULL to get the text of the text area
uint16_t len
number of bytes to write (if 0, max number of chars or strlen is used)
nbgl_style_t style
to define the style of border
uint8_t wrapping
if set to true, break lines on ' ' when possible
uint8_t nbMaxLines
if >0, only display the nbMaxLines first lines
color_t textColor
color set to '1' bits in text. '0' are set to backgroundColor color.
uint8_t hideEndOfLastLine
if set to true, replace 3 last chars of last line by "..."
uint8_t token
token to use as param of onDrawCallback
nbgl_aligment_t textAlignment
alignment of text within the area
nbgl_font_id_e fontId
id of the font to use
nbgl_obj_t obj
common part
const char * text
ASCII text to draw (NULL terminated). Can be NULL.
struct to represent a text entry area (TEXT_ENTRY type)
nbgl_font_id_e fontId
id of the font to use
const char * text
text to display (up to nbChars chars).
uint8_t nbChars
number of char placeholders to display (8 or 9 chars).
nbgl_obj_t obj
common part
The low level Touchscreen event, coming from driver.
int16_t y
vertical position of the touch (or for a RELEASED the last touched point)
int16_t x
horizontal position of the touch (or for a RELEASED the last touched point)
nbgl_touchState_t state
state of the touch event, e.g PRESSED or RELEASED