Embedded SDK
Embedded SDK
Macros | Functions | Variables
nbgl_obj_keyboard.c File Reference

The construction and touch management of a keyboard object. More...

#include "nbgl_debug.h"
#include "nbgl_front.h"
#include "nbgl_draw.h"
#include "nbgl_obj.h"
#include "nbgl_fonts.h"
#include "nbgl_touch.h"
#include "glyphs.h"
#include "os_io.h"
Include dependency graph for nbgl_obj_keyboard.c:

Go to the source code of this file.

Macros

#define FIRST_LINE_CHAR_COUNT   10
 
#define SECOND_LINE_CHAR_COUNT   9
 
#define NORMAL_KEY_WIDTH   48
 
#define LETTER_OFFSET_Y   (((KEYBOARD_KEY_HEIGHT - 36) / 2) & 0xFFC)
 
#define SHIFT_KEY_WIDTH   (NORMAL_KEY_WIDTH + SECOND_LINE_OFFSET)
 
#define SECOND_LINE_OFFSET   ((SCREEN_WIDTH - (SECOND_LINE_CHAR_COUNT * NORMAL_KEY_WIDTH)) / 2)
 
#define SPACE_KEY_WIDTH   336
 
#define SWITCH_KEY_WIDTH   (SCREEN_WIDTH - SPACE_KEY_WIDTH)
 
#define SPECIAL_CHARS_KEY_WIDTH   (NORMAL_KEY_WIDTH * 2 + SECOND_LINE_OFFSET)
 
#define BACKSPACE_KEY_WIDTH_FULL   SHIFT_KEY_WIDTH
 
#define BACKSPACE_KEY_WIDTH_DIGITS   SPECIAL_CHARS_KEY_WIDTH
 
#define BACKSPACE_KEY_WIDTH_LETTERS_ONLY   (SCREEN_WIDTH - 7 * NORMAL_KEY_WIDTH)
 
#define IS_KEY_MASKED(_index)   (keyboard->keyMask & (1 << _index))
 

Functions

void nbgl_keyboardTouchCallback (nbgl_obj_t *obj, nbgl_touchType_t eventType)
 function to be called when the keyboard object is touched More...
 
bool nbgl_keyboardGetPosition (nbgl_keyboard_t *kbd, char index, uint16_t *x, uint16_t *y)
 This function gets the position (top-left corner) of the key at the given index. (to be used for Testing purpose) More...
 
void nbgl_objDrawKeyboard (nbgl_keyboard_t *kbd)
 This function draws a keyboard object. More...
 

Variables

const char kbd_digits [] = "1234567890-/:;()&@\".,?!\'"
 

Detailed Description

The construction and touch management of a keyboard object.

Definition in file nbgl_obj_keyboard.c.

Macro Definition Documentation

◆ BACKSPACE_KEY_WIDTH_DIGITS

#define BACKSPACE_KEY_WIDTH_DIGITS   SPECIAL_CHARS_KEY_WIDTH

Definition at line 47 of file nbgl_obj_keyboard.c.

◆ BACKSPACE_KEY_WIDTH_FULL

#define BACKSPACE_KEY_WIDTH_FULL   SHIFT_KEY_WIDTH

Definition at line 46 of file nbgl_obj_keyboard.c.

◆ BACKSPACE_KEY_WIDTH_LETTERS_ONLY

#define BACKSPACE_KEY_WIDTH_LETTERS_ONLY   (SCREEN_WIDTH - 7 * NORMAL_KEY_WIDTH)

Definition at line 48 of file nbgl_obj_keyboard.c.

◆ FIRST_LINE_CHAR_COUNT

#define FIRST_LINE_CHAR_COUNT   10

Definition at line 27 of file nbgl_obj_keyboard.c.

◆ IS_KEY_MASKED

#define IS_KEY_MASKED (   _index)    (keyboard->keyMask & (1 << _index))

Definition at line 50 of file nbgl_obj_keyboard.c.

◆ LETTER_OFFSET_Y

#define LETTER_OFFSET_Y   (((KEYBOARD_KEY_HEIGHT - 36) / 2) & 0xFFC)

Definition at line 35 of file nbgl_obj_keyboard.c.

◆ NORMAL_KEY_WIDTH

#define NORMAL_KEY_WIDTH   48

Definition at line 34 of file nbgl_obj_keyboard.c.

◆ SECOND_LINE_CHAR_COUNT

#define SECOND_LINE_CHAR_COUNT   9

Definition at line 28 of file nbgl_obj_keyboard.c.

◆ SECOND_LINE_OFFSET

#define SECOND_LINE_OFFSET   ((SCREEN_WIDTH - (SECOND_LINE_CHAR_COUNT * NORMAL_KEY_WIDTH)) / 2)

Definition at line 38 of file nbgl_obj_keyboard.c.

◆ SHIFT_KEY_WIDTH

#define SHIFT_KEY_WIDTH   (NORMAL_KEY_WIDTH + SECOND_LINE_OFFSET)

Definition at line 37 of file nbgl_obj_keyboard.c.

◆ SPACE_KEY_WIDTH

#define SPACE_KEY_WIDTH   336

Definition at line 42 of file nbgl_obj_keyboard.c.

◆ SPECIAL_CHARS_KEY_WIDTH

#define SPECIAL_CHARS_KEY_WIDTH   (NORMAL_KEY_WIDTH * 2 + SECOND_LINE_OFFSET)

Definition at line 45 of file nbgl_obj_keyboard.c.

◆ SWITCH_KEY_WIDTH

#define SWITCH_KEY_WIDTH   (SCREEN_WIDTH - SPACE_KEY_WIDTH)

Definition at line 44 of file nbgl_obj_keyboard.c.

Function Documentation

◆ nbgl_keyboardGetPosition()

bool nbgl_keyboardGetPosition ( nbgl_keyboard_t kbd,
char  index,
uint16_t x,
uint16_t y 
)

This function gets the position (top-left corner) of the key at the given index. (to be used for Testing purpose)

Parameters
kbdthe object to be drawned
indexascii character (in lower-case)
x[out] the top-left position
y[out] the top-left position
Returns
true if found, false otherwise

Definition at line 644 of file nbgl_obj_keyboard.c.

◆ nbgl_keyboardTouchCallback()

void nbgl_keyboardTouchCallback ( nbgl_obj_t obj,
nbgl_touchType_t  eventType 
)

function to be called when the keyboard object is touched

Parameters
objtouched object (keyboard)
eventTypetype of touch (only TOUCHED is accepted)
Returns
none

Definition at line 526 of file nbgl_obj_keyboard.c.

◆ nbgl_objDrawKeyboard()

void nbgl_objDrawKeyboard ( nbgl_keyboard_t kbd)

This function draws a keyboard object.

Parameters
kbdthe object to be drawned

Definition at line 692 of file nbgl_obj_keyboard.c.

Variable Documentation

◆ kbd_digits

const char kbd_digits[] = "1234567890-/:;()&@\".,?!\'"

Definition at line 65 of file nbgl_obj_keyboard.c.