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// HW vertical alignment
67#define VERTICAL_ALIGNMENT 1
68// Number of color bits
69#define NB_COLOR_BITS 1
70#endif // SCREEN_SIZE_WALLET
71
76#define NO_TRANSFORMATION 0
77
82#define VERTICAL_MIRROR 0x2
83
88#define ROTATE_90_CLOCKWISE 0x4
89
94#define INVALID_COLOR_MAP 0x0
95
96/**********************
97 * TYPEDEFS
98 **********************/
99#ifndef MIN
100#define MIN(x, y) ((x) < (y) ? (x) : (y))
101#endif
102#ifndef MAX
103#define MAX(x, y) ((x) > (y) ? (x) : (y))
104#endif
105
106#ifdef LINUX_SIMU
107#define PACKED__
108#else // LINUX_SIMU
109#define PACKED__ __attribute__((packed))
110#endif // LINUX_SIMU
111#ifdef BICOLOR_MODE
112
113typedef enum {
114 BLACK = 0,
115 DARK_GRAY = 0,
116 LIGHT_GRAY = 0,
117 WHITE = 3
118} color_t;
119
120#else
121
129
130#endif
131
156
177
185
194
199typedef enum {
201#ifdef SCREEN_SIZE_NANO
202 INVERTED_COLORS
203#endif // SCREEN_SIZE_NANO
205
216
225
236
260
271
282
287#define GZLIB_UNCOMPRESSED_CHUNK 2049
288
303
317
340
345typedef enum {
346#ifdef SCREEN_SIZE_WALLET
352#else // SCREEN_SIZE_WALLET
353 RADIUS_1_PIXEL = 0,
354 RADIUS_3_PIXELS,
355 RADIUS_MAX = RADIUS_3_PIXELS,
356#endif // SCREEN_SIZE_WALLET
359
365
372
384
393
404
405#ifdef __cplusplus
406} /* extern "C" */
407#endif
408
409#endif /* NBGL_TYPES_H */
color_t
Definition nbgl_types.h:122
@ NB_NBGL_COLOR
Definition nbgl_types.h:127
@ WHITE
Definition nbgl_types.h:126
@ DARK_GRAY
Definition nbgl_types.h:124
@ LIGHT_GRAY
Definition nbgl_types.h:125
@ BLACK
Definition nbgl_types.h:123
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:364
nbgl_state_t
to represent a boolean state.
Definition nbgl_types.h:181
@ ON_STATE
Definition nbgl_types.h:183
@ OFF_STATE
Definition nbgl_types.h:182
nbgl_post_refresh_t
Post refresh modes.
Definition nbgl_types.h:334
@ POST_REFRESH_KEEP_POWER_STATE
Keep state after refresh.
Definition nbgl_types.h:338
@ POST_REFRESH_FORCE_POWER_OFF
Force screen power off after refresh.
Definition nbgl_types.h:335
@ POST_REFRESH_FORCE_POWER_ON
Force screen power on after refresh.
Definition nbgl_types.h:336
@ POST_REFRESH_FORCE_POWER_ON_WITH_PIPELINE
Force screen power on and enable pipeline.
Definition nbgl_types.h:337
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:371
nbgl_radius_t
possible radius indexes for objects
Definition nbgl_types.h:345
@ RADIUS_MAX
Definition nbgl_types.h:351
@ RADIUS_0_PIXELS
no radius (square angle)
Definition nbgl_types.h:357
@ RADIUS_8_PIXELS
Definition nbgl_types.h:347
@ RADIUS_32_PIXELS
Definition nbgl_types.h:348
@ RADIUS_44_PIXELS
Definition nbgl_types.h:350
@ RADIUS_40_PIXELS
Definition nbgl_types.h:349
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:241
@ SWIPED_LEFT
Definition nbgl_types.h:257
@ LONG_TOUCHED
Definition nbgl_types.h:244
@ SWIPED_UP
Definition nbgl_types.h:254
@ SWIPED_DOWN
Definition nbgl_types.h:255
@ SWIPED_RIGHT
Definition nbgl_types.h:256
@ VALUE_CHANGED
corresponding to a change of state of the object (indirect event)
Definition nbgl_types.h:253
@ NB_TOUCH_TYPES
Definition nbgl_types.h:258
@ TOUCH_RELEASED
Definition nbgl_types.h:251
@ TOUCHED
Definition nbgl_types.h:242
@ TOUCHING
corresponding to an object that is currently touched
Definition nbgl_types.h:246
@ TOUCH_PRESSED
Definition nbgl_types.h:249
@ OUT_OF_TOUCH
Definition nbgl_types.h:247
nbgl_qrcode_version_t
possible modes for QR Code
Definition nbgl_types.h:211
@ QRCODE_V10
QRCode V10, can encode text len up to 1500 chars, display size = 228*228.
Definition nbgl_types.h:213
@ QRCODE_V4_SMALL
QRCode V4, can encode text len up to 1500 chars, display size = 132*132.
Definition nbgl_types.h:214
@ QRCODE_V4
QRCode V4, can encode text len up to 62 chars, display size = 264*264.
Definition nbgl_types.h:212
nbgl_direction_t
Directions for layout or lines.
Definition nbgl_types.h:190
@ VERTICAL
from top to bottom
Definition nbgl_types.h:191
@ HORIZONTAL
from left to right
Definition nbgl_types.h:192
nbgl_parsingType_t
possible parsings of icons to create animation
Definition nbgl_types.h:389
@ BACK_AND_FORTH_PARSING
0, 1, 2, 1, 2, 0, ...
Definition nbgl_types.h:391
@ LOOP_PARSING
0, 1, 2, 0, 1, 2, ...
Definition nbgl_types.h:390
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:161
@ TOP_MIDDLE
Definition nbgl_types.h:164
@ CENTER
Definition nbgl_types.h:167
@ BOTTOM_RIGHT
Definition nbgl_types.h:171
@ TOP_LEFT
Definition nbgl_types.h:163
@ NO_ALIGNMENT
used when parent container layout is used
Definition nbgl_types.h:162
@ BOTTOM_LEFT
Definition nbgl_types.h:169
@ LEFT_TOP
on outside left
Definition nbgl_types.h:172
@ LEFT_BOTTOM
on outside left
Definition nbgl_types.h:173
@ MID_RIGHT
Definition nbgl_types.h:168
@ RIGHT_TOP
on outside right
Definition nbgl_types.h:174
@ TOP_RIGHT
Definition nbgl_types.h:165
@ MID_LEFT
Definition nbgl_types.h:166
@ BOTTOM_MIDDLE
Definition nbgl_types.h:170
@ RIGHT_BOTTOM
on outside right
Definition nbgl_types.h:175
nbgl_hardwareSwipe_t
Hardware powered detected swipe states.
Definition nbgl_types.h:229
@ HARDWARE_SWIPE_RIGHT
Definition nbgl_types.h:232
@ NO_HARDWARE_SWIPE
Definition nbgl_types.h:234
@ HARDWARE_SWIPE_LEFT
Definition nbgl_types.h:233
@ HARDWARE_SWIPE_DOWN
Definition nbgl_types.h:231
@ HARDWARE_SWIPE_UP
Definition nbgl_types.h:230
nbgl_obj_type_t
All types of graphical objects.
Definition nbgl_types.h:136
@ KEYPAD
Keypad.
Definition nbgl_types.h:149
@ IMAGE
Bitmap (y and height must be multiple of 4 on Stax)
Definition nbgl_types.h:139
@ IMAGE_FILE
Image file (with Ledger compression)
Definition nbgl_types.h:151
@ TEXT_ENTRY
area for entered text, only for Nanos
Definition nbgl_types.h:152
@ NB_OBJ_TYPES
Definition nbgl_types.h:154
@ SWITCH
Switch to turn on/off something.
Definition nbgl_types.h:143
@ RADIO_BUTTON
Indicator to inform whether something is on or off.
Definition nbgl_types.h:146
@ SPINNER
Spinner.
Definition nbgl_types.h:150
@ BUTTON
Rounded rectangle button with icon and/or text.
Definition nbgl_types.h:142
@ PROGRESS_BAR
horizontal bar to indicate progression of something (between 0% and 100%)
Definition nbgl_types.h:145
@ QR_CODE
QR Code.
Definition nbgl_types.h:147
@ PAGE_INDICATOR
horizontal bar to indicate position within pages
Definition nbgl_types.h:144
@ LINE
Vertical or Horizontal line.
Definition nbgl_types.h:140
@ KEYBOARD
Keyboard.
Definition nbgl_types.h:148
@ MASK_CONTROL
OS-specific object to enable/disable masked area.
Definition nbgl_types.h:153
@ CONTAINER
Empty container.
Definition nbgl_types.h:138
@ TEXT_AREA
Area to contain text line(s)
Definition nbgl_types.h:141
@ SCREEN
Main screen.
Definition nbgl_types.h:137
nbgl_touchState_t
the 2 possible states of a finger on the Touchscreen
Definition nbgl_types.h:221
@ PRESSED
the finger is currently pressing the screen
Definition nbgl_types.h:223
@ RELEASED
the finger has been released from the screen
Definition nbgl_types.h:222
nbgl_bpp_t
Enum to represent the number of bits per pixel (BPP)
Definition nbgl_types.h:265
@ NB_NBGL_BPP
Number of NBGL_BPP enums.
Definition nbgl_types.h:269
@ NBGL_BPP_1
1 bit per pixel
Definition nbgl_types.h:266
@ NBGL_BPP_4
4 bits per pixel
Definition nbgl_types.h:268
@ NBGL_BPP_2
2 bits per pixel
Definition nbgl_types.h:267
nbgl_style_t
possible styles for text area border
Definition nbgl_types.h:199
@ NO_STYLE
no border
Definition nbgl_types.h:200
#define PACKED__
Definition nbgl_types.h:109
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:276
@ NBGL_GZLIB_COMPRESSION
gzlib compression
Definition nbgl_types.h:278
@ NBGL_NO_COMPRESSION
no compression, raw data
Definition nbgl_types.h:277
@ NBGL_RLE_COMPRESSION
RLE compression.
Definition nbgl_types.h:279
@ NB_NBGL_COMPRESSION
Number of NBGL_COMPRESSION enums.
Definition nbgl_types.h:280
nbgl_refresh_mode_t
different modes of refresh for nbgl_refreshSpecial()
Definition nbgl_types.h:308
@ BLACK_AND_WHITE_REFRESH
to be used for pure B&W area, when contrast is important
Definition nbgl_types.h:312
@ FULL_COLOR_CLEAN_REFRESH
to be used for lock screen display (cleaner but longer refresh)
Definition nbgl_types.h:311
@ BLACK_AND_WHITE_FAST_REFRESH
to be used for pure B&W area, when contrast is not priority
Definition nbgl_types.h:313
@ FULL_COLOR_PARTIAL_REFRESH
to be used for small partial refresh (radio buttons, switches)
Definition nbgl_types.h:310
@ INIT_REFRESH
to be used to fully clear the screen in white
Definition nbgl_types.h:314
@ NB_REFRESH_MODES
Definition nbgl_types.h:315
@ FULL_COLOR_REFRESH
to be used for normal refresh
Definition nbgl_types.h:309
Represents all information about an animation (succession of icons)
Definition nbgl_types.h:398
uint16_t delayMs
delay between 2 drawings
Definition nbgl_types.h:402
uint8_t nbIcons
number of icons in icons array
Definition nbgl_types.h:400
const nbgl_icon_details_t ** icons
array of nbIcons pointers on icons
Definition nbgl_types.h:399
nbgl_parsingType_t parsing
Definition nbgl_types.h:401
Represents a rectangle area of the screen.
Definition nbgl_types.h:293
color_t backgroundColor
color (usually background) to be applied
Definition nbgl_types.h:300
uint16_t width
width of the area, in pixels
Definition nbgl_types.h:298
int16_t y0
Definition nbgl_types.h:296
int16_t x0
Definition nbgl_types.h:294
nbgl_bpp_t bpp
bits per pixel for this area
Definition nbgl_types.h:301
uint16_t height
height of the area, in pixels
Definition nbgl_types.h:299
Represents all information about an icon.
Definition nbgl_types.h:377
bool isFile
if true, the bitmap buffer contains an image file
Definition nbgl_types.h:381
uint16_t width
width of the icon, in pixels
Definition nbgl_types.h:378
const uint8_t * bitmap
buffer containing pixel values
Definition nbgl_types.h:382
nbgl_bpp_t bpp
bits per pixel for this area
Definition nbgl_types.h:380
uint16_t height
height of the icon, in pixels
Definition nbgl_types.h:379
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