Embedded SDK
Embedded SDK
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
11 extern "C" {
12 #endif
13 
14 /*********************
15  * INCLUDES
16  *********************/
17 #include <stddef.h>
18 #include <stdint.h>
19 #include <stdbool.h>
20 #include "bolos_target.h"
21 
22 /*********************
23  * DEFINES
24  *********************/
28 #ifdef SCREEN_SIZE_WALLET
29 #ifdef TARGET_STAX
30 #define SCREEN_WIDTH 400
31 #else // TARGET_STAX
32 #define SCREEN_WIDTH 480
33 #endif // TARGET_STAX
34 #else // SCREEN_SIZE_WALLET
35 #define SCREEN_WIDTH 128
36 #endif // SCREEN_SIZE_WALLET
37 
41 #ifdef SCREEN_SIZE_WALLET
42 #ifdef TARGET_STAX
43 #define SCREEN_HEIGHT 672
44 #else // TARGET_STAX
45 #define SCREEN_HEIGHT 600
46 #endif // TARGET_STAX
47 #else // SCREEN_SIZE_WALLET
48 #define SCREEN_HEIGHT 64
49 #endif // SCREEN_SIZE_WALLET
50 
55 #define NO_TRANSFORMATION 0
56 
61 #define VERTICAL_MIRROR 0x2
62 
67 #define ROTATE_90_CLOCKWISE 0x4
68 
73 #define INVALID_COLOR_MAP 0x0
74 
75 /**********************
76  * TYPEDEFS
77  **********************/
78 #ifndef MIN
79 #define MIN(x, y) ((x) < (y) ? (x) : (y))
80 #endif
81 #ifndef MAX
82 #define MAX(x, y) ((x) > (y) ? (x) : (y))
83 #endif
84 
85 #ifdef LINUX_SIMU
86 #define PACKED__
87 #else // LINUX_SIMU
88 #define PACKED__ __attribute__((packed))
89 #endif // LINUX_SIMU
90 #ifdef BICOLOR_MODE
91 
92 typedef enum {
93  BLACK = 0,
94  DARK_GRAY = 0,
95  LIGHT_GRAY = 0,
96  WHITE = 3
97 } color_t;
98 
99 #else
100 
101 typedef enum {
102  BLACK = 0,
108 
109 #endif
110 
115 typedef enum {
135 
140 typedef enum {
156 
160 typedef enum {
162  ON_STATE
164 
169 typedef enum {
171  HORIZONTAL
173 
178 typedef enum {
180 #ifdef SCREEN_SIZE_NANO
181  INVERTED_COLORS
182 #endif // SCREEN_SIZE_NANO
183 } nbgl_style_t;
184 
190 typedef enum {
191  QRCODE_V4 = 0,
195 
200 typedef enum {
204 
208 typedef enum {
215 
220 typedef enum {
221  TOUCHED,
223  LONG_TOUCHED,
226  OUT_OF_TOUCH,
228  TOUCH_PRESSED,
239 
244 typedef enum {
249 } nbgl_bpp_t;
250 
255 typedef enum {
261 
266 #define GZLIB_UNCOMPRESSED_CHUNK 2049
267 
272 typedef struct PACKED__ nbgl_area_s {
282 
287 typedef enum {
296 
315 typedef enum nbgl_post_refresh_t {
321 
326 typedef enum {
327 #ifdef SCREEN_SIZE_WALLET
329 #ifdef TARGET_STAX
330  RADIUS_40_PIXELS,
331  RADIUS_MAX = RADIUS_40_PIXELS,
332 #else // TARGET_STAX
335 #endif // TARGET_STAX
336 #else // SCREEN_SIZE_WALLET
337  RADIUS_1_PIXEL = 0,
338  RADIUS_3_PIXELS,
339  RADIUS_MAX = RADIUS_3_PIXELS,
340 #endif // SCREEN_SIZE_WALLET
342 } nbgl_radius_t;
343 
349 
356 
365  bool isFile;
366  const uint8_t *bitmap;
368 
369 #ifdef __cplusplus
370 } /* extern "C" */
371 #endif
372 
373 #endif /* NBGL_TYPES_H */
color_t
Definition: nbgl_types.h:101
@ NB_NBGL_COLOR
Definition: nbgl_types.h:106
@ WHITE
Definition: nbgl_types.h:105
@ DARK_GRAY
Definition: nbgl_types.h:103
@ LIGHT_GRAY
Definition: nbgl_types.h:104
@ BLACK
Definition: nbgl_types.h:102
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:348
nbgl_state_t
to represent a boolean state.
Definition: nbgl_types.h:160
@ ON_STATE
Definition: nbgl_types.h:162
@ OFF_STATE
Definition: nbgl_types.h:161
nbgl_post_refresh_t
Post refresh modes.
Definition: nbgl_types.h:315
@ POST_REFRESH_KEEP_POWER_STATE
Keep state after refresh.
Definition: nbgl_types.h:319
@ POST_REFRESH_FORCE_POWER_OFF
Force screen power off after refresh.
Definition: nbgl_types.h:316
@ POST_REFRESH_FORCE_POWER_ON
Force screen power on after refresh.
Definition: nbgl_types.h:317
@ POST_REFRESH_FORCE_POWER_ON_WITH_PIPELINE
Force screen power on and enable pipeline.
Definition: nbgl_types.h:318
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:355
nbgl_radius_t
possible radius for objects
Definition: nbgl_types.h:326
@ RADIUS_MAX
Definition: nbgl_types.h:334
@ RADIUS_0_PIXELS
no radius (square angle)
Definition: nbgl_types.h:341
@ RADIUS_32_PIXELS
32 pixels
Definition: nbgl_types.h:328
@ RADIUS_44_PIXELS
44 pixels
Definition: nbgl_types.h:333
nbgl_touchType_t
The different types of Touchscreen events.
Definition: nbgl_types.h:220
@ SWIPED_LEFT
Definition: nbgl_types.h:236
@ LONG_TOUCHED
Definition: nbgl_types.h:223
@ SWIPED_UP
Definition: nbgl_types.h:233
@ SWIPED_DOWN
Definition: nbgl_types.h:234
@ SWIPED_RIGHT
Definition: nbgl_types.h:235
@ VALUE_CHANGED
corresponding to a change of state of the object (indirect event)
Definition: nbgl_types.h:232
@ NB_TOUCH_TYPES
Definition: nbgl_types.h:237
@ TOUCH_RELEASED
Definition: nbgl_types.h:230
@ TOUCHED
Definition: nbgl_types.h:221
@ TOUCHING
corresponding to an object that is currently touched
Definition: nbgl_types.h:225
@ TOUCH_PRESSED
Definition: nbgl_types.h:228
@ OUT_OF_TOUCH
Definition: nbgl_types.h:226
nbgl_qrcode_version_t
possible modes for QR Code
Definition: nbgl_types.h:190
@ QRCODE_V10
QRCode V10, can encode text len up to 1500 chars, display size = 228*228.
Definition: nbgl_types.h:192
@ QRCODE_V4_SMALL
QRCode V4, can encode text len up to 1500 chars, display size = 132*132.
Definition: nbgl_types.h:193
@ QRCODE_V4
QRCode V4, can encode text len up to 62 chars, display size = 264*264.
Definition: nbgl_types.h:191
nbgl_direction_t
Directions for layout or lines.
Definition: nbgl_types.h:169
@ VERTICAL
from top to bottom
Definition: nbgl_types.h:170
@ HORIZONTAL
from left to right
Definition: nbgl_types.h:171
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:140
@ TOP_MIDDLE
Definition: nbgl_types.h:143
@ CENTER
Definition: nbgl_types.h:146
@ BOTTOM_RIGHT
Definition: nbgl_types.h:150
@ TOP_LEFT
Definition: nbgl_types.h:142
@ NO_ALIGNMENT
used when parent container layout is used
Definition: nbgl_types.h:141
@ BOTTOM_LEFT
Definition: nbgl_types.h:148
@ LEFT_TOP
on outside left
Definition: nbgl_types.h:151
@ LEFT_BOTTOM
on outside left
Definition: nbgl_types.h:152
@ MID_RIGHT
Definition: nbgl_types.h:147
@ RIGHT_TOP
on outside right
Definition: nbgl_types.h:153
@ TOP_RIGHT
Definition: nbgl_types.h:144
@ MID_LEFT
Definition: nbgl_types.h:145
@ BOTTOM_MIDDLE
Definition: nbgl_types.h:149
@ RIGHT_BOTTOM
on outside right
Definition: nbgl_types.h:154
nbgl_hardwareSwipe_t
Hardware powered detected swipe states.
Definition: nbgl_types.h:208
@ HARDWARE_SWIPE_RIGHT
Definition: nbgl_types.h:211
@ NO_HARDWARE_SWIPE
Definition: nbgl_types.h:213
@ HARDWARE_SWIPE_LEFT
Definition: nbgl_types.h:212
@ HARDWARE_SWIPE_DOWN
Definition: nbgl_types.h:210
@ HARDWARE_SWIPE_UP
Definition: nbgl_types.h:209
nbgl_obj_type_t
All types of graphical objects.
Definition: nbgl_types.h:115
@ KEYPAD
Keypad.
Definition: nbgl_types.h:128
@ IMAGE
Bitmap (y and height must be multiple of 4 on Stax)
Definition: nbgl_types.h:118
@ IMAGE_FILE
Image file (with Ledger compression)
Definition: nbgl_types.h:130
@ TEXT_ENTRY
area for entered text, only for Nanos
Definition: nbgl_types.h:131
@ NB_OBJ_TYPES
Definition: nbgl_types.h:133
@ SWITCH
Switch to turn on/off something.
Definition: nbgl_types.h:122
@ RADIO_BUTTON
Indicator to inform whether something is on or off.
Definition: nbgl_types.h:125
@ SPINNER
Spinner.
Definition: nbgl_types.h:129
@ BUTTON
Rounded rectangle button with icon and/or text.
Definition: nbgl_types.h:121
@ PROGRESS_BAR
horizontal bar to indicate progression of something (between 0% and 100%)
Definition: nbgl_types.h:124
@ QR_CODE
QR Code.
Definition: nbgl_types.h:126
@ PAGE_INDICATOR
horizontal bar to indicate position within pages
Definition: nbgl_types.h:123
@ LINE
Vertical or Horizontal line.
Definition: nbgl_types.h:119
@ KEYBOARD
Keyboard.
Definition: nbgl_types.h:127
@ MASK_CONTROL
OS-specific object to enable/disable masked area.
Definition: nbgl_types.h:132
@ CONTAINER
Empty container.
Definition: nbgl_types.h:117
@ TEXT_AREA
Area to contain text line(s)
Definition: nbgl_types.h:120
@ SCREEN
Main screen.
Definition: nbgl_types.h:116
nbgl_touchState_t
the 2 possible states of a finger on the Touchscreen
Definition: nbgl_types.h:200
@ PRESSED
the finger is currently pressing the screen
Definition: nbgl_types.h:202
@ RELEASED
the finger has been released from the screen
Definition: nbgl_types.h:201
nbgl_bpp_t
Enum to represent the number of bits per pixel (BPP)
Definition: nbgl_types.h:244
@ NB_NBGL_BPP
Number of NBGL_BPP enums.
Definition: nbgl_types.h:248
@ NBGL_BPP_1
1 bit per pixel
Definition: nbgl_types.h:245
@ NBGL_BPP_4
4 bits per pixel
Definition: nbgl_types.h:247
@ NBGL_BPP_2
2 bits per pixel
Definition: nbgl_types.h:246
nbgl_style_t
possible styles for text area border
Definition: nbgl_types.h:178
@ NO_STYLE
no border
Definition: nbgl_types.h:179
#define PACKED__
Definition: nbgl_types.h:88
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:255
@ NBGL_GZLIB_COMPRESSION
gzlib compression
Definition: nbgl_types.h:257
@ NBGL_NO_COMPRESSION
no compression, raw data
Definition: nbgl_types.h:256
@ NBGL_RLE_COMPRESSION
RLE compression.
Definition: nbgl_types.h:258
@ NB_NBGL_COMPRESSION
Number of NBGL_COMPRESSION enums.
Definition: nbgl_types.h:259
nbgl_refresh_mode_t
different modes of refresh for nbgl_refreshSpecial()
Definition: nbgl_types.h:287
@ BLACK_AND_WHITE_REFRESH
to be used for pure B&W area, when contrast is important
Definition: nbgl_types.h:291
@ FULL_COLOR_CLEAN_REFRESH
to be used for lock screen display (cleaner but longer refresh)
Definition: nbgl_types.h:290
@ BLACK_AND_WHITE_FAST_REFRESH
to be used for pure B&W area, when contrast is not priority
Definition: nbgl_types.h:292
@ FULL_COLOR_PARTIAL_REFRESH
to be used for small partial refresh (radio buttons, switches)
Definition: nbgl_types.h:289
@ INIT_REFRESH
to be used to fully clear the screen in white
Definition: nbgl_types.h:293
@ NB_REFRESH_MODES
Definition: nbgl_types.h:294
@ FULL_COLOR_REFRESH
to be used for normal refresh
Definition: nbgl_types.h:288
Represents a rectangle area of the screen.
Definition: nbgl_types.h:272
color_t backgroundColor
color (usually background) to be applied
Definition: nbgl_types.h:279
uint16_t width
width of the area, in pixels
Definition: nbgl_types.h:277
int16_t y0
Definition: nbgl_types.h:275
int16_t x0
Definition: nbgl_types.h:273
nbgl_bpp_t bpp
bits per pixel for this area
Definition: nbgl_types.h:280
uint16_t height
height of the area, in pixels
Definition: nbgl_types.h:278
Represents all information about an icon.
Definition: nbgl_types.h:361
bool isFile
if true, the bitmap buffer contains an image file
Definition: nbgl_types.h:365
uint16_t width
width of the icon, in pixels
Definition: nbgl_types.h:362
const uint8_t * bitmap
buffer containing pixel values
Definition: nbgl_types.h:366
nbgl_bpp_t bpp
bits per pixel for this area
Definition: nbgl_types.h:364
uint16_t height
height of the icon, in pixels
Definition: nbgl_types.h:363
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