Embedded SDK
Embedded SDK
Classes | Macros | Typedefs | Enumerations
nbgl_types.h File Reference

common types for Graphical Library More...

#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include "bolos_target.h"
Include dependency graph for nbgl_types.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  nbgl_area_s
 Represents a rectangle area of the screen. More...
 
struct  nbgl_icon_details_s
 Represents all information about an icon. More...
 

Macros

#define SCREEN_WIDTH   480
 
#define SCREEN_HEIGHT   600
 
#define NO_TRANSFORMATION   0
 
#define VERTICAL_MIRROR   0x2
 
#define ROTATE_90_CLOCKWISE   0x4
 
#define INVALID_COLOR_MAP   0x0
 
#define MIN(x, y)   ((x) < (y) ? (x) : (y))
 
#define MAX(x, y)   ((x) > (y) ? (x) : (y))
 
#define PACKED__   __attribute__((packed))
 
#define GZLIB_UNCOMPRESSED_CHUNK   2049
 size of gzlib uncompression buffer in bytes More...
 

Typedefs

typedef struct PACKED__ nbgl_area_s nbgl_area_t
 Represents a rectangle area of the screen. More...
 
typedef enum nbgl_post_refresh_t nbgl_post_refresh_t
 Post refresh modes. More...
 
typedef uint8_t nbgl_transformation_t
 Represents the transformation to be applied on the bitmap before rendering This is a bitfield using masks as VERTICAL_MIRROR. More...
 
typedef uint8_t nbgl_color_map_t
 Represents the color_map to be used for 2BPP image, or the foreground color for 1BPP image. More...
 
typedef struct PACKED__ nbgl_icon_details_s nbgl_icon_details_t
 Represents all information about an icon. More...
 

Enumerations

enum  color_t {
  BLACK = 0 , DARK_GRAY , LIGHT_GRAY , WHITE ,
  NB_NBGL_COLOR
}
 
enum  nbgl_obj_type_t {
  SCREEN , CONTAINER , IMAGE , LINE ,
  TEXT_AREA , BUTTON , SWITCH , PAGE_INDICATOR ,
  PROGRESS_BAR , RADIO_BUTTON , QR_CODE , KEYBOARD ,
  KEYPAD , SPINNER , IMAGE_FILE , TEXT_ENTRY ,
  MASK_CONTROL , NB_OBJ_TYPES
}
 All types of graphical objects. More...
 
enum  nbgl_aligment_t {
  NO_ALIGNMENT , TOP_LEFT , TOP_MIDDLE , TOP_RIGHT ,
  MID_LEFT , CENTER , MID_RIGHT , BOTTOM_LEFT ,
  BOTTOM_MIDDLE , BOTTOM_RIGHT , LEFT_TOP , LEFT_BOTTOM ,
  RIGHT_TOP , RIGHT_BOTTOM
}
 All types of alignments. More...
 
enum  nbgl_state_t { OFF_STATE , ON_STATE }
 to represent a boolean state. More...
 
enum  nbgl_direction_t { VERTICAL , HORIZONTAL }
 Directions for layout or lines. More...
 
enum  nbgl_style_t { NO_STYLE }
 possible styles for text area border More...
 
enum  nbgl_qrcode_version_t { QRCODE_V4 = 0 , QRCODE_V10 , QRCODE_V4_SMALL }
 possible modes for QR Code More...
 
enum  nbgl_touchState_t { RELEASED , PRESSED }
 the 2 possible states of a finger on the Touchscreen More...
 
enum  nbgl_hardwareSwipe_t {
  HARDWARE_SWIPE_UP , HARDWARE_SWIPE_DOWN , HARDWARE_SWIPE_RIGHT , HARDWARE_SWIPE_LEFT ,
  NO_HARDWARE_SWIPE
}
 Hardware powered detected swipe states. More...
 
enum  nbgl_touchType_t {
  TOUCHED , LONG_TOUCHED , TOUCHING , OUT_OF_TOUCH ,
  TOUCH_PRESSED , TOUCH_RELEASED , VALUE_CHANGED , SWIPED_UP ,
  SWIPED_DOWN , SWIPED_RIGHT , SWIPED_LEFT , NB_TOUCH_TYPES
}
 The different types of Touchscreen events. More...
 
enum  nbgl_bpp_t { NBGL_BPP_1 = 0 , NBGL_BPP_2 , NBGL_BPP_4 , NB_NBGL_BPP }
 Enum to represent the number of bits per pixel (BPP) More...
 
enum  nbgl_compression_t { NBGL_NO_COMPRESSION = 0 , NBGL_GZLIB_COMPRESSION , NBGL_RLE_COMPRESSION , NB_NBGL_COMPRESSION }
 Enum to represent the compression. More...
 
enum  nbgl_refresh_mode_t {
  FULL_COLOR_REFRESH , FULL_COLOR_PARTIAL_REFRESH , FULL_COLOR_CLEAN_REFRESH , BLACK_AND_WHITE_REFRESH ,
  BLACK_AND_WHITE_FAST_REFRESH , INIT_REFRESH , NB_REFRESH_MODES
}
 different modes of refresh for nbgl_refreshSpecial() More...
 
enum  nbgl_post_refresh_t { POST_REFRESH_FORCE_POWER_OFF , POST_REFRESH_FORCE_POWER_ON , POST_REFRESH_FORCE_POWER_ON_WITH_PIPELINE , POST_REFRESH_KEEP_POWER_STATE }
 Post refresh modes. More...
 
enum  nbgl_radius_t { RADIUS_32_PIXELS = 0 , RADIUS_44_PIXELS , RADIUS_MAX = RADIUS_44_PIXELS , RADIUS_0_PIXELS = 0xFF }
 possible radius for objects More...
 

Detailed Description

common types for Graphical Library

Definition in file nbgl_types.h.

Macro Definition Documentation

◆ GZLIB_UNCOMPRESSED_CHUNK

#define GZLIB_UNCOMPRESSED_CHUNK   2049

size of gzlib uncompression buffer in bytes

Definition at line 266 of file nbgl_types.h.

◆ INVALID_COLOR_MAP

#define INVALID_COLOR_MAP   0x0

Code to be used for color map when not used

Definition at line 73 of file nbgl_types.h.

◆ MAX

#define MAX (   x,
 
)    ((x) > (y) ? (x) : (y))

Definition at line 82 of file nbgl_types.h.

◆ MIN

#define MIN (   x,
 
)    ((x) < (y) ? (x) : (y))

Definition at line 79 of file nbgl_types.h.

◆ NO_TRANSFORMATION

#define NO_TRANSFORMATION   0

No transformation

Definition at line 55 of file nbgl_types.h.

◆ PACKED__

#define PACKED__   __attribute__((packed))

Definition at line 88 of file nbgl_types.h.

◆ ROTATE_90_CLOCKWISE

#define ROTATE_90_CLOCKWISE   0x4

Rotation 90 degrees clockwise when rendering bitmap

Definition at line 67 of file nbgl_types.h.

◆ SCREEN_HEIGHT

#define SCREEN_HEIGHT   600

Height of the front screen in pixels

Definition at line 45 of file nbgl_types.h.

◆ SCREEN_WIDTH

#define SCREEN_WIDTH   480

Width of the front screen in pixels

Definition at line 32 of file nbgl_types.h.

◆ VERTICAL_MIRROR

#define VERTICAL_MIRROR   0x2

Vertical mirroring when rendering bitmap

Definition at line 61 of file nbgl_types.h.

Typedef Documentation

◆ nbgl_area_t

Represents a rectangle area of the screen.

◆ nbgl_color_map_t

Represents the color_map to be used for 2BPP image, or the foreground color for 1BPP image.

Note
colors are encoded on 2 bits, so a 8 bits stores the 4 colors for a 2BPP image
not used for 4BPP image

Definition at line 355 of file nbgl_types.h.

◆ nbgl_icon_details_t

Represents all information about an icon.

◆ nbgl_post_refresh_t

Post refresh modes.

  • POST_REFRESH_FORCE_POWER_OFF Screen is powered off after refresh. Following refreshes will be slower, but less energy is consumed.
  • POST_REFRESH_FORCE_POWER_ON Screen is let powered on after refresh. Following refreshes will be faster, at the cost of more energy consumed.
  • POST_REFRESH_FORCE_POWER_ON_WITH_PIPELINE Same as POST_REFRESH_FORCE_POWER_ON, but with pipeline enabled. When using pipeline, refreshes are faster, but some constraints must be respected: successive draws & refreshes areas must not overlap. If overlapping is needed, the function nbgl_driver_waitPipeline() must be called, in order to wait for pipelined operations to finish.

◆ nbgl_transformation_t

Represents the transformation to be applied on the bitmap before rendering This is a bitfield using masks as VERTICAL_MIRROR.

Definition at line 348 of file nbgl_types.h.

Enumeration Type Documentation

◆ color_t

enum color_t
Enumerator
BLACK 
DARK_GRAY 
LIGHT_GRAY 
WHITE 
NB_NBGL_COLOR 

Definition at line 101 of file nbgl_types.h.

◆ nbgl_aligment_t

All types of alignments.

Enumerator
NO_ALIGNMENT 

used when parent container layout is used

TOP_LEFT 
TOP_MIDDLE 
TOP_RIGHT 
MID_LEFT 
CENTER 
MID_RIGHT 
BOTTOM_LEFT 
BOTTOM_MIDDLE 
BOTTOM_RIGHT 
LEFT_TOP 

on outside left

LEFT_BOTTOM 

on outside left

RIGHT_TOP 

on outside right

RIGHT_BOTTOM 

on outside right

Definition at line 140 of file nbgl_types.h.

◆ nbgl_bpp_t

enum nbgl_bpp_t

Enum to represent the number of bits per pixel (BPP)

Enumerator
NBGL_BPP_1 

1 bit per pixel

NBGL_BPP_2 

2 bits per pixel

NBGL_BPP_4 

4 bits per pixel

NB_NBGL_BPP 

Number of NBGL_BPP enums.

Definition at line 244 of file nbgl_types.h.

◆ nbgl_compression_t

Enum to represent the compression.

Enumerator
NBGL_NO_COMPRESSION 

no compression, raw data

NBGL_GZLIB_COMPRESSION 

gzlib compression

NBGL_RLE_COMPRESSION 

RLE compression.

NB_NBGL_COMPRESSION 

Number of NBGL_COMPRESSION enums.

Definition at line 255 of file nbgl_types.h.

◆ nbgl_direction_t

Directions for layout or lines.

Enumerator
VERTICAL 

from top to bottom

HORIZONTAL 

from left to right

Definition at line 169 of file nbgl_types.h.

◆ nbgl_hardwareSwipe_t

Hardware powered detected swipe states.

Enumerator
HARDWARE_SWIPE_UP 
HARDWARE_SWIPE_DOWN 
HARDWARE_SWIPE_RIGHT 
HARDWARE_SWIPE_LEFT 
NO_HARDWARE_SWIPE 

Definition at line 208 of file nbgl_types.h.

◆ nbgl_obj_type_t

All types of graphical objects.

Enumerator
SCREEN 

Main screen.

CONTAINER 

Empty container.

IMAGE 

Bitmap (y and height must be multiple of 4 on Stax)

LINE 

Vertical or Horizontal line.

TEXT_AREA 

Area to contain text line(s)

BUTTON 

Rounded rectangle button with icon and/or text.

SWITCH 

Switch to turn on/off something.

PAGE_INDICATOR 

horizontal bar to indicate position within pages

PROGRESS_BAR 

horizontal bar to indicate progression of something (between 0% and 100%)

RADIO_BUTTON 

Indicator to inform whether something is on or off.

QR_CODE 

QR Code.

KEYBOARD 

Keyboard.

KEYPAD 

Keypad.

SPINNER 

Spinner.

IMAGE_FILE 

Image file (with Ledger compression)

TEXT_ENTRY 

area for entered text, only for Nanos

MASK_CONTROL 

OS-specific object to enable/disable masked area.

NB_OBJ_TYPES 

Definition at line 115 of file nbgl_types.h.

◆ nbgl_post_refresh_t

Post refresh modes.

  • POST_REFRESH_FORCE_POWER_OFF Screen is powered off after refresh. Following refreshes will be slower, but less energy is consumed.
  • POST_REFRESH_FORCE_POWER_ON Screen is let powered on after refresh. Following refreshes will be faster, at the cost of more energy consumed.
  • POST_REFRESH_FORCE_POWER_ON_WITH_PIPELINE Same as POST_REFRESH_FORCE_POWER_ON, but with pipeline enabled. When using pipeline, refreshes are faster, but some constraints must be respected: successive draws & refreshes areas must not overlap. If overlapping is needed, the function nbgl_driver_waitPipeline() must be called, in order to wait for pipelined operations to finish.
Enumerator
POST_REFRESH_FORCE_POWER_OFF 

Force screen power off after refresh.

POST_REFRESH_FORCE_POWER_ON 

Force screen power on after refresh.

POST_REFRESH_FORCE_POWER_ON_WITH_PIPELINE 

Force screen power on and enable pipeline.

POST_REFRESH_KEEP_POWER_STATE 

Keep state after refresh.

Definition at line 315 of file nbgl_types.h.

◆ nbgl_qrcode_version_t

possible modes for QR Code

Note
if text len <= 114 chars, V4 can be used, otherwise use V10
Enumerator
QRCODE_V4 

QRCode V4, can encode text len up to 62 chars, display size = 264*264.

QRCODE_V10 

QRCode V10, can encode text len up to 1500 chars, display size = 228*228.

QRCODE_V4_SMALL 

QRCode V4, can encode text len up to 1500 chars, display size = 132*132.

Definition at line 190 of file nbgl_types.h.

◆ nbgl_radius_t

possible radius for objects

Enumerator
RADIUS_32_PIXELS 

32 pixels

RADIUS_44_PIXELS 

44 pixels

RADIUS_MAX 
RADIUS_0_PIXELS 

no radius (square angle)

Definition at line 326 of file nbgl_types.h.

◆ nbgl_refresh_mode_t

different modes of refresh for nbgl_refreshSpecial()

Enumerator
FULL_COLOR_REFRESH 

to be used for normal refresh

FULL_COLOR_PARTIAL_REFRESH 

to be used for small partial refresh (radio buttons, switches)

FULL_COLOR_CLEAN_REFRESH 

to be used for lock screen display (cleaner but longer refresh)

BLACK_AND_WHITE_REFRESH 

to be used for pure B&W area, when contrast is important

BLACK_AND_WHITE_FAST_REFRESH 

to be used for pure B&W area, when contrast is not priority

INIT_REFRESH 

to be used to fully clear the screen in white

NB_REFRESH_MODES 

Definition at line 287 of file nbgl_types.h.

◆ nbgl_state_t

to represent a boolean state.

Enumerator
OFF_STATE 
ON_STATE 

Definition at line 160 of file nbgl_types.h.

◆ nbgl_style_t

possible styles for text area border

Enumerator
NO_STYLE 

no border

Definition at line 178 of file nbgl_types.h.

◆ nbgl_touchState_t

the 2 possible states of a finger on the Touchscreen

Enumerator
RELEASED 

the finger has been released from the screen

PRESSED 

the finger is currently pressing the screen

Definition at line 200 of file nbgl_types.h.

◆ nbgl_touchType_t

The different types of Touchscreen events.

Enumerator
TOUCHED 

corresponding to an object touched and released at least SHORT_TOUCH_DURATION ms later but less than LONG_TOUCH_DURATION ms

LONG_TOUCHED 

corresponding to an object touched and released at least LONG_TOUCH_DURATION ms later.

TOUCHING 

corresponding to an object that is currently touched

OUT_OF_TOUCH 

corresponding to an object that was touched but that has lost the focus (the finger has moved)

TOUCH_PRESSED 

corresponding to an object that was not touched and where the finger has been pressed.

TOUCH_RELEASED 

corresponding to an object that was touched and where the finger has been released.

VALUE_CHANGED 

corresponding to a change of state of the object (indirect event)

SWIPED_UP 
SWIPED_DOWN 
SWIPED_RIGHT 
SWIPED_LEFT 
NB_TOUCH_TYPES 

Definition at line 220 of file nbgl_types.h.