Embedded SDK
Embedded SDK
Macros | Functions
nbgl_screen.c File Reference

Implementation of screens management API. More...

#include "app_config.h"
#include "nbgl_front.h"
#include "nbgl_screen.h"
#include "nbgl_debug.h"
#include "nbgl_touch.h"
#include "os_pic.h"
#include "os_io.h"
#include "os_task.h"
Include dependency graph for nbgl_screen.c:

Go to the source code of this file.

Macros

#define SCREEN_STACK_SIZE   4
 Max number of stackable screens. More...
 

Functions

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...
 
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) 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_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) 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...
 
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...
 

Detailed Description

Implementation of screens management API.

Definition in file nbgl_screen.c.

Macro Definition Documentation

◆ SCREEN_STACK_SIZE

#define SCREEN_STACK_SIZE   4

Max number of stackable screens.

Note
Only the screen at the top of the stack is visible

Only index 0 is always bottom of stack, for the others the index can change

The worst case is (the order is not relevant)

Validate pin

BLE Pairing

Control Center

Dashboard

Definition at line 39 of file nbgl_screen.c.

Function Documentation

◆ 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_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.