Embedded SDK
Embedded SDK
Classes | Typedefs | Functions
nbgl_screen.h File Reference

API to manage screens. More...

#include "nbgl_types.h"
#include "nbgl_obj.h"
Include dependency graph for nbgl_screen.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  nbgl_screenTickerConfiguration_s
 struct to configure a screen layer More...
 
struct  nbgl_screen_s
 struct to represent a screen (SCREEN type) More...
 

Typedefs

typedef void(* nbgl_tickerCallback_t) (void)
 prototype of function to be called when a timer on screen is fired More...
 
typedef struct PACKED__ nbgl_screenTickerConfiguration_s nbgl_screenTickerConfiguration_t
 struct to configure a screen layer More...
 
typedef struct PACKED__ nbgl_screen_s nbgl_screen_t
 struct to represent a screen (SCREEN type) More...
 

Functions

void nbgl_screen_reinit (void)
 
void nbgl_wait_pipeline (void)
 
void nbgl_screenRedraw (void)
 This function redraws the whole screen on top of stack and its children. More...
 
nbgl_obj_tnbgl_screenGetAt (uint8_t screenIndex)
 Returns the screen on the given layer index, as a generic object. More...
 
nbgl_obj_tnbgl_screenGetTop (void)
 Returns the screen on top layer, as a generic object. More...
 
uint8_t nbgl_screenGetCurrentStackSize (void)
 Returns the number of used screens on stack. More...
 
uint8_t nbgl_screenGetUxStackSize (void)
 Returns the number of used UX screens on stack. More...
 
bool nbgl_screenContainsObj (nbgl_obj_t *obj)
 return true if the given obj can be found in refObj or any of its children More...
 
nbgl_obj_tnbgl_screenContainsObjType (nbgl_screen_t *screen, nbgl_obj_type_t type)
 return an object of the given type in the given screen More...
 
int nbgl_screenSet (nbgl_obj_t ***elements, uint8_t nbElements, const nbgl_screenTickerConfiguration_t *ticker, nbgl_touchCallback_t touchCallback)
 Configures the lowest layer screen. To be used by applications A nbgl_screenRedraw() can be called after that to draw all the given objects (and their children) More...
 
int nbgl_screenUpdateNbElements (uint8_t screenIndex, uint8_t nbElements)
 Updates the number of children on given layer. can only be smaller than the number given in nbgl_screenSet() More...
 
int nbgl_screenUpdateBackgroundColor (uint8_t screenIndex, color_t color)
 Updates the background color of the screen at the given screenIndex, always set at WHITE in. More...
 
int nbgl_screenUpdateTicker (uint8_t screenIndex, const nbgl_screenTickerConfiguration_t *ticker)
 Updates the ticker configuration of the screen at the given screenIndex, always set at WHITE in. More...
 
nbgl_obj_t ** nbgl_screenGetElements (uint8_t screenIndex)
 Returns the array of elements (children) of the screen at the given index (return value of nbgl_screenPush() or 0 for a screen created with nbgl_screenSet()) More...
 
int nbgl_screenRelease (void)
 
int nbgl_screenPush (nbgl_obj_t ***elements, uint8_t nbElements, const nbgl_screenTickerConfiguration_t *ticker, nbgl_touchCallback_t touchCallback)
 Pushes a screen on top of the stack, with the given number of elements, if possible. The array of children for this screen is set in given elements parameter A nbgl_screenRedraw() can be called after that to draw all the given objects (and their children) More...
 
int nbgl_screenPop (uint8_t screenIndex)
 Release the screen at the given index in screen array (index returned by nbgl_screenPush()). A nbgl_screenRedraw() can be called after that to draw all objects in the new top of the stack. More...
 
int nbgl_screenReset (void)
 Releases all screens and objects and resets the screen stack. It is supposed to be called before running an app. More...
 
void nbgl_screenHandler (uint32_t intervaleMs)
 Function to be called periodically by system to enable using ticker. More...
 

Detailed Description

API to manage screens.

Definition in file nbgl_screen.h.

Typedef Documentation

◆ nbgl_screen_t

struct to represent a screen (SCREEN type)

Note
Only for internal usage
inherits from container

◆ nbgl_screenTickerConfiguration_t

struct to configure a screen layer

◆ nbgl_tickerCallback_t

typedef void(* nbgl_tickerCallback_t) (void)

prototype of function to be called when a timer on screen is fired

Definition at line 32 of file nbgl_screen.h.

Function Documentation

◆ nbgl_screen_reinit()

void nbgl_screen_reinit ( void  )

◆ nbgl_screenContainsObj()

bool nbgl_screenContainsObj ( nbgl_obj_t obj)

return true if the given obj can be found in refObj or any of its children

Parameters
objthe object to search
Returns
true if belongs, false otherwise

Definition at line 568 of file nbgl_screen.c.

◆ nbgl_screenContainsObjType()

nbgl_obj_t* nbgl_screenContainsObjType ( nbgl_screen_t screen,
nbgl_obj_type_t  type 
)

return an object of the given type in the given screen

Parameters
screenthe screen in which to search
typethe type of object to search for
Returns
the found object of given type

Definition at line 583 of file nbgl_screen.c.

◆ nbgl_screenGetAt()

nbgl_obj_t* nbgl_screenGetAt ( uint8_t  screenIndex)

Returns the screen on the given layer index, as a generic object.

Parameters
screenIndexindex of the screen in the stack
Returns
the screen on the given layer, or NULL if no screen in stack

Definition at line 88 of file nbgl_screen.c.

◆ nbgl_screenGetCurrentStackSize()

uint8_t nbgl_screenGetCurrentStackSize ( void  )

Returns the number of used screens on stack.

Returns
the number of used screens on stack

Definition at line 116 of file nbgl_screen.c.

◆ nbgl_screenGetElements()

nbgl_obj_t** nbgl_screenGetElements ( uint8_t  screenIndex)

Returns the array of elements (children) of the screen at the given index (return value of nbgl_screenPush() or 0 for a screen created with nbgl_screenSet())

Parameters
screenIndexindex of the screen in the stack. 0 is the usual value, except for modal windows
Returns
array of elements (children) of the screen

Definition at line 312 of file nbgl_screen.c.

◆ nbgl_screenGetTop()

nbgl_obj_t* nbgl_screenGetTop ( void  )

Returns the screen on top layer, as a generic object.

Returns
the screen on top layer, or NULL if no screen in stack

Definition at line 102 of file nbgl_screen.c.

◆ nbgl_screenGetUxStackSize()

uint8_t nbgl_screenGetUxStackSize ( void  )

Returns the number of used UX screens on stack.

Returns
the number of used UX screens on stack

Definition at line 128 of file nbgl_screen.c.

◆ nbgl_screenHandler()

void nbgl_screenHandler ( uint32_t  intervaleMs)

Function to be called periodically by system to enable using ticker.

Parameters
intervaleMsintervale or time since the last call, in ms

Definition at line 475 of file nbgl_screen.c.

◆ nbgl_screenPop()

int nbgl_screenPop ( uint8_t  screenIndex)

Release the screen at the given index in screen array (index returned by nbgl_screenPush()). A nbgl_screenRedraw() can be called after that to draw all objects in the new top of the stack.

Parameters
screenIndexindex of the screen to pop in the stack. 0 is the usual value, except for modal windows
Returns
the index of screen on top of stack (if -1, the stack is empty)

Definition at line 403 of file nbgl_screen.c.

◆ nbgl_screenPush()

int nbgl_screenPush ( nbgl_obj_t ***  elements,
uint8_t  nbElements,
const nbgl_screenTickerConfiguration_t ticker,
nbgl_touchCallback_t  callback 
)

Pushes a screen on top of the stack, with the given number of elements, if possible. The array of children for this screen is set in given elements parameter A nbgl_screenRedraw() can be called after that to draw all the given objects (and their children)

Parameters
elements(output) an array of nbgl_obj_t** to get
nbElementsnumber of elements to get in elements array
tickerif not NULL, configures the potential ticker to be used as a periodic timer
callbackcallback called when any touchable object of the screen is touched (except keyboard/keypad) (can be NULL)
Returns
current screen index, or < 0 if error

Definition at line 330 of file nbgl_screen.c.

◆ nbgl_screenRedraw()

void nbgl_screenRedraw ( void  )

This function redraws the whole screen on top of stack and its children.

Definition at line 66 of file nbgl_screen.c.

◆ nbgl_screenRelease()

int nbgl_screenRelease ( void  )

◆ nbgl_screenReset()

int nbgl_screenReset ( void  )

Releases all screens and objects and resets the screen stack. It is supposed to be called before running an app.

Returns
>= 0 if OK

Definition at line 452 of file nbgl_screen.c.

◆ nbgl_screenSet()

int nbgl_screenSet ( nbgl_obj_t ***  elements,
uint8_t  nbElements,
const nbgl_screenTickerConfiguration_t ticker,
nbgl_touchCallback_t  callback 
)

Configures the lowest layer screen. To be used by applications A nbgl_screenRedraw() can be called after that to draw all the given objects (and their children)

Parameters
elementsan pointer on an array of nbgl_obj_t* to get as children of the screen, it will be allocated by the function
nbElementsnumber of elements in elements array
tickerif not NULL, configures the potential ticker to be used as a periodic timer
callbackcallback called when any touchable object of the screen is touched (except keyboard/keypad) (can be NULL)
Returns
>= 0 if OK

Definition at line 225 of file nbgl_screen.c.

◆ nbgl_screenUpdateBackgroundColor()

int nbgl_screenUpdateBackgroundColor ( uint8_t  screenIndex,
color_t  color 
)

Updates the background color of the screen at the given screenIndex, always set at WHITE in.

Parameters
screenIndexindex of the screen in the stack. 0 is the usual value, except for modal windows
colorcolor to set as background color for tge screen
Returns
>= 0 if OK

Definition at line 273 of file nbgl_screen.c.

◆ nbgl_screenUpdateNbElements()

int nbgl_screenUpdateNbElements ( uint8_t  screenIndex,
uint8_t  nbElements 
)

Updates the number of children on given layer. can only be smaller than the number given in nbgl_screenSet()

Parameters
screenIndexindex of the screen in the stack. 0 is the usual value, except for modal windows
nbElementsnumber of elements in elements array
Returns
>= 0 if OK

Definition at line 257 of file nbgl_screen.c.

◆ nbgl_screenUpdateTicker()

int nbgl_screenUpdateTicker ( uint8_t  screenIndex,
const nbgl_screenTickerConfiguration_t ticker 
)

Updates the ticker configuration of the screen at the given screenIndex, always set at WHITE in.

Parameters
screenIndexindex of the screen in the stack. 0 is the usual value, except for modal windows
tickerif not NULL, configures the potential ticker to be used as a periodic timer
Returns
>= 0 if OK

Definition at line 289 of file nbgl_screen.c.

◆ nbgl_wait_pipeline()

void nbgl_wait_pipeline ( void  )