Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
nbgl_types.h
Go to the documentation of this file.
1
7#ifndef NBGL_TYPES_H
8#define NBGL_TYPES_H
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14/*********************
15 * INCLUDES
16 *********************/
17#include <stddef.h>
18#include <stdint.h>
19#include <stdbool.h>
20#include "app_config.h"
21#include "bolos_target.h"
22
23/*********************
24 * DEFINES
25 *********************/
41#ifdef SCREEN_SIZE_WALLET
42#if defined(TARGET_STAX)
43#define SCREEN_WIDTH 400
44#define SCREEN_HEIGHT 672
45#define SMALL_ICON_SIZE 32
46#define LARGE_ICON_SIZE 64
47// height of the smallest used font
48#define SMALL_FONT_HEIGHT 24
49// radius of circle used for controls (buttons)
50#define COMMON_RADIUS 40
51// radius for small buttons
52#define SMALL_BUTTON_RADIUS 32
53// HW vertical alignment
54#define VERTICAL_ALIGNMENT 4
55// Number of color bits
56#define NB_COLOR_BITS 4
57#elif defined(TARGET_FLEX)
58#define SCREEN_WIDTH 480
59#define SCREEN_HEIGHT 600
60#define SMALL_ICON_SIZE 40
61#define LARGE_ICON_SIZE 64
62// height of the smallest used font
63#define SMALL_FONT_HEIGHT 28
64// radius of circle used for controls (buttons)
65#define COMMON_RADIUS 44
66// radius for small buttons
67#define SMALL_BUTTON_RADIUS 32
68// HW vertical alignment
69#define VERTICAL_ALIGNMENT 4
70// Number of color bits
71#define NB_COLOR_BITS 4
72#elif defined(TARGET_APEX)
73#define SCREEN_WIDTH 300
74#define SCREEN_HEIGHT 400
75#define SMALL_ICON_SIZE 24
76#define LARGE_ICON_SIZE 48
77// height of the smallest used font
78#define SMALL_FONT_HEIGHT 18
79// radius of corners used for controls (buttons)
80#define COMMON_RADIUS 28
81// radius for small buttons
82#define SMALL_BUTTON_RADIUS 20
83// HW vertical alignment
84#define VERTICAL_ALIGNMENT 8
85// Number of color bits
86#define NB_COLOR_BITS 1
87#endif // TARGETS
88#else // SCREEN_SIZE_WALLET
89#define SCREEN_WIDTH 128
90#define SCREEN_HEIGHT 64
91// height of the smallest used font
92#define SMALL_FONT_HEIGHT 11
93// HW vertical alignment
94#define VERTICAL_ALIGNMENT 1
95// Number of color bits
96#define NB_COLOR_BITS 1
97#endif // SCREEN_SIZE_WALLET
98
103#define NO_TRANSFORMATION 0
104
109#define VERTICAL_MIRROR 0x2
110
115#define ROTATE_90_CLOCKWISE 0x4
116
121#define INVALID_COLOR_MAP 0x0
122
123#define NBGL_LOWER_ALIGN(__y) ((__y) & ~(VERTICAL_ALIGNMENT - 1))
124#define NBGL_UPPER_ALIGN(__y) (((__y) + VERTICAL_ALIGNMENT - 1) & ~(VERTICAL_ALIGNMENT - 1))
125
126/**********************
127 * TYPEDEFS
128 **********************/
129#ifndef MIN
130#define MIN(x, y) ((x) < (y) ? (x) : (y))
131#endif
132#ifndef MAX
133#define MAX(x, y) ((x) > (y) ? (x) : (y))
134#endif
135
136#ifdef LINUX_SIMU
137#define PACKED__
138#else // LINUX_SIMU
139#define PACKED__ __attribute__((packed))
140#endif // LINUX_SIMU
141#ifdef BICOLOR_MODE
142
143typedef enum {
144 BLACK = 0,
145 DARK_GRAY = 0,
146 LIGHT_GRAY = 0,
147 WHITE = 3
148} color_t;
149
150#else
151
159
160#endif
161
186
207
215
224
229typedef enum {
231#ifdef SCREEN_SIZE_NANO
232 INVERTED_COLORS
233#endif // SCREEN_SIZE_NANO
235
246
255
266
289
300
311
316#define GZLIB_UNCOMPRESSED_CHUNK 2049
317
332
346
369
374typedef enum {
375#ifdef SCREEN_SIZE_WALLET
382#else // SCREEN_SIZE_WALLET
383 RADIUS_1_PIXEL = 0,
384 RADIUS_3_PIXELS,
385 RADIUS_MAX = RADIUS_3_PIXELS,
386#endif // SCREEN_SIZE_WALLET
389
394typedef uint8_t nbgl_transformation_t;
395
401typedef uint8_t nbgl_color_map_t;
402
414
423
428typedef struct nbgl_animation_s {
430 uint8_t nbIcons;
431 nbgl_parsingType_t parsing; // type of parsing of icons
432 uint16_t delayMs;
434
435#ifdef __cplusplus
436} /* extern "C" */
437#endif
438
439#endif /* NBGL_TYPES_H */
color_t
Definition nbgl_types.h:152
@ NB_NBGL_COLOR
Definition nbgl_types.h:157
@ WHITE
Definition nbgl_types.h:156
@ DARK_GRAY
Definition nbgl_types.h:154
@ LIGHT_GRAY
Definition nbgl_types.h:155
@ BLACK
Definition nbgl_types.h:153
uint8_t nbgl_transformation_t
Represents the transformation to be applied on the bitmap before rendering This is a bitfield using m...
Definition nbgl_types.h:394
nbgl_state_t
to represent a boolean state.
Definition nbgl_types.h:211
@ ON_STATE
Definition nbgl_types.h:213
@ OFF_STATE
Definition nbgl_types.h:212
nbgl_post_refresh_t
Post refresh modes.
Definition nbgl_types.h:363
@ POST_REFRESH_KEEP_POWER_STATE
Keep state after refresh.
Definition nbgl_types.h:367
@ POST_REFRESH_FORCE_POWER_OFF
Force screen power off after refresh.
Definition nbgl_types.h:364
@ POST_REFRESH_FORCE_POWER_ON
Force screen power on after refresh.
Definition nbgl_types.h:365
@ POST_REFRESH_FORCE_POWER_ON_WITH_PIPELINE
Force screen power on and enable pipeline.
Definition nbgl_types.h:366
uint8_t nbgl_color_map_t
Represents the color_map to be used for 2BPP image, or the foreground color for 1BPP image.
Definition nbgl_types.h:401
nbgl_radius_t
possible radius indexes for objects
Definition nbgl_types.h:374
@ RADIUS_MAX
Definition nbgl_types.h:381
@ RADIUS_0_PIXELS
no radius (square angle)
Definition nbgl_types.h:387
@ RADIUS_28_PIXELS
Definition nbgl_types.h:377
@ RADIUS_32_PIXELS
Definition nbgl_types.h:378
@ RADIUS_44_PIXELS
Definition nbgl_types.h:380
@ RADIUS_20_PIXELS
Definition nbgl_types.h:376
@ RADIUS_40_PIXELS
Definition nbgl_types.h:379
struct nbgl_animation_s nbgl_animation_t
Represents all information about an animation (succession of icons)
nbgl_touchType_t
The different types of Touchscreen events.
Definition nbgl_types.h:271
@ SWIPED_LEFT
Definition nbgl_types.h:286
@ LONG_TOUCHED
Definition nbgl_types.h:274
@ SWIPED_UP
Definition nbgl_types.h:283
@ SWIPED_DOWN
Definition nbgl_types.h:284
@ SWIPED_RIGHT
Definition nbgl_types.h:285
@ NB_TOUCH_TYPES
Definition nbgl_types.h:287
@ TOUCH_RELEASED
Definition nbgl_types.h:281
@ TOUCHED
Definition nbgl_types.h:272
@ TOUCHING
corresponding to an object that is currently touched
Definition nbgl_types.h:276
@ TOUCH_PRESSED
Definition nbgl_types.h:279
@ OUT_OF_TOUCH
Definition nbgl_types.h:277
nbgl_qrcode_version_t
possible modes for QR Code
Definition nbgl_types.h:241
@ QRCODE_V10
QRCode V10, can encode text len up to 1500 chars, display size = 228*228.
Definition nbgl_types.h:243
@ QRCODE_V4_SMALL
QRCode V4, can encode text len up to 1500 chars, display size = 132*132.
Definition nbgl_types.h:244
@ QRCODE_V4
QRCode V4, can encode text len up to 62 chars, display size = 264*264.
Definition nbgl_types.h:242
nbgl_direction_t
Directions for layout or lines.
Definition nbgl_types.h:220
@ VERTICAL
from top to bottom
Definition nbgl_types.h:221
@ HORIZONTAL
from left to right
Definition nbgl_types.h:222
nbgl_parsingType_t
possible parsings of icons to create animation
Definition nbgl_types.h:419
@ BACK_AND_FORTH_PARSING
0, 1, 2, 1, 2, 0, ...
Definition nbgl_types.h:421
@ LOOP_PARSING
0, 1, 2, 0, 1, 2, ...
Definition nbgl_types.h:420
struct PACKED__ nbgl_icon_details_s nbgl_icon_details_t
Represents all information about an icon.
nbgl_aligment_t
All types of alignments.
Definition nbgl_types.h:191
@ TOP_MIDDLE
Definition nbgl_types.h:194
@ CENTER
Definition nbgl_types.h:197
@ BOTTOM_RIGHT
Definition nbgl_types.h:201
@ TOP_LEFT
Definition nbgl_types.h:193
@ NO_ALIGNMENT
used when parent container layout is used
Definition nbgl_types.h:192
@ BOTTOM_LEFT
Definition nbgl_types.h:199
@ LEFT_TOP
on outside left
Definition nbgl_types.h:202
@ LEFT_BOTTOM
on outside left
Definition nbgl_types.h:203
@ MID_RIGHT
Definition nbgl_types.h:198
@ RIGHT_TOP
on outside right
Definition nbgl_types.h:204
@ TOP_RIGHT
Definition nbgl_types.h:195
@ MID_LEFT
Definition nbgl_types.h:196
@ BOTTOM_MIDDLE
Definition nbgl_types.h:200
@ RIGHT_BOTTOM
on outside right
Definition nbgl_types.h:205
nbgl_hardwareSwipe_t
Hardware powered detected swipe states.
Definition nbgl_types.h:259
@ HARDWARE_SWIPE_RIGHT
Definition nbgl_types.h:262
@ NO_HARDWARE_SWIPE
Definition nbgl_types.h:264
@ HARDWARE_SWIPE_LEFT
Definition nbgl_types.h:263
@ HARDWARE_SWIPE_DOWN
Definition nbgl_types.h:261
@ HARDWARE_SWIPE_UP
Definition nbgl_types.h:260
nbgl_obj_type_t
All types of graphical objects.
Definition nbgl_types.h:166
@ KEYPAD
Keypad.
Definition nbgl_types.h:179
@ IMAGE
Bitmap (y and height must be multiple of 4 on Stax)
Definition nbgl_types.h:169
@ IMAGE_FILE
Image file (with Ledger compression)
Definition nbgl_types.h:181
@ TEXT_ENTRY
area for entered text, only for Nanos
Definition nbgl_types.h:182
@ NB_OBJ_TYPES
Definition nbgl_types.h:184
@ SWITCH
Switch to turn on/off something.
Definition nbgl_types.h:173
@ RADIO_BUTTON
Indicator to inform whether something is on or off.
Definition nbgl_types.h:176
@ SPINNER
Spinner.
Definition nbgl_types.h:180
@ BUTTON
Rounded rectangle button with icon and/or text.
Definition nbgl_types.h:172
@ PROGRESS_BAR
horizontal bar to indicate progression of something (between 0% and 100%)
Definition nbgl_types.h:175
@ QR_CODE
QR Code.
Definition nbgl_types.h:177
@ PAGE_INDICATOR
horizontal bar to indicate position within pages
Definition nbgl_types.h:174
@ LINE
Vertical or Horizontal line.
Definition nbgl_types.h:170
@ KEYBOARD
Keyboard.
Definition nbgl_types.h:178
@ MASK_CONTROL
OS-specific object to enable/disable masked area.
Definition nbgl_types.h:183
@ CONTAINER
Empty container.
Definition nbgl_types.h:168
@ TEXT_AREA
Area to contain text line(s)
Definition nbgl_types.h:171
@ SCREEN
Main screen.
Definition nbgl_types.h:167
nbgl_touchState_t
the 2 possible states of a finger on the Touchscreen
Definition nbgl_types.h:251
@ PRESSED
the finger is currently pressing the screen
Definition nbgl_types.h:253
@ RELEASED
the finger has been released from the screen
Definition nbgl_types.h:252
nbgl_bpp_t
Enum to represent the number of bits per pixel (BPP)
Definition nbgl_types.h:294
@ NB_NBGL_BPP
Number of NBGL_BPP enums.
Definition nbgl_types.h:298
@ NBGL_BPP_1
1 bit per pixel
Definition nbgl_types.h:295
@ NBGL_BPP_4
4 bits per pixel
Definition nbgl_types.h:297
@ NBGL_BPP_2
2 bits per pixel
Definition nbgl_types.h:296
nbgl_style_t
possible styles for text area border
Definition nbgl_types.h:229
@ NO_STYLE
no border
Definition nbgl_types.h:230
#define PACKED__
Definition nbgl_types.h:139
struct PACKED__ nbgl_area_s nbgl_area_t
Represents a rectangle area of the screen.
nbgl_compression_t
Enum to represent the compression.
Definition nbgl_types.h:305
@ NBGL_GZLIB_COMPRESSION
gzlib compression
Definition nbgl_types.h:307
@ NBGL_NO_COMPRESSION
no compression, raw data
Definition nbgl_types.h:306
@ NBGL_RLE_COMPRESSION
RLE compression.
Definition nbgl_types.h:308
@ NB_NBGL_COMPRESSION
Number of NBGL_COMPRESSION enums.
Definition nbgl_types.h:309
nbgl_refresh_mode_t
different modes of refresh for nbgl_refreshSpecial()
Definition nbgl_types.h:337
@ BLACK_AND_WHITE_REFRESH
to be used for pure B&W area, when contrast is important
Definition nbgl_types.h:341
@ FULL_COLOR_CLEAN_REFRESH
to be used for lock screen display (cleaner but longer refresh)
Definition nbgl_types.h:340
@ BLACK_AND_WHITE_FAST_REFRESH
to be used for pure B&W area, when contrast is not priority
Definition nbgl_types.h:342
@ FULL_COLOR_PARTIAL_REFRESH
to be used for small partial refresh (radio buttons, switches)
Definition nbgl_types.h:339
@ INIT_REFRESH
to be used to fully clear the screen in white
Definition nbgl_types.h:343
@ NB_REFRESH_MODES
Definition nbgl_types.h:344
@ FULL_COLOR_REFRESH
to be used for normal refresh
Definition nbgl_types.h:338
Represents all information about an animation (succession of icons)
Definition nbgl_types.h:428
uint16_t delayMs
delay between 2 drawings
Definition nbgl_types.h:432
uint8_t nbIcons
number of icons in icons array
Definition nbgl_types.h:430
const nbgl_icon_details_t ** icons
array of nbIcons pointers on icons
Definition nbgl_types.h:429
nbgl_parsingType_t parsing
Definition nbgl_types.h:431
Represents a rectangle area of the screen.
Definition nbgl_types.h:322
color_t backgroundColor
color (usually background) to be applied
Definition nbgl_types.h:329
uint16_t width
width of the area, in pixels
Definition nbgl_types.h:327
int16_t y0
Definition nbgl_types.h:325
int16_t x0
Definition nbgl_types.h:323
nbgl_bpp_t bpp
bits per pixel for this area
Definition nbgl_types.h:330
uint16_t height
height of the area, in pixels
Definition nbgl_types.h:328
Represents all information about an icon.
Definition nbgl_types.h:407
bool isFile
if true, the bitmap buffer contains an image file
Definition nbgl_types.h:411
uint16_t width
width of the icon, in pixels
Definition nbgl_types.h:408
const uint8_t * bitmap
buffer containing pixel values
Definition nbgl_types.h:412
nbgl_bpp_t bpp
bits per pixel for this area
Definition nbgl_types.h:410
uint16_t height
height of the icon, in pixels
Definition nbgl_types.h:409