Embedded SDK
Embedded SDK
|
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"
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_t * | nbgl_screenGetAt (uint8_t screenIndex) |
Returns the screen on the given layer index, as a generic object. More... | |
nbgl_obj_t * | nbgl_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_t * | nbgl_screenContainsObjType (nbgl_screen_t *screen, nbgl_obj_type_t type) |
return an object of the given type in the given screen More... | |
Implementation of screens management API.
Definition in file nbgl_screen.c.
#define SCREEN_STACK_SIZE 4 |
Max number of stackable screens.
Only index 0 is always bottom of stack, for the others the index can change
The worst case is (the order is not relevant)
Dashboard
Definition at line 39 of file nbgl_screen.c.
bool nbgl_screenContainsObj | ( | nbgl_obj_t * | obj | ) |
return true if the given obj can be found in refObj or any of its children
obj | the object to search |
Definition at line 568 of file nbgl_screen.c.
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
screen | the screen in which to search |
type | the type of object to search for |
Definition at line 583 of file nbgl_screen.c.
nbgl_obj_t* nbgl_screenGetAt | ( | uint8_t | screenIndex | ) |
Returns the screen on the given layer index, as a generic object.
screenIndex | index of the screen in the stack |
Definition at line 88 of file nbgl_screen.c.
uint8_t nbgl_screenGetCurrentStackSize | ( | void | ) |
Returns the number of used screens on stack.
Definition at line 116 of file nbgl_screen.c.
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())
screenIndex | index of the screen in the stack. 0 is the usual value, except for modal windows |
Definition at line 312 of file nbgl_screen.c.
nbgl_obj_t* nbgl_screenGetTop | ( | void | ) |
Returns the screen on top layer, as a generic object.
Definition at line 102 of file nbgl_screen.c.
uint8_t nbgl_screenGetUxStackSize | ( | void | ) |
Returns the number of used UX screens on stack.
Definition at line 128 of file nbgl_screen.c.
void nbgl_screenHandler | ( | uint32_t | intervaleMs | ) |
Function to be called periodically by system to enable using ticker.
intervaleMs | intervale or time since the last call, in ms |
Definition at line 475 of file nbgl_screen.c.
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.
screenIndex | index of the screen to pop in the stack. 0 is the usual value, except for modal windows |
Definition at line 403 of file nbgl_screen.c.
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)
elements | (output) an array of nbgl_obj_t** to get |
nbElements | number of elements to get in elements array |
ticker | if not NULL, configures the potential ticker to be used as a periodic timer |
callback | callback called when any touchable object of the screen is touched (except keyboard/keypad) (can be NULL) |
Definition at line 330 of file nbgl_screen.c.
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.
int nbgl_screenReset | ( | void | ) |
Releases all screens and objects and resets the screen stack. It is supposed to be called before running an app.
Definition at line 452 of file nbgl_screen.c.
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)
elements | an pointer on an array of nbgl_obj_t* to get as children of the screen, it will be allocated by the function |
nbElements | number of elements in elements array |
ticker | if not NULL, configures the potential ticker to be used as a periodic timer |
callback | callback called when any touchable object of the screen is touched (except keyboard/keypad) (can be NULL) |
Definition at line 225 of file nbgl_screen.c.
Updates the background color of the screen at the given screenIndex, always set at WHITE in.
screenIndex | index of the screen in the stack. 0 is the usual value, except for modal windows |
color | color to set as background color for tge screen |
Definition at line 273 of file nbgl_screen.c.
Updates the number of children on given layer. can only be smaller than the number given in nbgl_screenSet()
screenIndex | index of the screen in the stack. 0 is the usual value, except for modal windows |
nbElements | number of elements in elements array |
Definition at line 257 of file nbgl_screen.c.
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.
screenIndex | index of the screen in the stack. 0 is the usual value, except for modal windows |
ticker | if not NULL, configures the potential ticker to be used as a periodic timer |
Definition at line 289 of file nbgl_screen.c.