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 *********************/
29#ifdef SCREEN_SIZE_WALLET
30#if defined(TARGET_STAX)
31#define SCREEN_WIDTH 400
32#define SCREEN_HEIGHT 672
33#define SMALL_ICON_SIZE 32
34#define LARGE_ICON_SIZE 64
35// height of the smallest used font
36#define SMALL_FONT_HEIGHT 24
37// radius of circle used for controls (buttons)
38#define COMMON_RADIUS 40
39// radius for small buttons
40#define SMALL_BUTTON_RADIUS 32
41// HW vertical alignment
42#define VERTICAL_ALIGNMENT 4
43// Number of color bits
44#define NB_COLOR_BITS 4
45#elif defined(TARGET_FLEX)
46#define SCREEN_WIDTH 480
47#define SCREEN_HEIGHT 600
48#define SMALL_ICON_SIZE 40
49#define LARGE_ICON_SIZE 64
50// height of the smallest used font
51#define SMALL_FONT_HEIGHT 28
52// radius of circle used for controls (buttons)
53#define COMMON_RADIUS 44
54// radius for small buttons
55#define SMALL_BUTTON_RADIUS 32
56// HW vertical alignment
57#define VERTICAL_ALIGNMENT 4
58// Number of color bits
59#define NB_COLOR_BITS 4
60#endif // TARGETS
61#else // SCREEN_SIZE_WALLET
62#define SCREEN_WIDTH 128
63#define SCREEN_HEIGHT 64
64// height of the smallest used font
65#define SMALL_FONT_HEIGHT 11
66// Number of color bits
67#define NB_COLOR_BITS 1
68#endif // SCREEN_SIZE_WALLET
69
74#define NO_TRANSFORMATION 0
75
80#define VERTICAL_MIRROR 0x2
81
86#define ROTATE_90_CLOCKWISE 0x4
87
92#define INVALID_COLOR_MAP 0x0
93
94/**********************
95 * TYPEDEFS
96 **********************/
97#ifndef MIN
98#define MIN(x, y) ((x) < (y) ? (x) : (y))
99#endif
100#ifndef MAX
101#define MAX(x, y) ((x) > (y) ? (x) : (y))
102#endif
103
104#ifdef LINUX_SIMU
105#define PACKED__
106#else // LINUX_SIMU
107#define PACKED__ __attribute__((packed))
108#endif // LINUX_SIMU
109#ifdef BICOLOR_MODE
110
111typedef enum {
112 BLACK = 0,
113 DARK_GRAY = 0,
114 LIGHT_GRAY = 0,
115 WHITE = 3
116} color_t;
117
118#else
119
127
128#endif
129
154
175
183
192
197typedef enum {
199#ifdef SCREEN_SIZE_NANO
200 INVERTED_COLORS
201#endif // SCREEN_SIZE_NANO
203
214
223
234
258
269
280
285#define GZLIB_UNCOMPRESSED_CHUNK 2049
286
301
315
338
343typedef enum {
344#ifdef SCREEN_SIZE_WALLET
350#else // SCREEN_SIZE_WALLET
351 RADIUS_1_PIXEL = 0,
352 RADIUS_3_PIXELS,
353 RADIUS_MAX = RADIUS_3_PIXELS,
354#endif // SCREEN_SIZE_WALLET
357
363
370
382
391
402
403#ifdef __cplusplus
404} /* extern "C" */
405#endif
406
407#endif /* NBGL_TYPES_H */
color_t
Definition nbgl_types.h:120
@ NB_NBGL_COLOR
Definition nbgl_types.h:125
@ WHITE
Definition nbgl_types.h:124
@ DARK_GRAY
Definition nbgl_types.h:122
@ LIGHT_GRAY
Definition nbgl_types.h:123
@ BLACK
Definition nbgl_types.h:121
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:362
nbgl_state_t
to represent a boolean state.
Definition nbgl_types.h:179
@ ON_STATE
Definition nbgl_types.h:181
@ OFF_STATE
Definition nbgl_types.h:180
nbgl_post_refresh_t
Post refresh modes.
Definition nbgl_types.h:332
@ POST_REFRESH_KEEP_POWER_STATE
Keep state after refresh.
Definition nbgl_types.h:336
@ POST_REFRESH_FORCE_POWER_OFF
Force screen power off after refresh.
Definition nbgl_types.h:333
@ POST_REFRESH_FORCE_POWER_ON
Force screen power on after refresh.
Definition nbgl_types.h:334
@ POST_REFRESH_FORCE_POWER_ON_WITH_PIPELINE
Force screen power on and enable pipeline.
Definition nbgl_types.h:335
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:369
nbgl_radius_t
possible radius indexes for objects
Definition nbgl_types.h:343
@ RADIUS_MAX
Definition nbgl_types.h:349
@ RADIUS_0_PIXELS
no radius (square angle)
Definition nbgl_types.h:355
@ RADIUS_8_PIXELS
Definition nbgl_types.h:345
@ RADIUS_32_PIXELS
Definition nbgl_types.h:346
@ RADIUS_44_PIXELS
Definition nbgl_types.h:348
@ RADIUS_40_PIXELS
Definition nbgl_types.h:347
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:239
@ SWIPED_LEFT
Definition nbgl_types.h:255
@ LONG_TOUCHED
Definition nbgl_types.h:242
@ SWIPED_UP
Definition nbgl_types.h:252
@ SWIPED_DOWN
Definition nbgl_types.h:253
@ SWIPED_RIGHT
Definition nbgl_types.h:254
@ VALUE_CHANGED
corresponding to a change of state of the object (indirect event)
Definition nbgl_types.h:251
@ NB_TOUCH_TYPES
Definition nbgl_types.h:256
@ TOUCH_RELEASED
Definition nbgl_types.h:249
@ TOUCHED
Definition nbgl_types.h:240
@ TOUCHING
corresponding to an object that is currently touched
Definition nbgl_types.h:244
@ TOUCH_PRESSED
Definition nbgl_types.h:247
@ OUT_OF_TOUCH
Definition nbgl_types.h:245
nbgl_qrcode_version_t
possible modes for QR Code
Definition nbgl_types.h:209
@ QRCODE_V10
QRCode V10, can encode text len up to 1500 chars, display size = 228*228.
Definition nbgl_types.h:211
@ QRCODE_V4_SMALL
QRCode V4, can encode text len up to 1500 chars, display size = 132*132.
Definition nbgl_types.h:212
@ QRCODE_V4
QRCode V4, can encode text len up to 62 chars, display size = 264*264.
Definition nbgl_types.h:210
nbgl_direction_t
Directions for layout or lines.
Definition nbgl_types.h:188
@ VERTICAL
from top to bottom
Definition nbgl_types.h:189
@ HORIZONTAL
from left to right
Definition nbgl_types.h:190
nbgl_parsingType_t
possible parsings of icons to create animation
Definition nbgl_types.h:387
@ BACK_AND_FORTH_PARSING
0, 1, 2, 1, 2, 0, ...
Definition nbgl_types.h:389
@ LOOP_PARSING
0, 1, 2, 0, 1, 2, ...
Definition nbgl_types.h:388
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:159
@ TOP_MIDDLE
Definition nbgl_types.h:162
@ CENTER
Definition nbgl_types.h:165
@ BOTTOM_RIGHT
Definition nbgl_types.h:169
@ TOP_LEFT
Definition nbgl_types.h:161
@ NO_ALIGNMENT
used when parent container layout is used
Definition nbgl_types.h:160
@ BOTTOM_LEFT
Definition nbgl_types.h:167
@ LEFT_TOP
on outside left
Definition nbgl_types.h:170
@ LEFT_BOTTOM
on outside left
Definition nbgl_types.h:171
@ MID_RIGHT
Definition nbgl_types.h:166
@ RIGHT_TOP
on outside right
Definition nbgl_types.h:172
@ TOP_RIGHT
Definition nbgl_types.h:163
@ MID_LEFT
Definition nbgl_types.h:164
@ BOTTOM_MIDDLE
Definition nbgl_types.h:168
@ RIGHT_BOTTOM
on outside right
Definition nbgl_types.h:173
nbgl_hardwareSwipe_t
Hardware powered detected swipe states.
Definition nbgl_types.h:227
@ HARDWARE_SWIPE_RIGHT
Definition nbgl_types.h:230
@ NO_HARDWARE_SWIPE
Definition nbgl_types.h:232
@ HARDWARE_SWIPE_LEFT
Definition nbgl_types.h:231
@ HARDWARE_SWIPE_DOWN
Definition nbgl_types.h:229
@ HARDWARE_SWIPE_UP
Definition nbgl_types.h:228
nbgl_obj_type_t
All types of graphical objects.
Definition nbgl_types.h:134
@ KEYPAD
Keypad.
Definition nbgl_types.h:147
@ IMAGE
Bitmap (y and height must be multiple of 4 on Stax)
Definition nbgl_types.h:137
@ IMAGE_FILE
Image file (with Ledger compression)
Definition nbgl_types.h:149
@ TEXT_ENTRY
area for entered text, only for Nanos
Definition nbgl_types.h:150
@ NB_OBJ_TYPES
Definition nbgl_types.h:152
@ SWITCH
Switch to turn on/off something.
Definition nbgl_types.h:141
@ RADIO_BUTTON
Indicator to inform whether something is on or off.
Definition nbgl_types.h:144
@ SPINNER
Spinner.
Definition nbgl_types.h:148
@ BUTTON
Rounded rectangle button with icon and/or text.
Definition nbgl_types.h:140
@ PROGRESS_BAR
horizontal bar to indicate progression of something (between 0% and 100%)
Definition nbgl_types.h:143
@ QR_CODE
QR Code.
Definition nbgl_types.h:145
@ PAGE_INDICATOR
horizontal bar to indicate position within pages
Definition nbgl_types.h:142
@ LINE
Vertical or Horizontal line.
Definition nbgl_types.h:138
@ KEYBOARD
Keyboard.
Definition nbgl_types.h:146
@ MASK_CONTROL
OS-specific object to enable/disable masked area.
Definition nbgl_types.h:151
@ CONTAINER
Empty container.
Definition nbgl_types.h:136
@ TEXT_AREA
Area to contain text line(s)
Definition nbgl_types.h:139
@ SCREEN
Main screen.
Definition nbgl_types.h:135
nbgl_touchState_t
the 2 possible states of a finger on the Touchscreen
Definition nbgl_types.h:219
@ PRESSED
the finger is currently pressing the screen
Definition nbgl_types.h:221
@ RELEASED
the finger has been released from the screen
Definition nbgl_types.h:220
nbgl_bpp_t
Enum to represent the number of bits per pixel (BPP)
Definition nbgl_types.h:263
@ NB_NBGL_BPP
Number of NBGL_BPP enums.
Definition nbgl_types.h:267
@ NBGL_BPP_1
1 bit per pixel
Definition nbgl_types.h:264
@ NBGL_BPP_4
4 bits per pixel
Definition nbgl_types.h:266
@ NBGL_BPP_2
2 bits per pixel
Definition nbgl_types.h:265
nbgl_style_t
possible styles for text area border
Definition nbgl_types.h:197
@ NO_STYLE
no border
Definition nbgl_types.h:198
#define PACKED__
Definition nbgl_types.h:107
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:274
@ NBGL_GZLIB_COMPRESSION
gzlib compression
Definition nbgl_types.h:276
@ NBGL_NO_COMPRESSION
no compression, raw data
Definition nbgl_types.h:275
@ NBGL_RLE_COMPRESSION
RLE compression.
Definition nbgl_types.h:277
@ NB_NBGL_COMPRESSION
Number of NBGL_COMPRESSION enums.
Definition nbgl_types.h:278
nbgl_refresh_mode_t
different modes of refresh for nbgl_refreshSpecial()
Definition nbgl_types.h:306
@ BLACK_AND_WHITE_REFRESH
to be used for pure B&W area, when contrast is important
Definition nbgl_types.h:310
@ FULL_COLOR_CLEAN_REFRESH
to be used for lock screen display (cleaner but longer refresh)
Definition nbgl_types.h:309
@ BLACK_AND_WHITE_FAST_REFRESH
to be used for pure B&W area, when contrast is not priority
Definition nbgl_types.h:311
@ FULL_COLOR_PARTIAL_REFRESH
to be used for small partial refresh (radio buttons, switches)
Definition nbgl_types.h:308
@ INIT_REFRESH
to be used to fully clear the screen in white
Definition nbgl_types.h:312
@ NB_REFRESH_MODES
Definition nbgl_types.h:313
@ FULL_COLOR_REFRESH
to be used for normal refresh
Definition nbgl_types.h:307
Represents all information about an animation (succession of icons)
Definition nbgl_types.h:396
uint16_t delayMs
delay between 2 drawings
Definition nbgl_types.h:400
uint8_t nbIcons
number of icons in icons array
Definition nbgl_types.h:398
const nbgl_icon_details_t ** icons
array of nbIcons pointers on icons
Definition nbgl_types.h:397
nbgl_parsingType_t parsing
Definition nbgl_types.h:399
Represents a rectangle area of the screen.
Definition nbgl_types.h:291
color_t backgroundColor
color (usually background) to be applied
Definition nbgl_types.h:298
uint16_t width
width of the area, in pixels
Definition nbgl_types.h:296
int16_t y0
Definition nbgl_types.h:294
int16_t x0
Definition nbgl_types.h:292
nbgl_bpp_t bpp
bits per pixel for this area
Definition nbgl_types.h:299
uint16_t height
height of the area, in pixels
Definition nbgl_types.h:297
Represents all information about an icon.
Definition nbgl_types.h:375
bool isFile
if true, the bitmap buffer contains an image file
Definition nbgl_types.h:379
uint16_t width
width of the icon, in pixels
Definition nbgl_types.h:376
const uint8_t * bitmap
buffer containing pixel values
Definition nbgl_types.h:380
nbgl_bpp_t bpp
bits per pixel for this area
Definition nbgl_types.h:378
uint16_t height
height of the icon, in pixels
Definition nbgl_types.h:377
signed short int16_t
Definition usbd_conf.h:50
unsigned short uint16_t
Definition usbd_conf.h:54
unsigned char uint8_t
Definition usbd_conf.h:53