Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
Macros | Enumerations | Functions | Variables
nbgl_layout_keyboard.c File Reference

Implementation of predefined keyboard related layouts management. More...

#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "nbgl_debug.h"
#include "nbgl_front.h"
#include "nbgl_layout_internal.h"
#include "nbgl_obj.h"
#include "nbgl_draw.h"
#include "nbgl_screen.h"
#include "nbgl_touch.h"
#include "glyphs.h"
#include "os_io_seph_cmd.h"
#include "os_io_seph_ux.h"
#include "os_pic.h"
#include "os_helpers.h"
Include dependency graph for nbgl_layout_keyboard.c:

Go to the source code of this file.

Macros

#define SUGGESTION_BUTTONS_SIDE_MARGIN   BORDER_MARGIN
 
#define LINE_THICKNESS   2
 
#define LINE_COLOR   LIGHT_GRAY
 

Enumerations

enum  {
  PAGE_INDICATOR_INDEX = 0 , FIRST_BUTTON_INDEX , SECOND_BUTTON_INDEX , THIRD_BUTTON_INDEX ,
  FOURTH_BUTTON_INDEX , NB_SUGGESTION_CHILDREN
}
 
enum  { NUMBER_INDEX = 0 , TEXT_INDEX , DELETE_INDEX , LINE_INDEX }
 

Functions

static bool updateSuggestionButtons (nbgl_layoutInternal_t *layoutInt, nbgl_container_t *container, nbgl_touchType_t eventType, uint8_t currentLeftButtonIndex)
 
bool keyboardSwipeCallback (nbgl_layoutInternal_t *layoutInt, nbgl_obj_t *obj, nbgl_touchType_t eventType)
 
static nbgl_container_t * addTextEntry (nbgl_layoutInternal_t *layoutInt, const char *title, const char *text, bool numbered, uint8_t number, int textToken, bool compactMode, bool obfuscated)
 
static nbgl_container_t * addSuggestionButtons (nbgl_layoutInternal_t *layoutInt, uint8_t nbUsedButtons, const char **buttonTexts, int firstButtonToken, tune_index_e tuneId, bool obfuscated)
 
static nbgl_button_t * addConfirmationButton (nbgl_layoutInternal_t *layoutInt, bool active, const char *text, int token, tune_index_e tuneId, bool compactMode)
 
int nbgl_layoutAddKeyboard (nbgl_layout_t *layout, const nbgl_layoutKbd_t *kbdInfo)
 Creates a keyboard on bottom of the screen, with the given configuration.
 
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.
 
bool nbgl_layoutKeyboardNeedsRefresh (nbgl_layout_t *layout, uint8_t index)
 function called to know whether the keyboard has been redrawn and needs a refresh
 
int nbgl_layoutAddKeyboardContent (nbgl_layout_t *layout, nbgl_layoutKeyboardContent_t *content)
 Adds an area containing a potential title, a text entry and either confirmation or suggestion buttons, on top of the keyboard.
 
int nbgl_layoutUpdateKeyboardContent (nbgl_layout_t *layout, nbgl_layoutKeyboardContent_t *content)
 Updates an area containing a potential title, a text entry and either confirmation or suggestion buttons, on top of the keyboard This area must have been built with nbgl_layoutAddKeyboardContent, and the type must not change.
 

Variables

static const char * choiceTexts [NB_MAX_SUGGESTION_BUTTONS]
 
static char numText [5]
 
static uint8_t nbActiveButtons
 
static uint8_t currentFirstButtonToken
 

Detailed Description

Implementation of predefined keyboard related layouts management.

Note
This file applies only to wallet size products (Stax, Flex...)

Definition in file nbgl_layout_keyboard.c.

Macro Definition Documentation

◆ LINE_COLOR

#define LINE_COLOR   LIGHT_GRAY

Definition at line 127 of file nbgl_layout_keyboard.c.

◆ LINE_THICKNESS

#define LINE_THICKNESS   2

Definition at line 126 of file nbgl_layout_keyboard.c.

◆ SUGGESTION_BUTTONS_SIDE_MARGIN

#define SUGGESTION_BUTTONS_SIDE_MARGIN   BORDER_MARGIN

Definition at line 121 of file nbgl_layout_keyboard.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
PAGE_INDICATOR_INDEX 
FIRST_BUTTON_INDEX 
SECOND_BUTTON_INDEX 
THIRD_BUTTON_INDEX 
FOURTH_BUTTON_INDEX 
NB_SUGGESTION_CHILDREN 

Definition at line 36 of file nbgl_layout_keyboard.c.

◆ anonymous enum

anonymous enum
Enumerator
NUMBER_INDEX 
TEXT_INDEX 
DELETE_INDEX 
LINE_INDEX 

Definition at line 52 of file nbgl_layout_keyboard.c.

Function Documentation

◆ addConfirmationButton()

static nbgl_button_t * addConfirmationButton ( nbgl_layoutInternal_t *  layoutInt,
bool  active,
const char *  text,
int  token,
tune_index_e  tuneId,
bool  compactMode 
)
static

Definition at line 526 of file nbgl_layout_keyboard.c.

◆ addSuggestionButtons()

static nbgl_container_t * addSuggestionButtons ( nbgl_layoutInternal_t *  layoutInt,
uint8_t  nbUsedButtons,
const char **  buttonTexts,
int  firstButtonToken,
tune_index_e  tuneId,
bool  obfuscated 
)
static

Definition at line 438 of file nbgl_layout_keyboard.c.

◆ addTextEntry()

static nbgl_container_t * addTextEntry ( nbgl_layoutInternal_t *  layoutInt,
const char *  title,
const char *  text,
bool  numbered,
uint8_t  number,
int  textToken,
bool  compactMode,
bool  obfuscated 
)
static

Definition at line 316 of file nbgl_layout_keyboard.c.

◆ keyboardSwipeCallback()

bool keyboardSwipeCallback ( nbgl_layoutInternal_t *  layoutInt,
nbgl_obj_t *  obj,
nbgl_touchType_t  eventType 
)

Definition at line 279 of file nbgl_layout_keyboard.c.

◆ nbgl_layoutAddKeyboard()

int nbgl_layoutAddKeyboard ( nbgl_layout_t *  layout,
const nbgl_layoutKbd_t *  kbdInfo 
)

Creates a keyboard on bottom of the screen, with the given configuration.

Parameters
layoutthe current layout
kbdInfoconfiguration of the keyboard to draw (including the callback when touched)
Returns
the index of keyboard, to use in nbgl_layoutUpdateKeyboard()

Definition at line 576 of file nbgl_layout_keyboard.c.

◆ nbgl_layoutAddKeyboardContent()

int nbgl_layoutAddKeyboardContent ( nbgl_layout_t *  layout,
nbgl_layoutKeyboardContent_t *  content 
)

Adds an area containing a potential title, a text entry and either confirmation or suggestion buttons, on top of the keyboard.

Parameters
layoutthe current layout
contentstructure containing the info
Returns
the height of the area if OK

Definition at line 720 of file nbgl_layout_keyboard.c.

◆ nbgl_layoutKeyboardNeedsRefresh()

bool nbgl_layoutKeyboardNeedsRefresh ( nbgl_layout_t *  layout,
uint8_t  index 
)

function called to know whether the keyboard has been redrawn and needs a refresh

Parameters
layoutthe current layout
indexindex returned by nbgl_layoutAddKeyboard() (unused)
Returns
true if keyboard needs a refresh

Definition at line 685 of file nbgl_layout_keyboard.c.

◆ nbgl_layoutUpdateKeyboard()

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.

Parameters
layoutthe current layout
indexindex returned by nbgl_layoutAddKeyboard() (unused)
keyMaskmask of keys to activate/deactivate on keyboard
updateCasingif true, update keyboard casing with given value
casingcasing to use
Returns
>=0 if OK

Definition at line 646 of file nbgl_layout_keyboard.c.

◆ nbgl_layoutUpdateKeyboardContent()

int nbgl_layoutUpdateKeyboardContent ( nbgl_layout_t *  layout,
nbgl_layoutKeyboardContent_t *  content 
)

Updates an area containing a potential title, a text entry and either confirmation or suggestion buttons, on top of the keyboard This area must have been built with nbgl_layoutAddKeyboardContent, and the type must not change.

Parameters
layoutthe current layout
contentstructure containing the updated info
Returns
the height of the area if OK

Definition at line 810 of file nbgl_layout_keyboard.c.

◆ updateSuggestionButtons()

static bool updateSuggestionButtons ( nbgl_layoutInternal_t *  layoutInt,
nbgl_container_t *  container,
nbgl_touchType_t  eventType,
uint8_t  currentLeftButtonIndex 
)
static

Definition at line 156 of file nbgl_layout_keyboard.c.

Variable Documentation

◆ choiceTexts

const char* choiceTexts[NB_MAX_SUGGESTION_BUTTONS]
static

Definition at line 142 of file nbgl_layout_keyboard.c.

◆ currentFirstButtonToken

uint8_t currentFirstButtonToken
static

Definition at line 145 of file nbgl_layout_keyboard.c.

◆ nbActiveButtons

uint8_t nbActiveButtons
static

Definition at line 144 of file nbgl_layout_keyboard.c.

◆ numText

char numText[5]
static

Definition at line 143 of file nbgl_layout_keyboard.c.