1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-13 22:06:46 +00:00

lvgl: Enable keyboard and add HEX mode

This commit is contained in:
CTCaer 2020-04-30 03:53:04 +03:00
parent 3cecb03dac
commit 071dfa9792
3 changed files with 41 additions and 1 deletions

View file

@ -336,7 +336,7 @@
#define USE_LV_BTNM 1 #define USE_LV_BTNM 1
/*Keyboard (dependencies: lv_btnm)*/ /*Keyboard (dependencies: lv_btnm)*/
#define USE_LV_KB 0 #define USE_LV_KB 1
/*Check box (dependencies: lv_btn, lv_label)*/ /*Check box (dependencies: lv_btn, lv_label)*/
#define USE_LV_CB 1 #define USE_LV_CB 1

View file

@ -1,3 +1,18 @@
/*
* Copyright (c) 2019-2020 CTCaer
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/** /**
* @file lv_kb.c * @file lv_kb.c
@ -59,6 +74,13 @@ static const char * kb_map_num[] = {
"7", "8", "9", "\202Bksp", "\n", "7", "8", "9", "\202Bksp", "\n",
"+/-", "0", ".", SYMBOL_LEFT, SYMBOL_RIGHT, "" "+/-", "0", ".", SYMBOL_LEFT, SYMBOL_RIGHT, ""
}; };
static const char * kb_map_hex[] = {
"1", "2", "3", "A", "D", "\212", "\n",
"4", "5", "6", "B", "E", "\202Bksp", "\n",
"7", "8", "9", "C", "F", "\202"SYMBOL_OK, "\n",
"\211", "0", "\213", SYMBOL_LEFT, SYMBOL_RIGHT, ""
};
/********************** /**********************
* MACROS * MACROS
**********************/ **********************/
@ -183,6 +205,7 @@ void lv_kb_set_mode(lv_obj_t * kb, lv_kb_mode_t mode)
ext->mode = mode; ext->mode = mode;
if(mode == LV_KB_MODE_TEXT) lv_btnm_set_map(kb, kb_map_lc); if(mode == LV_KB_MODE_TEXT) lv_btnm_set_map(kb, kb_map_lc);
else if(mode == LV_KB_MODE_NUM) lv_btnm_set_map(kb, kb_map_num); else if(mode == LV_KB_MODE_NUM) lv_btnm_set_map(kb, kb_map_num);
else if (mode == LV_KB_MODE_HEX) lv_btnm_set_map(kb, kb_map_hex);
} }

View file

@ -1,3 +1,19 @@
/*
* Copyright (c) 2019-2020 CTCaer
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/** /**
* @file lv_kb.h * @file lv_kb.h
* *
@ -44,6 +60,7 @@ extern "C" {
enum { enum {
LV_KB_MODE_TEXT, LV_KB_MODE_TEXT,
LV_KB_MODE_NUM, LV_KB_MODE_NUM,
LV_KB_MODE_HEX
}; };
typedef uint8_t lv_kb_mode_t; typedef uint8_t lv_kb_mode_t;