17#include "os_helpers.h"
63 keyboard->obj.alignmentMarginY = 0;
64 keyboard->obj.alignment =
CENTER;
65 keyboard->enableBackspace = kbdInfo->enableBackspace;
66 keyboard->enableValidate = kbdInfo->enableValidate;
67 keyboard->obfuscated = kbdInfo->obfuscated;
70#ifdef KEYBOARD_NOT_SHUFFLED
71 keyboard->selectedCharIndex = 0;
73 keyboard->selectedCharIndex = cx_rng_u32() % 26;
75 keyboard->
mode = MODE_LOWER_LETTERS;
78 keyboard->mode = kbdInfo->
mode;
80 keyboard->callback = PIC(kbdInfo->
callback);
82 keyboard->keyMask = kbdInfo->
keyMask;
104 if (layout == NULL) {
110 if ((keyboard == NULL) || (keyboard->obj.type !=
KEYBOARD)) {
113 if (keyboard->lettersOnly) {
114#ifdef KEYBOARD_NOT_SHUFFLED
115 keyboard->selectedCharIndex = 0;
117 if (keyMask & (1 << 26)) {
118 keyboard->selectedCharIndex = cx_rng_u32() % 26;
121 keyboard->selectedCharIndex = 0;
128 if ((keyboard->keyMask == 0) && ((keyMask & 0x3FFFFFF) == 0x3FFFFFF)) {
129 keyboard->selectedCharIndex = 27;
132 keyboard->keyMask = keyMask;
160 if (layout == NULL) {
171 textEntry->text = text;
172 textEntry->fontId = fontId;
173 textEntry->nbChars = lettersOnly ? 8 : 9;
174 textEntry->obj.alignmentMarginY = 5;
176 textEntry->obj.area.width = 98;
177 textEntry->obj.area.height = 16;
199 return nbgl_layoutAddEnteredTextAdvanced(layout, text, lettersOnly,
false);
217 if (layout == NULL) {
223 if ((textEntry == NULL) || (textEntry->obj.type !=
TEXT_ENTRY)) {
226 textEntry->text = text;
Random Number Generation.
#define LOG_DEBUG(__logger,...)
@ BAGL_FONT_OPEN_SANS_EXTRABOLD_11px_1bpp
@ BAGL_FONT_OBFUSCATED_OPEN_SANS_EXTRABOLD_11px_1bpp
void layoutAddObject(nbgl_layoutInternal_t *layout, nbgl_obj_t *obj)
adds the given obj to the main container
DEPRECATED int nbgl_layoutAddEnteredText(nbgl_layout_t *layout, bool numbered, uint8_t number, const char *text, bool grayedOut, int offsetY, int token)
Adds a "text entry" area under the previously entered object. This area can be preceded (beginning of...
int nbgl_layoutUpdateKeyboard(nbgl_layout_t *layout, uint8_t index, uint32_t keyMask, bool updateCasing, keyboardCase_t casing)
Updates an existing keyboard on bottom of the screen, with the given configuration.
int nbgl_layoutAddKeyboard(nbgl_layout_t *layout, const nbgl_layoutKbd_t *kbdInfo)
Creates a keyboard on bottom of the screen, with the given configuration.
void * nbgl_layout_t
type shared externally
DEPRECATED int nbgl_layoutUpdateEnteredText(nbgl_layout_t *layout, uint8_t index, bool numbered, uint8_t number, const char *text, bool grayedOut)
Updates an existing "text entry" area, created with nbgl_layoutAddEnteredText()
Internal functions/constants of NBGL layout layer.
void nbgl_objDraw(nbgl_obj_t *obj)
nbgl_obj_t * nbgl_objPoolGet(nbgl_obj_type_t type, uint8_t layer)
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_obj_s nbgl_obj_t
Common structure for all graphical objects.
@ TEXT_ENTRY
area for entered text, only for Nanos
Structure containing all information about the current layout.
uint8_t layer
layer in screen stack
uint8_t nbChildren
number of children in above array
nbgl_obj_t ** children
children for main screen
This structure contains info to build a keyboard with nbgl_layoutAddKeyboard()
bool lettersOnly
if true, only display letter keys and Backspace
keyboardCallback_t callback
function called when an active key is pressed
keyboardMode_t mode
keyboard mode to start with