12 #include "app_config.h"
25 #define OBJ_POOL_LEN 80
27 #define OBJ_POOL_LEN 40
34 #define OBJ_CONTAINER_POOL_LEN 128
36 #define OBJ_CONTAINER_POOL_LEN 64
39 #define INVALID_LAYER 0xFF
84 static uint8_t nbUsedObjsInPool = 0;
91 static uint8_t nbUsedObjsInContainerPool = 0;
93 static bool initialized;
130 "nbgl_objPoolRelease(): used objs in pool %d, for layer (%d)\n",
133 if (nbUsedObjsInPool == 0) {
137 if (layer == objPoolLayers[i]) {
151 if (layer == objPoolLayers[i]) {
169 if (initialized ==
false) {
182 obj = &objPool[i].
obj;
185 objPoolLayers[i] = layer;
210 if (objPoolLayers[index] == layer) {
211 return &objPool[index].
obj;
248 "nbgl_objPoolGetArray(): NO ENOUGH OBJ in POOL. Asked: %d, max = %d\n",
249 (nbUsedObjsInPool + nbObjs),
254 for (i = 0; i < nbObjs; i++) {
269 "nbgl_containerPoolRelease(): %d used obj containers in pool, trying to release for "
271 nbUsedObjsInContainerPool,
273 if (nbUsedObjsInContainerPool == 0) {
277 if (layer == objPointersPoolLayers[i]) {
278 objContainerPool[i] = NULL;
280 nbUsedObjsInContainerPool--;
292 uint8_t i = 0, nbContiguousFree = 0;
295 "nbgl_containerPoolGet(): getting %d obj containers for layer %d\n",
298 if (initialized ==
false) {
305 "nbgl_containerPoolGet(): NO ENOUGH OBJ in POOL. Asked: %d, max = %d\n",
306 (nbUsedObjsInContainerPool + nbObjs),
316 nbContiguousFree = 0;
319 if (nbContiguousFree == nbObjs) {
320 container = &objContainerPool[i - nbObjs];
321 memset(container, 0, nbObjs *
sizeof(
nbgl_obj_t *));
323 memset(&objPointersPoolLayers[i - nbObjs], layer, nbObjs);
324 nbUsedObjsInContainerPool += nbObjs;
338 if (layer == objPointersPoolLayers[i]) {
#define LOG_DEBUG(__logger,...)
#define LOG_FATAL(__logger,...)
API to draw all basic graphic objects.
struct PACKED__ nbgl_line_s nbgl_line_t
struct to represent a vertical or horizontal line
struct PACKED__ nbgl_navigation_bar_s nbgl_page_indicator_t
struct to represent a navigation bar (PAGE_INDICATOR type) There can be up to 5 page indicators,...
struct PACKED__ nbgl_radio_s nbgl_radio_t
struct to represent a radio button (RADIO_BUTTON type)
struct PACKED__ nbgl_text_area_s nbgl_text_area_t
struct to represent a text area (TEXT_AREA type)
struct PACKED__ nbgl_progress_bar_s nbgl_progress_bar_t
struct to represent a progress bar (PROGRESS_BAR type)
struct PACKED__ nbgl_keypad_s nbgl_keypad_t
struct to represent a keypad (KEYPAD type)
struct PACKED__ nbgl_text_entry_s nbgl_text_entry_t
struct to represent a text entry area (TEXT_ENTRY type)
struct PACKED__ nbgl_keyboard_s nbgl_keyboard_t
struct to represent a keyboard (KEYBOARD type)
struct PACKED__ nbgl_image_s nbgl_image_t
struct to represent an image (IMAGE type)
struct PACKED__ nbgl_button_s nbgl_button_t
struct to represent a button (BUTTON type) that can contain a text and/or an icon
struct PACKED__ nbgl_container_s nbgl_container_t
struct to represent a container (CONTAINER type)
struct PACKED__ nbgl_switch_s nbgl_switch_t
struct to represent a switch (size is fixed) (SWITCH type)
struct PACKED__ nbgl_obj_s nbgl_obj_t
Common structure for all graphical objects.
struct PACKED__ nbgl_spinner_s nbgl_spinner_t
struct to represent a "spinner", represented by the Ledger corners, in gray, with one of the corners ...
uint8_t nbgl_containerPoolGetNbUsed(uint8_t layer)
returns the number of containers currently used in the pool
#define OBJ_CONTAINER_POOL_LEN
Max number of objects pointers usable for container pool.
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.
void nbgl_containerPoolRelease(uint8_t layer)
Release the objects pointers from the pool for the given layer.
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)....
uint8_t nbgl_objPoolGetId(nbgl_obj_t *obj)
Gets a unique index for the given object, in the pool.
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.
uint8_t nbgl_objPoolGetNbUsed(uint8_t layer)
returns the number of objects currently used in the pool
#define OBJ_POOL_LEN
Max number of objects retrievable from pool.
void nbgl_objPoolRelease(uint8_t layer)
Release the objects from the pool for the given layer.
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)
nbgl_obj_type_t
All types of graphical objects.
nbgl_text_area_t textAreaObj
nbgl_page_indicator_t navBarObj
nbgl_spinner_t spinnerObj
nbgl_container_t containerObj
nbgl_keyboard_t keyboardObj
nbgl_progress_bar_t progressBarObj