Embedded SDK
Embedded SDK
Classes | Macros | Functions
nbgl_obj_pool.c File Reference

Implementation of a graphical objects pool, to be used by any page, or by predefined layout management. More...

#include "app_config.h"
#include "nbgl_obj.h"
#include "nbgl_debug.h"
#include <string.h>
Include dependency graph for nbgl_obj_pool.c:

Go to the source code of this file.

Classes

struct  genericObj_t
 

Macros

#define OBJ_POOL_LEN   80
 Max number of objects retrievable from pool. More...
 
#define OBJ_CONTAINER_POOL_LEN   128
 Max number of objects pointers usable for container pool. More...
 
#define INVALID_LAYER   0xFF
 

Functions

void nbgl_objPoolRelease (uint8_t layer)
 Release the objects from the pool for the given layer. More...
 
uint8_t nbgl_objPoolGetNbUsed (uint8_t layer)
 returns the number of objects currently used in the pool More...
 
nbgl_obj_tnbgl_objPoolGet (nbgl_obj_type_t type, uint8_t layer)
 Gets a new graphic object from the pool, with the given type. The type field of the object is set. More...
 
nbgl_obj_tnbgl_objPoolGetPrevious (nbgl_obj_t *obj, uint8_t layer)
 Gets a link to the previous object in the pool, for the given layer. (to be used with care) More...
 
uint8_t nbgl_objPoolGetId (nbgl_obj_t *obj)
 Gets a unique index for the given object, in the pool. More...
 
int nbgl_objPoolGetArray (nbgl_obj_type_t type, uint8_t nbObjs, uint8_t layer, nbgl_obj_t **objArray)
 Gets nbObjects new graphic object from the pool, with the given type, for the given layer (screen). The type field of the object is set. More...
 
void nbgl_containerPoolRelease (uint8_t layer)
 Release the objects pointers from the pool for the given layer. More...
 
nbgl_obj_t ** nbgl_containerPoolGet (uint8_t nbObjs, uint8_t layer)
 Gets a new container from the pool, with the given number of obj pointers. More...
 
uint8_t nbgl_containerPoolGetNbUsed (uint8_t layer)
 returns the number of containers currently used in the pool More...
 

Detailed Description

Implementation of a graphical objects pool, to be used by any page, or by predefined layout management.

Definition in file nbgl_obj_pool.c.

Macro Definition Documentation

◆ INVALID_LAYER

#define INVALID_LAYER   0xFF

Definition at line 39 of file nbgl_obj_pool.c.

◆ OBJ_CONTAINER_POOL_LEN

#define OBJ_CONTAINER_POOL_LEN   128

Max number of objects pointers usable for container pool.

Definition at line 34 of file nbgl_obj_pool.c.

◆ OBJ_POOL_LEN

#define OBJ_POOL_LEN   80

Max number of objects retrievable from pool.

Definition at line 25 of file nbgl_obj_pool.c.

Function Documentation

◆ nbgl_containerPoolGet()

nbgl_obj_t** nbgl_containerPoolGet ( uint8_t  nbObjs,
uint8_t  layer 
)

Gets a new container from the pool, with the given number of obj pointers.

Parameters
nbObjsnumber of objects pointers for the container
layerlayer (screen) to get the container to

Definition at line 290 of file nbgl_obj_pool.c.

◆ nbgl_containerPoolGetNbUsed()

uint8_t nbgl_containerPoolGetNbUsed ( uint8_t  layer)

returns the number of containers currently used in the pool

Definition at line 334 of file nbgl_obj_pool.c.

◆ nbgl_containerPoolRelease()

void nbgl_containerPoolRelease ( uint8_t  layer)

Release the objects pointers from the pool for the given layer.

Parameters
layerlayer to release objects pointers from

Definition at line 265 of file nbgl_obj_pool.c.

◆ nbgl_objPoolGet()

nbgl_obj_t* nbgl_objPoolGet ( nbgl_obj_type_t  type,
uint8_t  layer 
)

Gets a new graphic object from the pool, with the given type. The type field of the object is set.

Parameters
typetype of object to get from the pool
layerlayer to get object for

Definition at line 164 of file nbgl_obj_pool.c.

◆ nbgl_objPoolGetArray()

int nbgl_objPoolGetArray ( nbgl_obj_type_t  type,
uint8_t  nbObjs,
uint8_t  layer,
nbgl_obj_t **  objArray 
)

Gets nbObjects new graphic object from the pool, with the given type, for the given layer (screen). The type field of the object is set.

Parameters
typetype of objects to get from the pool
nbObjsnumber of objects to get from the pool
layerlayer (screen) to get the object to
objArrayarray of objs pointers
Returns
>= 0 if OK

Definition at line 242 of file nbgl_obj_pool.c.

◆ nbgl_objPoolGetId()

uint8_t nbgl_objPoolGetId ( nbgl_obj_t obj)

Gets a unique index for the given object, in the pool.

Parameters
objobject to get id from
Returns
an unique index of the object

Definition at line 223 of file nbgl_obj_pool.c.

◆ nbgl_objPoolGetNbUsed()

uint8_t nbgl_objPoolGetNbUsed ( uint8_t  layer)

returns the number of objects currently used in the pool

Definition at line 147 of file nbgl_obj_pool.c.

◆ nbgl_objPoolGetPrevious()

nbgl_obj_t* nbgl_objPoolGetPrevious ( nbgl_obj_t obj,
uint8_t  layer 
)

Gets a link to the previous object in the pool, for the given layer. (to be used with care)

Parameters
objobject to get previous from
layerlayer (screen) in which to retrieve the object
Returns
a pointer to the previous object in the pool

Definition at line 201 of file nbgl_obj_pool.c.

◆ nbgl_objPoolRelease()

void nbgl_objPoolRelease ( uint8_t  layer)

Release the objects from the pool for the given layer.

Parameters
layerlayer to release object from

Definition at line 126 of file nbgl_obj_pool.c.