Merge beta to release v4.0
This commit is contained in:
657
lv_app/lv_app.c
657
lv_app/lv_app.c
File diff suppressed because it is too large
Load Diff
@@ -13,10 +13,26 @@
|
||||
#include "lvgl/lvgl.h"
|
||||
|
||||
#if LV_APP_ENABLE != 0
|
||||
#include "lvgl/lv_app/lv_app_util/lv_app_kb.h"
|
||||
#include "lvgl/lv_app/lv_app_util/lv_app_fsel.h"
|
||||
#include "lvgl/lv_app/lv_app_util/lv_app_notice.h"
|
||||
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
/*Check dependencies*/
|
||||
#if LV_OBJ_FREE_P == 0
|
||||
#error "lv_app: Free pointer is required for application. Enable it lv_conf.h: LV_OBJ_FREE_P 1"
|
||||
#endif
|
||||
|
||||
#if LV_OBJ_FREE_NUM == 0
|
||||
#error "lv_app: Free number is required for application. Enable it lv_conf.h: LV_OBJ_FREE_NUM 1"
|
||||
#endif
|
||||
|
||||
#if DM_CUSTOM == 0 && DM_MEM_SIZE < (2 * 1024)
|
||||
#error "lv_app: not enough dynamic memory. Increase it in misc_conf.h: DM_MEM_SIZE"
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@@ -30,7 +46,7 @@ typedef enum
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LV_APP_COM_TYPE_CHAR, /*Stream of characters. Always '\0' terminated*/
|
||||
LV_APP_COM_TYPE_CHAR, /*Stream of characters. Not '\0' terminated*/
|
||||
LV_APP_COM_TYPE_INT, /*Stream of 'int32_t' numbers*/
|
||||
LV_APP_COM_TYPE_LOG, /*String about an event to log*/
|
||||
LV_APP_COM_TYPE_TRIG, /*A trigger to do some specific action (data is ignored)*/
|
||||
@@ -47,6 +63,7 @@ typedef struct
|
||||
lv_obj_t * sc;
|
||||
lv_obj_t * sc_title;
|
||||
lv_obj_t * win;
|
||||
lv_obj_t * conf_win;
|
||||
void * app_data;
|
||||
void * sc_data;
|
||||
void * win_data;
|
||||
@@ -63,38 +80,27 @@ typedef struct __LV_APP_DSC_T
|
||||
void (*sc_close) (lv_app_inst_t *);
|
||||
void (*win_open) (lv_app_inst_t *, lv_obj_t *);
|
||||
void (*win_close) (lv_app_inst_t *);
|
||||
void (*conf_open) (lv_app_inst_t *, lv_obj_t * );
|
||||
uint16_t app_data_size;
|
||||
uint16_t sc_data_size;
|
||||
uint16_t win_data_size;
|
||||
}lv_app_dsc_t;
|
||||
|
||||
typedef struct {
|
||||
lv_rects_t menu_style;
|
||||
lv_btns_t menu_btn_style;
|
||||
lv_labels_t menu_btn_label_style;
|
||||
lv_imgs_t menu_btn_img_style;
|
||||
lv_lists_t app_list_style;
|
||||
lv_pages_t sc_page_style;
|
||||
lv_labels_t win_txt_style;
|
||||
lv_wins_t win_style;
|
||||
lv_btns_t sc_style;
|
||||
lv_btns_t sc_send_style;
|
||||
lv_btns_t sc_rec_style;
|
||||
lv_labels_t sc_title_style;
|
||||
lv_labels_t sc_txt_style;
|
||||
|
||||
opa_t menu_opa;
|
||||
opa_t menu_btn_opa;
|
||||
opa_t sc_opa;
|
||||
|
||||
cord_t menu_h;
|
||||
cord_t app_list_w;
|
||||
cord_t app_list_h;
|
||||
cord_t sc_title_margin;
|
||||
|
||||
/*Calculated values, do not set them!*/
|
||||
cord_t win_useful_w;
|
||||
cord_t win_useful_h;
|
||||
lv_style_t menu;
|
||||
lv_style_t menu_btn_rel;
|
||||
lv_style_t menu_btn_pr;
|
||||
lv_style_t sc_rel;
|
||||
lv_style_t sc_pr;
|
||||
lv_style_t sc_send_rel;
|
||||
lv_style_t sc_send_pr;
|
||||
lv_style_t sc_rec_rel;
|
||||
lv_style_t sc_rec_pr;
|
||||
lv_style_t sc_title;
|
||||
lv_style_t win_header;
|
||||
lv_style_t win_scrl;
|
||||
lv_style_t win_cbtn_rel;
|
||||
lv_style_t win_cbtn_pr;
|
||||
}lv_app_style_t;
|
||||
|
||||
|
||||
@@ -215,10 +221,6 @@ lv_app_inst_t * lv_app_get_next(lv_app_inst_t * prev, lv_app_dsc_t * dsc);
|
||||
*/
|
||||
lv_app_dsc_t ** lv_app_dsc_get_next(lv_app_dsc_t ** prev);
|
||||
|
||||
/**
|
||||
* Refresh the style of the applications
|
||||
* */
|
||||
void lv_app_style_refr(void);
|
||||
|
||||
/**
|
||||
* Get a pointer to the application style structure. If modified then 'lv_app_refr_style' should be called
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_app_fsel.h"
|
||||
#if LV_APP_ENABLE != 0
|
||||
#if USE_LV_APP_FSEL != 0
|
||||
|
||||
#include <stdio.h>
|
||||
#include "lv_app_notice.h"
|
||||
@@ -15,9 +15,6 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_APP_FSEL_FN_MAX_LEN 128
|
||||
#define LV_APP_FSEL_PATH_MAX_LEN 256
|
||||
#define LV_APP_FSEL_PAGE_SIZE 8
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@@ -45,9 +42,9 @@ static char fsel_path[LV_APP_FSEL_PATH_MAX_LEN];
|
||||
static uint16_t fsel_file_cnt;
|
||||
static lv_obj_t * fsel_win;
|
||||
static lv_obj_t * fsel_list;
|
||||
static lv_lists_t fsel_lists;
|
||||
static void * fsel_param;
|
||||
static void (*fsel_ok_action)(void *, const char *);
|
||||
static lv_style_t style_btn_symbol;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
@@ -62,7 +59,8 @@ static void (*fsel_ok_action)(void *, const char *);
|
||||
*/
|
||||
void lv_app_fsel_init(void)
|
||||
{
|
||||
lv_lists_get(LV_LISTS_TRANSP, &fsel_lists);
|
||||
lv_style_get(LV_STYLE_BTN_REL, &style_btn_symbol);
|
||||
style_btn_symbol.font = font_get(LV_IMG_DEF_SYMBOL_FONT);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,13 +89,14 @@ void lv_app_fsel_open(const char * path, const char * filter, void * param, void
|
||||
/*Check filter: NULL and "" mean no filtering*/
|
||||
if(fsel_filter == NULL) fsel_filter = "";
|
||||
|
||||
/*Create a window for the File selector*/
|
||||
lv_app_style_t * app_style = lv_app_style_get();
|
||||
|
||||
/*Create a window for the File selector*/
|
||||
fsel_win = lv_win_create(lv_scr_act(), NULL);
|
||||
lv_obj_set_size(fsel_win, LV_HOR_RES, LV_VER_RES);
|
||||
lv_obj_set_style(fsel_win, &app_style->win_style);
|
||||
lv_win_set_styles_cbtn(fsel_win, &app_style->win_cbtn_rel, &app_style->win_cbtn_pr);
|
||||
|
||||
lv_win_add_ctrl_btn(fsel_win, "U:/icon_close", fsel_close_action);
|
||||
lv_win_add_cbtn(fsel_win, SYMBOL_CLOSE, fsel_close_action);
|
||||
|
||||
fsel_refr(); /*Refresh the list*/
|
||||
|
||||
@@ -139,34 +138,34 @@ static void fsel_refr(void)
|
||||
lv_win_set_title(fsel_win, fsel_path);
|
||||
|
||||
/*Create a new list*/
|
||||
lv_app_style_t * app_style = lv_app_style_get();
|
||||
fsel_list = lv_list_create(fsel_win, NULL);
|
||||
lv_obj_set_width(fsel_list, app_style->win_useful_w);
|
||||
lv_obj_set_style(fsel_list, lv_lists_get(LV_LISTS_TRANSP, NULL));
|
||||
lv_obj_set_width(fsel_list, lv_win_get_width(fsel_win));
|
||||
lv_list_set_style_img(fsel_list, &style_btn_symbol);
|
||||
lv_obj_set_style(lv_page_get_scrl(fsel_list), lv_style_get(LV_STYLE_TRANSP_TIGHT, NULL));
|
||||
lv_obj_set_drag_parent(fsel_list, true);
|
||||
lv_obj_set_drag_parent(lv_page_get_scrl(fsel_list), true);
|
||||
lv_rect_set_fit(fsel_list, false, true);
|
||||
lv_cont_set_fit(fsel_list, false, true);
|
||||
|
||||
fs_res_t res = FS_RES_OK;
|
||||
lv_obj_t * liste;
|
||||
|
||||
/*At empty path show the drivers */
|
||||
if(fsel_path[0] == '\0') {
|
||||
char drv[16];
|
||||
char buf[2];
|
||||
lv_obj_t * liste;
|
||||
fs_get_letters(drv);
|
||||
uint8_t i;
|
||||
for(i = 0; drv[i] != '\0'; i++) {
|
||||
buf[0] = drv[i];
|
||||
buf[1] = '\0';
|
||||
liste = lv_list_add(fsel_list, "U:/icon_driver", buf, fsel_drv_action);
|
||||
liste = lv_list_add(fsel_list, SYMBOL_DRIVE, buf, fsel_drv_action);
|
||||
/*Add long press action to choose the driver as a folder*/
|
||||
if(fsel_filter[0] == '/') lv_btn_set_lpr_action(liste, fsel_drv_lpr_action);
|
||||
}
|
||||
}
|
||||
/*List the files/folders with fs interface*/
|
||||
else {
|
||||
lv_list_add(fsel_list, "U:/icon_up", "Up", fsel_up_action);
|
||||
liste = lv_list_add(fsel_list, SYMBOL_UP, "Up", fsel_up_action);
|
||||
|
||||
fs_readdir_t rd;
|
||||
res = fs_readdir_init(&rd, fsel_path);
|
||||
@@ -177,7 +176,7 @@ static void fsel_refr(void)
|
||||
|
||||
/*At not first page add prev. page button */
|
||||
if(fsel_file_cnt != 0) {
|
||||
lv_list_add(fsel_list, "U:/icon_left", "Previous page", fsel_prev_action);
|
||||
liste = lv_list_add(fsel_list, SYMBOL_LEFT, "Previous page", fsel_prev_action);
|
||||
}
|
||||
|
||||
char fn[LV_APP_FSEL_FN_MAX_LEN];
|
||||
@@ -186,7 +185,7 @@ static void fsel_refr(void)
|
||||
uint16_t file_cnt = 0;
|
||||
while(file_cnt <= fsel_file_cnt) {
|
||||
res = fs_readdir(&rd, fn);
|
||||
if(res != FS_RES_OK || fn[0] == '\0'){
|
||||
if(res != FS_RES_OK){
|
||||
lv_app_notice_add("Can not read the path\nin File selector");
|
||||
return;
|
||||
}
|
||||
@@ -197,7 +196,7 @@ static void fsel_refr(void)
|
||||
while(res == FS_RES_OK && fn[0] != '\0') {
|
||||
if(fn[0] == '/') { /*Add a folder*/
|
||||
lv_obj_t * liste;
|
||||
liste = lv_list_add(fsel_list, "U:/icon_folder", &fn[1], fsel_folder_action);
|
||||
liste = lv_list_add(fsel_list, SYMBOL_FOLDER, &fn[1], fsel_folder_action);
|
||||
/*Add long press action to choose a folder*/
|
||||
if(fsel_filter[0] == '/') lv_btn_set_lpr_action(liste, fsel_folder_lpr_action);
|
||||
|
||||
@@ -208,7 +207,7 @@ static void fsel_refr(void)
|
||||
else if(fsel_filter[0] == '\0' || /*No filtering or ...*/
|
||||
(strcmp(fs_get_ext(fn), fsel_filter) == 0 && /*.. the filter matches*/
|
||||
fsel_filter[0] != '/')) {
|
||||
lv_list_add(fsel_list, "U:/icon_file", fn, fsel_file_action);
|
||||
liste = lv_list_add(fsel_list, SYMBOL_FILE, fn, fsel_file_action);
|
||||
fsel_file_cnt ++;
|
||||
file_cnt ++;
|
||||
}
|
||||
@@ -218,7 +217,7 @@ static void fsel_refr(void)
|
||||
|
||||
/*Show only LV_APP_FSEL_MAX_FILE elements and add a Next page button*/
|
||||
if(fsel_file_cnt != 0 && fsel_file_cnt % LV_APP_FSEL_PAGE_SIZE == 0) {
|
||||
lv_list_add(fsel_list, "U:/icon_right", "Next page", fsel_next_action);
|
||||
liste = lv_list_add(fsel_list, SYMBOL_RIGHT, "Next page", fsel_next_action);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -301,7 +300,7 @@ static lv_action_res_t fsel_prev_action(lv_obj_t * prev, lv_dispi_t * dispi)
|
||||
*/
|
||||
static lv_action_res_t fsel_drv_action(lv_obj_t * drv, lv_dispi_t * dispi)
|
||||
{
|
||||
sprintf(fsel_path, "%s:", lv_list_element_get_txt(drv));
|
||||
sprintf(fsel_path, "%s:", lv_list_get_element_text(drv));
|
||||
fsel_file_cnt = 0;
|
||||
fsel_refr();
|
||||
return LV_ACTION_RES_INV;
|
||||
@@ -315,7 +314,7 @@ static lv_action_res_t fsel_drv_action(lv_obj_t * drv, lv_dispi_t * dispi)
|
||||
*/
|
||||
static lv_action_res_t fsel_drv_lpr_action(lv_obj_t * drv, lv_dispi_t * dispi)
|
||||
{
|
||||
sprintf(fsel_path, "%s:", lv_list_element_get_txt(drv));
|
||||
sprintf(fsel_path, "%s:", lv_list_get_element_text(drv));
|
||||
|
||||
if(fsel_ok_action != NULL) {
|
||||
fsel_ok_action(fsel_param, fsel_path);
|
||||
@@ -334,7 +333,7 @@ static lv_action_res_t fsel_drv_lpr_action(lv_obj_t * drv, lv_dispi_t * dispi)
|
||||
*/
|
||||
static lv_action_res_t fsel_folder_action(lv_obj_t * folder, lv_dispi_t * dispi)
|
||||
{
|
||||
sprintf(fsel_path, "%s/%s", fsel_path, lv_list_element_get_txt(folder));
|
||||
sprintf(fsel_path, "%s/%s", fsel_path, lv_list_get_element_text(folder));
|
||||
fsel_file_cnt = 0;
|
||||
fsel_refr();
|
||||
return LV_ACTION_RES_INV;
|
||||
@@ -348,7 +347,7 @@ static lv_action_res_t fsel_folder_action(lv_obj_t * folder, lv_dispi_t * dispi)
|
||||
*/
|
||||
static lv_action_res_t fsel_folder_lpr_action(lv_obj_t * folder, lv_dispi_t * dispi)
|
||||
{
|
||||
sprintf(fsel_path, "%s/%s", fsel_path, lv_list_element_get_txt(folder));
|
||||
sprintf(fsel_path, "%s/%s", fsel_path, lv_list_get_element_text(folder));
|
||||
|
||||
if(fsel_ok_action != NULL) {
|
||||
fsel_ok_action(fsel_param, fsel_path);
|
||||
@@ -367,7 +366,7 @@ static lv_action_res_t fsel_folder_lpr_action(lv_obj_t * folder, lv_dispi_t * di
|
||||
*/
|
||||
static lv_action_res_t fsel_file_action(lv_obj_t * file, lv_dispi_t * dispi)
|
||||
{
|
||||
sprintf(fsel_path, "%s/%s", fsel_path, lv_list_element_get_txt(file));
|
||||
sprintf(fsel_path, "%s/%s", fsel_path, lv_list_get_element_text(file));
|
||||
|
||||
if(fsel_ok_action != NULL) {
|
||||
fsel_ok_action(fsel_param, fsel_path);
|
||||
|
||||
@@ -10,11 +10,24 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../lv_app.h"
|
||||
#if LV_APP_ENABLE != 0
|
||||
#if USE_LV_APP_FSEL != 0
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
/*Add the required configurations*/
|
||||
#ifndef LV_APP_FSEL_FN_MAX_LEN
|
||||
#define LV_APP_FSEL_FN_MAX_LEN 128
|
||||
#endif
|
||||
|
||||
#ifndef LV_APP_FSEL_PATH_MAX_LEN
|
||||
#define LV_APP_FSEL_PATH_MAX_LEN 256
|
||||
#endif
|
||||
|
||||
#ifndef LV_APP_FSEL_PAGE_SIZE
|
||||
#define LV_APP_FSEL_PAGE_SIZE 8
|
||||
#endif
|
||||
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@@ -35,7 +48,7 @@ void lv_app_fsel_init(void);
|
||||
* @param filter show only files with a specific extension, e.g. "wav".
|
||||
* "/" means filter to folders.
|
||||
* @param param a free parameter which will be added to 'ok_action'
|
||||
* @param ok_action an action to call when a file or folder is chosen
|
||||
* @param ok_action an action to call when a file or folder is chosen (give 'param' and the path as parameters)
|
||||
*/
|
||||
void lv_app_fsel_open(const char * path, const char * filter, void * param,
|
||||
void (*ok_action)(void *, const char *));
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_app_kb.h"
|
||||
#if LV_APP_ENABLE != 0
|
||||
#if USE_LV_APP_KB != 0
|
||||
|
||||
#include "lvgl/lv_objx/lv_btnm.h"
|
||||
#include "lvgl/lv_objx/lv_ta.h"
|
||||
@@ -33,23 +33,23 @@ static lv_obj_t * kb_win;
|
||||
static lv_obj_t * kb_ta;
|
||||
static const char * kb_map_lc[] = {
|
||||
"\0051#", "\004q", "\004w", "\004e", "\004r", "\004t", "\004y", "\004u", "\004i", "\004o", "\004p", "\007Del", "\n",
|
||||
"\007ABC", "\004a", "\004s", "\004d", "\004f", "\004g", "\004h", "\004j", "\004k", "\004l", "\010Enter", "\n",
|
||||
"\006ABC", "\003a", "\003s", "\003d", "\003f", "\003g", "\003h", "\003j", "\003k", "\003l", "\010Enter", "\n",
|
||||
"_", "-", "z", "x", "c", "v", "b", "n", "m", ".", ",", ":", "\n",
|
||||
"\002Hide", "\002Left", "\006 ", "\002Right", "\002Ok", ""
|
||||
"\003Hide", "\003Left", "\006 ", "\003Right", "\003Ok", ""
|
||||
};
|
||||
|
||||
static const char * kb_map_uc[] = {
|
||||
"\0051#", "\004Q", "\004W", "\004E", "\004R", "\004T", "\004Y", "\004U", "\004I", "\004O", "\004P", "\007Del", "\n",
|
||||
"\007abc", "\004A", "\004S", "\004D", "\004F", "\004G", "\004H", "\004J", "\004K", "\004L", "\010Enter", "\n",
|
||||
"\006abc", "\003A", "\003S", "\003D", "\003F", "\003G", "\003H", "\003J", "\003K", "\003L", "\010Enter", "\n",
|
||||
"_", "-", "Z", "X", "C", "V", "B", "N", "M", ".", ",", ":", "\n",
|
||||
"\002Hide", "\002Left", "\006 ", "\002Right", "\002Ok", ""
|
||||
"\003Hide", "\003Left", "\006 ", "\003Right", "\003Ok", ""
|
||||
};
|
||||
|
||||
static const char * kb_map_spec[] = {
|
||||
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "\002Del", "\n",
|
||||
"\002abc", "+", "-", "/", "*", "=", "%", "!", "?", "#", "<", ">", "\n",
|
||||
"\\", "@", "$", "(", ")", "{", "}", "[", "]", ";", "\"", "'", "\n",
|
||||
"\002Hide", "\002Left", "\006 ", "\002Right", "\002Ok", ""
|
||||
"\003Hide", "\003Left", "\006 ", "\003Right", "\003Ok", ""
|
||||
};
|
||||
|
||||
static const char * kb_map_num[] = {
|
||||
@@ -63,8 +63,9 @@ static cord_t kb_ta_ori_size;
|
||||
static uint8_t kb_mode;
|
||||
static void (*kb_close_action)(lv_obj_t *);
|
||||
static void (*kb_ok_action)(lv_obj_t *);
|
||||
static lv_btnms_t kb_btnms;
|
||||
|
||||
static lv_style_t style_bg;
|
||||
static lv_style_t style_btn_rel;
|
||||
static lv_style_t style_btn_pr;
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
@@ -78,17 +79,21 @@ static lv_btnms_t kb_btnms;
|
||||
*/
|
||||
void lv_app_kb_init(void)
|
||||
{
|
||||
lv_btnms_get(LV_BTNMS_DEF, &kb_btnms);
|
||||
kb_btnms.rects.gcolor = COLOR_WHITE;
|
||||
kb_btnms.rects.objs.color = COLOR_WHITE;
|
||||
kb_btnms.rects.opad = 4 + LV_DOWNSCALE;
|
||||
kb_btnms.rects.vpad = 3 + LV_DOWNSCALE;
|
||||
kb_btnms.rects.hpad = 3 + LV_DOWNSCALE;
|
||||
kb_btnms.rects.round = 0;
|
||||
kb_btnms.rects.bwidth = 0;
|
||||
lv_app_style_t * app_style = lv_app_style_get();
|
||||
|
||||
kb_btnms.btns.rects.bwidth = 0;
|
||||
kb_btnms.btns.rects.round = 0;
|
||||
memcpy(&style_bg, &app_style->menu, sizeof(lv_style_t));
|
||||
style_bg.opa = OPA_COVER;
|
||||
style_bg.hpad = 0;
|
||||
style_bg.vpad = 0;
|
||||
style_bg.opad = 0;
|
||||
|
||||
memcpy(&style_btn_rel, &app_style->menu_btn_rel, sizeof(lv_style_t));
|
||||
style_btn_rel.radius = 0;
|
||||
style_btn_rel.bwidth = 1;
|
||||
|
||||
memcpy(&style_btn_pr, &app_style->menu_btn_pr, sizeof(lv_style_t));
|
||||
style_btn_pr.radius = 0;
|
||||
style_btn_pr.bwidth = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,8 +102,9 @@ void lv_app_kb_init(void)
|
||||
* @param mode 'OR'd values of 'lv_app_kb_mode_t' enum
|
||||
* @param close a function to call when the keyboard is closed
|
||||
* @param ok a function to called when the "Ok" button is pressed
|
||||
* @return the created button matrix objects
|
||||
*/
|
||||
void lv_app_kb_open(lv_obj_t * ta, lv_app_kb_mode_t mode, void (*close)(lv_obj_t *), void (*ok)(lv_obj_t *))
|
||||
lv_obj_t * lv_app_kb_open(lv_obj_t * ta, lv_app_kb_mode_t mode, void (*close)(lv_obj_t *), void (*ok)(lv_obj_t *))
|
||||
{
|
||||
/*Close the previous keyboard*/
|
||||
if(kb_btnm != NULL) {
|
||||
@@ -113,39 +119,47 @@ void lv_app_kb_open(lv_obj_t * ta, lv_app_kb_mode_t mode, void (*close)(lv_obj_t
|
||||
|
||||
/*Create a button matrix for the keyboard */
|
||||
kb_btnm = lv_btnm_create(lv_scr_act(), NULL);
|
||||
lv_obj_set_style(kb_btnm, &style_bg);
|
||||
lv_obj_set_size(kb_btnm, LV_HOR_RES, LV_VER_RES / 2);
|
||||
lv_obj_align(kb_btnm, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
|
||||
lv_btnm_set_cb(kb_btnm, lv_app_kb_action);
|
||||
lv_btnm_set_action(kb_btnm, lv_app_kb_action);
|
||||
if(mode & LV_APP_KB_MODE_TXT) {
|
||||
kb_btnms.labels.font = LV_APP_FONT_MEDIUM;
|
||||
style_btn_rel.font = font_get(LV_APP_FONT_MEDIUM);
|
||||
style_btn_pr.font = font_get(LV_APP_FONT_MEDIUM);
|
||||
lv_btnm_set_map(kb_btnm, kb_map_lc);
|
||||
}
|
||||
else if(mode & LV_APP_KB_MODE_NUM) {
|
||||
kb_btnms.labels.font = LV_APP_FONT_LARGE;
|
||||
style_btn_rel.font = font_get(LV_APP_FONT_LARGE);
|
||||
style_btn_pr.font = font_get(LV_APP_FONT_LARGE);
|
||||
lv_btnm_set_map(kb_btnm, kb_map_num);
|
||||
}
|
||||
lv_obj_set_style(kb_btnm, &kb_btnms);
|
||||
lv_btnm_set_styles_btn(kb_btnm, &style_btn_rel, &style_btn_pr);
|
||||
|
||||
/*Reduce teh size of the window and align it to the top*/
|
||||
kb_win = lv_app_win_get_from_obj(kb_ta);
|
||||
lv_obj_set_height(kb_win, LV_VER_RES / 2);
|
||||
lv_obj_set_y(kb_win, 0);
|
||||
kb_win = NULL;
|
||||
kb_ta_ori_size = 0;
|
||||
if(mode & LV_APP_KB_MODE_WIN_RESIZE) {
|
||||
/*Reduce the size of the window and align it to the top*/
|
||||
kb_win = lv_app_win_get_from_obj(kb_ta);
|
||||
lv_obj_set_height(kb_win, LV_VER_RES / 2);
|
||||
lv_obj_set_y(kb_win, 0);
|
||||
|
||||
/*If the text area is higher then the new size of the window redus its size too*/
|
||||
lv_app_style_t * app_style = lv_app_style_get();
|
||||
cord_t win_h = lv_obj_get_height(kb_win) - 2 * app_style->win_style.pages.scrl_rects.vpad;
|
||||
kb_ta_ori_size = lv_obj_get_height(kb_ta);
|
||||
if(lv_obj_get_height(kb_ta) > win_h) {
|
||||
lv_obj_set_height(kb_ta, win_h);
|
||||
/*If the text area is higher then the new size of the window reduce its size too*/
|
||||
cord_t cont_h = lv_obj_get_height(kb_win) - lv_obj_get_height(lv_win_get_header(kb_win));
|
||||
kb_ta_ori_size = lv_obj_get_height(kb_ta);
|
||||
if(lv_obj_get_height(kb_ta) > cont_h - LV_DPI / 10) {
|
||||
lv_obj_set_height(kb_ta, cont_h - LV_DPI / 10);
|
||||
}
|
||||
#if LV_APP_ANIM_LEVEL != 0
|
||||
lv_page_focus(lv_win_get_content(kb_win), kb_ta, true);
|
||||
#else
|
||||
lv_page_focus(lv_win_get_page(kb_win), kb_ta, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
lv_ta_set_cursor_pos(kb_ta, LV_TA_CUR_LAST);
|
||||
|
||||
#if LV_APP_ANIM_LEVEL != 0
|
||||
lv_page_focus(lv_win_get_content(kb_win), kb_ta, true);
|
||||
#else
|
||||
lv_page_focus(kb_win, kb_ta, false);
|
||||
#endif
|
||||
return kb_btnm;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,11 +177,11 @@ void lv_app_kb_close(bool ok)
|
||||
}
|
||||
|
||||
/*Reset the modified sizes*/
|
||||
|
||||
lv_obj_set_height(kb_ta, kb_ta_ori_size);
|
||||
|
||||
lv_obj_set_size(kb_win, LV_HOR_RES, LV_VER_RES);
|
||||
kb_win = NULL;
|
||||
if((kb_mode & LV_APP_KB_MODE_WIN_RESIZE) && kb_win != NULL) {
|
||||
lv_obj_set_height(kb_ta, kb_ta_ori_size);
|
||||
lv_obj_set_size(kb_win, LV_HOR_RES, LV_VER_RES);
|
||||
kb_win = NULL;
|
||||
}
|
||||
|
||||
lv_obj_del(kb_btnm);
|
||||
kb_btnm = NULL;
|
||||
@@ -237,11 +251,13 @@ static lv_action_res_t lv_app_kb_action(lv_obj_t * btnm, uint16_t i)
|
||||
lv_ta_add_text(kb_ta, txt);
|
||||
}
|
||||
|
||||
if(kb_mode & LV_APP_KB_MODE_WIN_RESIZE) {
|
||||
#if LV_APP_ANIM_LEVEL != 0
|
||||
lv_page_focus(lv_win_get_content(kb_win), kb_ta, true);
|
||||
lv_page_focus(lv_win_get_content(kb_win), kb_ta, true);
|
||||
#else
|
||||
lv_page_focus(kb_win, kb_ta, false);
|
||||
lv_page_focus(lv_win_get_page(kb_win), kb_ta, 0);
|
||||
#endif
|
||||
}
|
||||
return LV_ACTION_RES_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../lv_app.h"
|
||||
#if LV_APP_ENABLE != 0
|
||||
#if USE_LV_APP_KB != 0
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -23,6 +23,7 @@ typedef enum
|
||||
{
|
||||
LV_APP_KB_MODE_TXT = 0x01,
|
||||
LV_APP_KB_MODE_NUM = 0x02,
|
||||
LV_APP_KB_MODE_WIN_RESIZE = 0x04,
|
||||
}lv_app_kb_mode_t;
|
||||
|
||||
/**********************
|
||||
@@ -40,8 +41,9 @@ void lv_app_kb_init(void);
|
||||
* @param mode 'OR'd values of 'lv_app_kb_mode_t' enum
|
||||
* @param close a function to call when the keyboard is closed
|
||||
* @param ok a function to called when the "Ok" button is pressed
|
||||
* @return the created button matrix objects
|
||||
*/
|
||||
void lv_app_kb_open(lv_obj_t * ta, lv_app_kb_mode_t mode, void (*close)(lv_obj_t *), void (*ok)(lv_obj_t *));
|
||||
lv_obj_t * lv_app_kb_open(lv_obj_t * ta, lv_app_kb_mode_t mode, void (*close)(lv_obj_t *), void (*ok)(lv_obj_t *));
|
||||
|
||||
/**
|
||||
* Close the keyboard
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_app_notice.h"
|
||||
#if LV_APP_ENABLE != 0
|
||||
#if USE_LV_APP_NOTICE != 0
|
||||
|
||||
#include "lvgl/lv_objx/lv_rect.h"
|
||||
#include <lvgl/lv_objx/lv_cont.h>
|
||||
#include "lvgl/lv_objx/lv_label.h"
|
||||
|
||||
#include "lvgl/lv_misc/anim.h"
|
||||
#include "misc/gfx/anim.h"
|
||||
#include <stdio.h>
|
||||
|
||||
/*********************
|
||||
@@ -44,14 +44,12 @@ static lv_obj_t * notice_h;
|
||||
*/
|
||||
void lv_app_notice_init(void)
|
||||
{
|
||||
lv_app_style_t * app_style = lv_app_style_get();
|
||||
|
||||
notice_h = lv_rect_create(lv_scr_act(), NULL);
|
||||
lv_obj_set_size(notice_h, LV_HOR_RES, LV_VER_RES - app_style->menu_h);
|
||||
lv_obj_set_y(notice_h, app_style->menu_h);
|
||||
notice_h = lv_cont_create(lv_scr_act(), NULL);
|
||||
lv_obj_set_size(notice_h, LV_HOR_RES, LV_VER_RES - LV_DPI / 8);
|
||||
lv_obj_set_y(notice_h, LV_DPI / 8);
|
||||
lv_obj_set_click(notice_h, false);
|
||||
lv_obj_set_style(notice_h, lv_rects_get(LV_RECTS_TRANSP, NULL));
|
||||
lv_rect_set_layout(notice_h, LV_RECT_LAYOUT_COL_R);
|
||||
lv_obj_set_style(notice_h, lv_style_get(LV_STYLE_TRANSP, NULL));
|
||||
lv_cont_set_layout(notice_h, LV_CONT_LAYOUT_COL_R);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,19 +66,23 @@ lv_obj_t * lv_app_notice_add(const char * format, ...)
|
||||
vsprintf(txt,format, va);
|
||||
va_end(va);
|
||||
|
||||
lv_app_style_t * app_style = lv_app_style_get();
|
||||
|
||||
lv_obj_t * mbox;
|
||||
mbox = lv_mbox_create(notice_h, NULL);
|
||||
lv_obj_set_style(mbox, lv_mboxs_get(LV_MBOXS_INFO, NULL));
|
||||
lv_mbox_set_title(mbox, "");
|
||||
lv_mbox_set_text(mbox, txt);
|
||||
lv_obj_set_opa(mbox, app_style->menu_opa);
|
||||
lv_mbox_set_anim_close_time(mbox, LV_APP_NOTICE_CLOSE_ANIM_TIME);
|
||||
|
||||
#if LV_APP_NOTICE_SHOW_TIME != 0
|
||||
lv_mbox_start_auto_close(mbox, LV_APP_NOTICE_SHOW_TIME);
|
||||
#endif
|
||||
|
||||
/*Delete the last children if there are too many*/
|
||||
uint32_t child_num = lv_obj_get_child_num(notice_h);
|
||||
if(child_num > LV_APP_NOTICE_MAX_NUM) {
|
||||
lv_obj_t * last_child = ll_get_tail(¬ice_h->child_ll);
|
||||
lv_obj_del(last_child);
|
||||
}
|
||||
|
||||
/*make sure the notices are on the top*/
|
||||
lv_obj_set_parent(notice_h, lv_scr_act());
|
||||
|
||||
return mbox;
|
||||
|
||||
@@ -11,11 +11,28 @@
|
||||
*********************/
|
||||
#include "../lv_app.h"
|
||||
#include <stdarg.h>
|
||||
#if LV_APP_ENABLE != 0
|
||||
#if USE_LV_APP_NOTICE != 0
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
/*Add the required configurations*/
|
||||
#ifndef LV_APP_NOTICE_SHOW_TIME
|
||||
#define LV_APP_NOTICE_SHOW_TIME 4000
|
||||
#endif
|
||||
|
||||
#ifndef LV_APP_NOTICE_CLOSE_ANIM_TIME
|
||||
#define LV_APP_NOTICE_CLOSE_ANIM_TIME 300
|
||||
#endif
|
||||
|
||||
#ifndef LV_APP_NOTICE_MAX_NUM
|
||||
#define LV_APP_NOTICE_MAX_NUM 6
|
||||
#endif
|
||||
|
||||
#ifndef LV_APP_NOTICE_MAX_LEN
|
||||
#define LV_APP_NOTICE_MAX_LEN 256
|
||||
#endif
|
||||
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
|
||||
@@ -143,11 +143,9 @@ static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec,
|
||||
static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc)
|
||||
{
|
||||
my_sc_data_t * sc_data = app->sc_data;
|
||||
lv_app_style_t * app_style = lv_app_style_get();
|
||||
|
||||
sc_data->label = lv_label_create(sc, NULL);
|
||||
lv_label_set_text(sc_data->label, "Empty");
|
||||
lv_obj_set_style(sc_data->label, &app_style->sc_txt_style);
|
||||
lv_obj_align(sc_data->label, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
}
|
||||
|
||||
@@ -200,7 +198,7 @@ static void my_win_close(lv_app_inst_t * app)
|
||||
static lv_action_res_t ta_rel_action(lv_obj_t * ta, lv_dispi_t * dispi)
|
||||
{
|
||||
lv_ta_set_text(ta, ""); /*Clear the ta*/
|
||||
lv_app_kb_open(ta, LV_APP_KB_MODE_TXT, NULL, kb_ok_action);
|
||||
lv_app_kb_open(ta, LV_APP_KB_MODE_TXT | LV_APP_KB_MODE_WIN_RESIZE, NULL, kb_ok_action);
|
||||
return LV_ACTION_RES_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
lv_obj_t * file_list;
|
||||
lv_obj_t * send_set_h;
|
||||
}my_win_data_t;
|
||||
|
||||
/*Application specific data for a shortcut of this application*/
|
||||
@@ -73,6 +72,7 @@ static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc);
|
||||
static void my_sc_close(lv_app_inst_t * app);
|
||||
static void my_win_open(lv_app_inst_t * app, lv_obj_t * win);
|
||||
static void my_win_close(lv_app_inst_t * app);
|
||||
static void my_conf_open(lv_app_inst_t * app, lv_obj_t * conf_win);
|
||||
|
||||
static void win_load_file_list(lv_app_inst_t * app);
|
||||
static void win_create_list(lv_app_inst_t * app);
|
||||
@@ -83,7 +83,6 @@ static lv_action_res_t win_drv_action(lv_obj_t * drv, lv_dispi_t * dispi);
|
||||
static lv_action_res_t win_folder_action(lv_obj_t * folder, lv_dispi_t * dispi);
|
||||
static lv_action_res_t win_file_action(lv_obj_t * file, lv_dispi_t * dispi);
|
||||
static lv_action_res_t win_send_rel_action(lv_obj_t * send, lv_dispi_t * dispi);
|
||||
static lv_action_res_t win_send_lpr_action(lv_obj_t * send, lv_dispi_t * dispi);
|
||||
static lv_action_res_t win_send_settings_element_rel_action(lv_obj_t * element, lv_dispi_t * dispi);
|
||||
static lv_action_res_t win_back_action(lv_obj_t * back, lv_dispi_t * dispi);
|
||||
static lv_action_res_t win_del_rel_action(lv_obj_t * del, lv_dispi_t * dispi);
|
||||
@@ -107,12 +106,14 @@ static lv_app_dsc_t my_app_dsc =
|
||||
.win_close = my_win_close,
|
||||
.sc_open = my_sc_open,
|
||||
.sc_close = my_sc_close,
|
||||
.conf_open = my_conf_open,
|
||||
.app_data_size = sizeof(my_app_data_t),
|
||||
.sc_data_size = sizeof(my_sc_data_t),
|
||||
.win_data_size = sizeof(my_win_data_t),
|
||||
};
|
||||
|
||||
static lv_labels_t sc_labels;
|
||||
static lv_style_t style_sc_label;
|
||||
static lv_style_t style_btn_symbol;
|
||||
|
||||
|
||||
/**********************
|
||||
@@ -130,10 +131,11 @@ static lv_labels_t sc_labels;
|
||||
const lv_app_dsc_t * lv_app_files_init(void)
|
||||
{
|
||||
lv_app_style_t * app_style = lv_app_style_get();
|
||||
memcpy(&sc_labels, &app_style->sc_txt_style, sizeof(lv_labels_t));
|
||||
sc_labels.font = LV_APP_FONT_LARGE;
|
||||
|
||||
memcpy(&style_sc_label, &app_style->sc_rec_rel, sizeof(lv_style_t));
|
||||
style_sc_label.font = font_get(LV_APP_FONT_LARGE);
|
||||
|
||||
lv_style_get(LV_STYLE_BTN_REL, &style_btn_symbol);
|
||||
style_btn_symbol.font = font_get(LV_IMG_DEF_SYMBOL_FONT);
|
||||
return &my_app_dsc;
|
||||
}
|
||||
|
||||
@@ -219,7 +221,7 @@ static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc)
|
||||
|
||||
|
||||
sc_data->label = lv_label_create(sc, NULL);
|
||||
lv_obj_set_style(sc_data->label, &sc_labels);
|
||||
lv_obj_set_style(sc_data->label, &style_sc_label);
|
||||
lv_label_set_text(sc_data->label, fs_get_last(app_data->path));
|
||||
lv_obj_align(sc_data->label, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
}
|
||||
@@ -247,7 +249,6 @@ static void my_win_open(lv_app_inst_t * app, lv_obj_t * win)
|
||||
|
||||
app_data->file_cnt = 0;
|
||||
win_data->file_list = NULL;
|
||||
win_data->send_set_h = NULL;
|
||||
|
||||
lv_win_set_title(win, app_data->path);
|
||||
|
||||
@@ -263,6 +264,76 @@ static void my_win_close(lv_app_inst_t * app)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create objects to configure the applications
|
||||
* @param app pointer to an application which settings should be created
|
||||
* @param conf_win pointer to a window where the objects can be created
|
||||
* (the window has the proper layout)
|
||||
*/
|
||||
static void my_conf_open(lv_app_inst_t * app, lv_obj_t * conf_win)
|
||||
{
|
||||
my_app_data_t * app_data = app->app_data;
|
||||
|
||||
/*Create check boxes*/
|
||||
lv_obj_t * cb;
|
||||
|
||||
/*Send file name check box*/
|
||||
cb = lv_cb_create(conf_win, NULL);
|
||||
lv_cb_set_text(cb, "Send file name");
|
||||
lv_obj_set_free_num(cb, SEND_SETTINGS_FN);
|
||||
lv_obj_set_free_p(cb, app);
|
||||
lv_btn_set_rel_action(cb, win_send_settings_element_rel_action);
|
||||
if(app_data->send_fn != 0) lv_btn_set_state(cb, LV_BTN_STATE_TREL);
|
||||
else lv_btn_set_state(cb, LV_BTN_STATE_REL);
|
||||
|
||||
/*Send size check box*/
|
||||
cb = lv_cb_create(conf_win, cb);
|
||||
lv_cb_set_text(cb, "Send size");
|
||||
lv_obj_set_free_num(cb, SEND_SETTINGS_SIZE);
|
||||
if(app_data->send_size != 0) lv_btn_set_state(cb, LV_BTN_STATE_TREL);
|
||||
else lv_btn_set_state(cb, LV_BTN_STATE_REL);
|
||||
|
||||
/*Send CRC check box*/
|
||||
cb = lv_cb_create(conf_win, cb);
|
||||
lv_cb_set_text(cb, "Send CRC");
|
||||
lv_obj_set_free_num(cb, SEND_SETTINGS_CRC);
|
||||
if(app_data->send_crc != 0) lv_btn_set_state(cb, LV_BTN_STATE_TREL);
|
||||
else lv_btn_set_state(cb, LV_BTN_STATE_REL);
|
||||
|
||||
/*Create a text area to type chunk size*/
|
||||
lv_obj_t * val_set_h;
|
||||
val_set_h = lv_cont_create(conf_win, NULL);
|
||||
lv_obj_set_style(val_set_h, lv_style_get(LV_STYLE_PLAIN_COLOR, NULL));
|
||||
lv_obj_set_click(val_set_h, false);
|
||||
lv_cont_set_fit(val_set_h, true, true);
|
||||
lv_cont_set_layout(val_set_h, LV_CONT_LAYOUT_ROW_M);
|
||||
|
||||
lv_obj_t * label;
|
||||
label = lv_label_create(val_set_h, NULL);
|
||||
lv_label_set_text(label, "Chunk size");
|
||||
|
||||
lv_obj_t * ta;
|
||||
char buf[32];
|
||||
ta = lv_ta_create(val_set_h, NULL);
|
||||
lv_cont_set_fit(ta, false, true);
|
||||
lv_obj_set_free_num(ta, SEND_SETTINGS_CHUNK_SIZE);
|
||||
lv_obj_set_free_p(ta, app);
|
||||
lv_page_set_rel_action(ta, win_send_settings_element_rel_action);
|
||||
sprintf(buf, "%d", app_data->chunk_size);
|
||||
lv_ta_set_text(ta, buf);
|
||||
|
||||
/*Create a text area to type the chunk delay*/
|
||||
val_set_h = lv_cont_create(conf_win, val_set_h);
|
||||
|
||||
label = lv_label_create(val_set_h, NULL);
|
||||
lv_label_set_text(label, "Inter-chunk delay");
|
||||
|
||||
ta = lv_ta_create(val_set_h, ta);
|
||||
lv_obj_set_free_num(ta, SEND_SETTINGS_CHUNK_DELAY);
|
||||
sprintf(buf, "%d", app_data->chunk_delay);
|
||||
lv_ta_set_text(ta, buf);
|
||||
}
|
||||
|
||||
/*--------------------
|
||||
* OTHER FUNCTIONS
|
||||
---------------------*/
|
||||
@@ -272,7 +343,6 @@ static void my_win_close(lv_app_inst_t * app)
|
||||
*/
|
||||
static void win_create_list(lv_app_inst_t * app)
|
||||
{
|
||||
lv_app_style_t * app_style = lv_app_style_get();
|
||||
my_win_data_t * win_data = app->win_data;
|
||||
|
||||
/*Delete the previous list*/
|
||||
@@ -282,12 +352,13 @@ static void win_create_list(lv_app_inst_t * app)
|
||||
|
||||
/*Create a new list*/
|
||||
win_data->file_list = lv_list_create(app->win, NULL);
|
||||
lv_obj_set_width(win_data->file_list, app_style->win_useful_w);
|
||||
lv_obj_set_style(win_data->file_list, lv_lists_get(LV_LISTS_TRANSP, NULL));
|
||||
lv_obj_set_width(win_data->file_list, lv_win_get_width(app->win));
|
||||
lv_list_set_style_img(win_data->file_list, &style_btn_symbol);
|
||||
lv_obj_set_style(lv_page_get_scrl(win_data->file_list), lv_style_get(LV_STYLE_TRANSP_TIGHT, NULL));
|
||||
lv_obj_set_drag_parent(win_data->file_list, true);
|
||||
lv_obj_set_drag_parent(lv_page_get_scrl(win_data->file_list), true);
|
||||
lv_rect_set_fit(win_data->file_list, false, true);
|
||||
lv_rect_set_layout(lv_page_get_scrl(win_data->file_list), LV_RECT_LAYOUT_COL_L);
|
||||
lv_cont_set_fit(win_data->file_list, false, true);
|
||||
lv_cont_set_layout(lv_page_get_scrl(win_data->file_list), LV_CONT_LAYOUT_COL_L);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -314,13 +385,13 @@ static void win_load_file_list(lv_app_inst_t * app)
|
||||
for(i = 0; drv[i] != '\0'; i++) {
|
||||
buf[0] = drv[i];
|
||||
buf[1] = '\0';
|
||||
liste = lv_list_add(win_data->file_list, "U:/icon_driver", buf, win_drv_action);
|
||||
liste = lv_list_add(win_data->file_list, SYMBOL_DRIVE, buf, win_drv_action);
|
||||
lv_obj_set_free_p(liste, app);
|
||||
}
|
||||
}
|
||||
/*List the files/folders with fs interface*/
|
||||
else {
|
||||
liste = lv_list_add(win_data->file_list, "U:/icon_up", "Up", win_up_action);
|
||||
liste = lv_list_add(win_data->file_list, SYMBOL_UP, "Up", win_up_action);
|
||||
lv_obj_set_free_p(liste, app);
|
||||
|
||||
fs_readdir_t rd;
|
||||
@@ -332,7 +403,7 @@ static void win_load_file_list(lv_app_inst_t * app)
|
||||
|
||||
/*At not first page add prev. page button */
|
||||
if(app_data->file_cnt != 0) {
|
||||
liste = lv_list_add(win_data->file_list, "U:/icon_left", "Previous page", win_prev_action);
|
||||
liste = lv_list_add(win_data->file_list, SYMBOL_LEFT, "Previous page", win_prev_action);
|
||||
lv_obj_set_free_p(liste, app);
|
||||
}
|
||||
|
||||
@@ -342,7 +413,7 @@ static void win_load_file_list(lv_app_inst_t * app)
|
||||
uint16_t file_cnt = 0;
|
||||
while(file_cnt <= app_data->file_cnt) {
|
||||
res = fs_readdir(&rd, fn);
|
||||
if(res != FS_RES_OK || fn[0] == '\0'){
|
||||
if(res != FS_RES_OK ){
|
||||
lv_app_notice_add("Can not read\nthe path in Files");
|
||||
return;
|
||||
}
|
||||
@@ -353,13 +424,13 @@ static void win_load_file_list(lv_app_inst_t * app)
|
||||
while(res == FS_RES_OK && fn[0] != '\0') {
|
||||
if(fn[0] == '/') { /*Add a folder*/
|
||||
lv_obj_t * liste;
|
||||
liste = lv_list_add(win_data->file_list, "U:/icon_folder", &fn[1], win_folder_action);
|
||||
liste = lv_list_add(win_data->file_list, SYMBOL_FOLDER, &fn[1], win_folder_action);
|
||||
lv_obj_set_free_p(liste, app);
|
||||
app_data->file_cnt ++;
|
||||
}
|
||||
/*Add a file*/
|
||||
else {
|
||||
liste = lv_list_add(win_data->file_list, "U:/icon_file", fn, win_file_action);
|
||||
liste = lv_list_add(win_data->file_list, SYMBOL_FILE, fn, win_file_action);
|
||||
lv_obj_set_free_p(liste, app);
|
||||
app_data->file_cnt ++;
|
||||
}
|
||||
@@ -369,7 +440,7 @@ static void win_load_file_list(lv_app_inst_t * app)
|
||||
|
||||
/*Show only LV_APP_FSEL_MAX_FILE elements and add a Next page button*/
|
||||
if(app_data->file_cnt != 0 && app_data->file_cnt % LV_APP_FILES_PAGE_SIZE == 0) {
|
||||
liste = lv_list_add(win_data->file_list, "U:/icon_right", "Next page", win_next_action);
|
||||
liste = lv_list_add(win_data->file_list, SYMBOL_RIGHT, "Next page", win_next_action);
|
||||
lv_obj_set_free_p(liste, app);
|
||||
break;
|
||||
}
|
||||
@@ -458,7 +529,7 @@ static lv_action_res_t win_drv_action(lv_obj_t * drv, lv_dispi_t * dispi)
|
||||
{
|
||||
lv_app_inst_t * app = lv_obj_get_free_p(drv);
|
||||
my_app_data_t * app_data = app->app_data;
|
||||
sprintf(app_data->path, "%s:", lv_list_element_get_txt(drv));
|
||||
sprintf(app_data->path, "%s:", lv_list_get_element_text(drv));
|
||||
app_data->file_cnt = 0;
|
||||
lv_win_set_title(app->win, app_data->path);
|
||||
my_sc_data_t * sc_data = app->sc_data;
|
||||
@@ -482,7 +553,7 @@ static lv_action_res_t win_folder_action(lv_obj_t * folder, lv_dispi_t * dispi)
|
||||
{
|
||||
lv_app_inst_t * app = lv_obj_get_free_p(folder);
|
||||
my_app_data_t * app_data = app->app_data;
|
||||
sprintf(app_data->path, "%s/%s", app_data->path, lv_list_element_get_txt(folder));
|
||||
sprintf(app_data->path, "%s/%s", app_data->path, lv_list_get_element_text(folder));
|
||||
app_data->file_cnt = 0;
|
||||
|
||||
lv_win_set_title(app->win, app_data->path);
|
||||
@@ -510,7 +581,7 @@ static lv_action_res_t win_file_action(lv_obj_t * file, lv_dispi_t * dispi)
|
||||
my_app_data_t * app_data = app->app_data;
|
||||
my_win_data_t * win_data = app->win_data;
|
||||
|
||||
sprintf(app_data->fn, "%s", lv_list_element_get_txt(file));
|
||||
sprintf(app_data->fn, "%s", lv_list_get_element_text(file));
|
||||
|
||||
win_create_list(app);
|
||||
|
||||
@@ -522,8 +593,6 @@ static lv_action_res_t win_file_action(lv_obj_t * file, lv_dispi_t * dispi)
|
||||
/*Send button*/
|
||||
liste = lv_list_add(win_data->file_list, NULL, "Send", win_send_rel_action);
|
||||
lv_obj_set_free_p(liste, app);
|
||||
lv_btn_set_lpr_action(liste, win_send_lpr_action);
|
||||
lv_obj_set_free_p(liste, app);
|
||||
|
||||
/*Delete button*/
|
||||
liste = lv_list_add(win_data->file_list, NULL, "Delete", win_del_rel_action);
|
||||
@@ -573,100 +642,6 @@ static lv_action_res_t win_send_rel_action(lv_obj_t * send, lv_dispi_t * dispi)
|
||||
return LV_ACTION_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the Send list element is long pressed to show/hide send settings
|
||||
* @param send pointer to the Up button
|
||||
* @param dispi pointer to the caller display input
|
||||
* @return LV_ACTION_RES_OK because the list is NOT deleted in the function
|
||||
*/
|
||||
static lv_action_res_t win_send_lpr_action(lv_obj_t * send, lv_dispi_t * dispi)
|
||||
{
|
||||
lv_app_inst_t * app = lv_obj_get_free_p(send);
|
||||
my_app_data_t * app_data = app->app_data;
|
||||
my_win_data_t * win_data = app->win_data;
|
||||
|
||||
/*Close the settings if it is opened*/
|
||||
if(win_data->send_set_h != NULL) {
|
||||
lv_obj_del(win_data->send_set_h);
|
||||
win_data->send_set_h = NULL;
|
||||
lv_dispi_wait_release(dispi);
|
||||
lv_btn_set_state(send, LV_BTN_STATE_REL);
|
||||
return LV_ACTION_RES_OK;
|
||||
}
|
||||
|
||||
/*Create the settings*/
|
||||
lv_btn_set_state(send, LV_BTN_STATE_REL);
|
||||
lv_rect_set_layout(send, LV_RECT_LAYOUT_COL_L);
|
||||
|
||||
/*Create holder for the settings*/
|
||||
win_data->send_set_h = lv_rect_create(send, NULL);
|
||||
lv_obj_set_style(win_data->send_set_h, lv_rects_get(LV_RECTS_TRANSP, NULL));
|
||||
lv_obj_set_click(win_data->send_set_h, false);
|
||||
lv_rect_set_fit(win_data->send_set_h, true, true);
|
||||
lv_rect_set_layout(win_data->send_set_h, LV_RECT_LAYOUT_COL_L);
|
||||
|
||||
/*Create check boxes*/
|
||||
lv_obj_t * cb;
|
||||
|
||||
/*Send file name check box*/
|
||||
cb = lv_cb_create(win_data->send_set_h, NULL);
|
||||
lv_cb_set_text(cb, "Send file name");
|
||||
lv_obj_set_free_num(cb, SEND_SETTINGS_FN);
|
||||
lv_obj_set_free_p(cb, app);
|
||||
lv_btn_set_rel_action(cb, win_send_settings_element_rel_action);
|
||||
if(app_data->send_fn != 0) lv_btn_set_state(cb, LV_BTN_STATE_TGL_REL);
|
||||
else lv_btn_set_state(cb, LV_BTN_STATE_REL);
|
||||
|
||||
/*Send size check box*/
|
||||
cb = lv_cb_create(win_data->send_set_h, cb);
|
||||
lv_cb_set_text(cb, "Send size");
|
||||
lv_obj_set_free_num(cb, SEND_SETTINGS_SIZE);
|
||||
if(app_data->send_size != 0) lv_btn_set_state(cb, LV_BTN_STATE_TGL_REL);
|
||||
else lv_btn_set_state(cb, LV_BTN_STATE_REL);
|
||||
|
||||
/*Send CRC check box*/
|
||||
cb = lv_cb_create(win_data->send_set_h, cb);
|
||||
lv_cb_set_text(cb, "Send CRC");
|
||||
lv_obj_set_free_num(cb, SEND_SETTINGS_CRC);
|
||||
if(app_data->send_crc != 0) lv_btn_set_state(cb, LV_BTN_STATE_TGL_REL);
|
||||
else lv_btn_set_state(cb, LV_BTN_STATE_REL);
|
||||
|
||||
/*Create a text area the type chunk size*/
|
||||
lv_obj_t * val_set_h;
|
||||
val_set_h = lv_rect_create(win_data->send_set_h, NULL);
|
||||
lv_obj_set_style(val_set_h, lv_rects_get(LV_RECTS_TRANSP, NULL));
|
||||
lv_obj_set_click(val_set_h, false);
|
||||
lv_rect_set_fit(val_set_h, true, true);
|
||||
lv_rect_set_layout(val_set_h, LV_RECT_LAYOUT_ROW_M);
|
||||
|
||||
lv_obj_t * label;
|
||||
label = lv_label_create(val_set_h, NULL);
|
||||
lv_label_set_text(label, "Chunk size");
|
||||
|
||||
lv_obj_t * ta;
|
||||
char buf[32];
|
||||
ta = lv_ta_create(val_set_h, NULL);
|
||||
lv_obj_set_style(ta, lv_tas_get(LV_TAS_SIMPLE, NULL));
|
||||
lv_rect_set_fit(ta, false, true);
|
||||
lv_obj_set_free_num(ta, SEND_SETTINGS_CHUNK_SIZE);
|
||||
lv_obj_set_free_p(ta, app);
|
||||
lv_page_set_rel_action(ta, win_send_settings_element_rel_action);
|
||||
sprintf(buf, "%d", app_data->chunk_size);
|
||||
lv_ta_set_text(ta, buf);
|
||||
|
||||
/*Create a text area to type the chunk delay*/
|
||||
val_set_h = lv_rect_create(win_data->send_set_h, val_set_h);
|
||||
|
||||
label = lv_label_create(val_set_h, NULL);
|
||||
lv_label_set_text(label, "Inter-chunk delay");
|
||||
|
||||
ta = lv_ta_create(val_set_h, ta);
|
||||
lv_obj_set_free_num(ta, SEND_SETTINGS_CHUNK_DELAY);
|
||||
sprintf(buf, "%d", app_data->chunk_delay);
|
||||
lv_ta_set_text(ta, buf);
|
||||
|
||||
return LV_ACTION_RES_OK;
|
||||
}
|
||||
/**
|
||||
* Called when a send settings element is released
|
||||
* @param element pointer to a chekbox or text area
|
||||
@@ -691,9 +666,9 @@ static lv_action_res_t win_send_settings_element_rel_action(lv_obj_t * element,
|
||||
lv_app_notice_add("CRC sending is\nnot supported yet");
|
||||
}
|
||||
} else if(id == SEND_SETTINGS_CHUNK_SIZE) {
|
||||
lv_app_kb_open(element, LV_APP_KB_MODE_NUM, send_settings_kb_close_action, send_settings_kb_ok_action);
|
||||
lv_app_kb_open(element, LV_APP_KB_MODE_NUM | LV_APP_KB_MODE_WIN_RESIZE, send_settings_kb_close_action, send_settings_kb_ok_action);
|
||||
} else if(id == SEND_SETTINGS_CHUNK_DELAY) {
|
||||
lv_app_kb_open(element, LV_APP_KB_MODE_NUM, send_settings_kb_close_action, send_settings_kb_ok_action);
|
||||
lv_app_kb_open(element, LV_APP_KB_MODE_NUM | LV_APP_KB_MODE_WIN_RESIZE, send_settings_kb_close_action, send_settings_kb_ok_action);
|
||||
}
|
||||
|
||||
return LV_ACTION_RES_OK;
|
||||
@@ -795,41 +770,33 @@ static void start_send(lv_app_inst_t * app, const char * path)
|
||||
/*Open the file*/
|
||||
fs_res_t res = fs_open(&app_data->file, path, FS_MODE_RD);
|
||||
if(res == FS_RES_OK) {
|
||||
uint32_t rn;
|
||||
char rd_buf[LV_APP_FILES_CHUNK_MAX_SIZE];
|
||||
|
||||
/*Read the first chunk*/
|
||||
res = fs_read(&app_data->file, rd_buf, app_data->chunk_size, &rn);
|
||||
if(res == FS_RES_OK) {
|
||||
app_data->send_in_prog = 1;
|
||||
|
||||
/*Send the header*/
|
||||
if(app_data->send_fn != 0) {
|
||||
lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, app_data->path, strlen(app_data->path));
|
||||
lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, "/", 1);
|
||||
lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, app_data->fn, strlen(app_data->fn));
|
||||
lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, "\n", 1);
|
||||
}
|
||||
|
||||
if(app_data->send_size != 0) {
|
||||
char buf[64];
|
||||
uint32_t size;
|
||||
fs_size(&app_data->file, &size);
|
||||
sprintf(buf,"%d", (int) size);
|
||||
lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, buf, strlen(buf));
|
||||
lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, "\n", 1);
|
||||
}
|
||||
if(app_data->send_crc != 0) {
|
||||
lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, "0x0000", 6);
|
||||
lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, "\n", 1);
|
||||
}
|
||||
|
||||
/*Add an extra \n to separate the header from the file data*/
|
||||
if(app_data->send_fn != 0 || app_data->send_size != 0 || app_data->send_crc != 0) {
|
||||
lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, "\n", 1);
|
||||
}
|
||||
app_data->send_in_prog = 1;
|
||||
|
||||
/*Send the header*/
|
||||
if(app_data->send_fn != 0) {
|
||||
lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, app_data->path, strlen(app_data->path));
|
||||
lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, "/", 1);
|
||||
lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, app_data->fn, strlen(app_data->fn));
|
||||
lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, "\n", 1);
|
||||
}
|
||||
|
||||
if(app_data->send_size != 0) {
|
||||
char buf[64];
|
||||
uint32_t size;
|
||||
fs_size(&app_data->file, &size);
|
||||
sprintf(buf,"%d", (int) size);
|
||||
lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, buf, strlen(buf));
|
||||
lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, "\n", 1);
|
||||
}
|
||||
if(app_data->send_crc != 0) {
|
||||
lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, "0x0000", 6);
|
||||
lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, "\n", 1);
|
||||
}
|
||||
|
||||
/*Add an extra \n to separate the header from the file data*/
|
||||
if(app_data->send_fn != 0 || app_data->send_size != 0 || app_data->send_crc != 0) {
|
||||
lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, "\n", 1);
|
||||
}
|
||||
}
|
||||
|
||||
/*If an error occurred close the file*/
|
||||
|
||||
143
lv_appx/lv_app_phantom.c
Normal file
143
lv_appx/lv_app_phantom.c
Normal file
@@ -0,0 +1,143 @@
|
||||
/**
|
||||
* @file lv_app_example.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_app_phantom.h"
|
||||
#if LV_APP_ENABLE != 0 && USE_LV_APP_PHANTOM != 0
|
||||
|
||||
#include "../lv_app/lv_app_util/lv_app_kb.h"
|
||||
#include <stdio.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/*Application specific data for an instance of this application*/
|
||||
typedef struct
|
||||
{
|
||||
void (*com_listen)(lv_app_inst_t * app_send, lv_app_inst_t * app_rec,
|
||||
lv_app_com_type_t type , const void * data, uint32_t size);
|
||||
}my_app_data_t;
|
||||
|
||||
/*Application specific data a window of this application*/
|
||||
typedef struct
|
||||
{
|
||||
|
||||
}my_win_data_t;
|
||||
|
||||
/*Application specific data for a shortcut of this application*/
|
||||
typedef struct
|
||||
{
|
||||
lv_obj_t * label;
|
||||
}my_sc_data_t;
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void my_app_run(lv_app_inst_t * app, void * conf);
|
||||
static void my_app_close(lv_app_inst_t * app);
|
||||
static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec,
|
||||
lv_app_com_type_t type , const void * data, uint32_t size);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_app_dsc_t my_app_dsc =
|
||||
{
|
||||
.name = "Phantom",
|
||||
.mode = LV_APP_MODE_NONE,
|
||||
.app_run = my_app_run,
|
||||
.app_close = my_app_close,
|
||||
.com_rec = my_com_rec,
|
||||
.win_open = NULL,
|
||||
.win_close = NULL,
|
||||
.sc_open = NULL,
|
||||
.sc_close = NULL,
|
||||
.app_data_size = sizeof(my_app_data_t),
|
||||
.sc_data_size = sizeof(my_sc_data_t),
|
||||
.win_data_size = sizeof(my_win_data_t),
|
||||
};
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize the application
|
||||
* @return pointer to the application descriptor of this application
|
||||
*/
|
||||
const lv_app_dsc_t * lv_app_phantom_init(void)
|
||||
{
|
||||
|
||||
return &my_app_dsc;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Run an application according to 'app_dsc'
|
||||
* @param app_dsc pointer to an application descriptor
|
||||
* @param conf pointer to a lv_app_phantom_conf_t structure with configuration data or NULL if unused
|
||||
* @return pointer to the opened application or NULL if any error occurred
|
||||
*/
|
||||
static void my_app_run(lv_app_inst_t * app, void * conf)
|
||||
{
|
||||
/*Initialize the application*/
|
||||
my_app_data_t * app_data = app->app_data;
|
||||
app_data->com_listen = NULL;
|
||||
|
||||
if(conf != NULL) {
|
||||
lv_app_phantom_conf_t * my_conf = conf;
|
||||
app_data->com_listen = my_conf->com_listen;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Close a running application.
|
||||
* Close the Window and the Shortcut too if opened.
|
||||
* Free all the allocated memory by this application.
|
||||
* @param app pointer to an application
|
||||
*/
|
||||
static void my_app_close(lv_app_inst_t * app)
|
||||
{
|
||||
/*No dynamically allocated data in 'my_app_data'*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the data have been sent to this application
|
||||
* @param app_send pointer to an application which sent the message
|
||||
* @param app_rec pointer to an application which is receiving the message
|
||||
* @param type type of data from 'lv_app_com_type_t' enum
|
||||
* @param data pointer to the sent data
|
||||
* @param size length of 'data' in bytes
|
||||
*/
|
||||
static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec,
|
||||
lv_app_com_type_t type , const void * data, uint32_t size)
|
||||
{
|
||||
|
||||
my_app_data_t * app_data = app_rec->app_data;
|
||||
|
||||
if(app_data->com_listen != NULL) {
|
||||
app_data->com_listen(app_send, app_rec, type, data, size);
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------
|
||||
* OTHER FUNCTIONS
|
||||
---------------------*/
|
||||
|
||||
#endif /*LV_APP_ENABLE != 0 && USE_LV_APP_EXAMPLE != 0*/
|
||||
42
lv_appx/lv_app_phantom.h
Normal file
42
lv_appx/lv_app_phantom.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* @file lv_app_phantom.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_APP_PHANTOM_H
|
||||
#define LV_APP_PHANTOM_H
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lvgl/lv_app/lv_app.h"
|
||||
|
||||
#if LV_APP_ENABLE != 0 && USE_LV_APP_PHANTOM != 0
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef struct
|
||||
{
|
||||
void (*com_listen)(lv_app_inst_t * app_send,
|
||||
lv_app_inst_t * app_rec,
|
||||
lv_app_com_type_t type ,
|
||||
const void * data, uint32_t size);
|
||||
}lv_app_phantom_conf_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
const lv_app_dsc_t * lv_app_phantom_init(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_APP_ENABLE != 0 && USE_LV_APP_PHANTOM != 0*/
|
||||
|
||||
#endif /* LV_APP_PHANTOM_H */
|
||||
@@ -20,7 +20,7 @@
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define CPU_LABEL_COLOR "FF0000"
|
||||
#define MEM_LABEL_COLOR "008000"
|
||||
#define MEM_LABEL_COLOR "0000FF"
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@@ -36,16 +36,16 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
lv_obj_t * chart;
|
||||
cord_t * cpu_dl;
|
||||
cord_t * mem_dl;
|
||||
lv_chart_dl_t * cpu_dl;
|
||||
lv_chart_dl_t * mem_dl;
|
||||
lv_obj_t * label;
|
||||
}my_win_data_t;
|
||||
|
||||
/*Application specific data for a shortcut of this application*/
|
||||
typedef struct
|
||||
{
|
||||
lv_obj_t * pb_cpu;
|
||||
lv_obj_t * pb_mem;
|
||||
lv_obj_t * bar_cpu;
|
||||
lv_obj_t * bar_mem;
|
||||
}my_sc_data_t;
|
||||
|
||||
/**********************
|
||||
@@ -83,8 +83,10 @@ static lv_app_dsc_t my_app_dsc =
|
||||
|
||||
static uint8_t mem_pct[LV_APP_SYSMON_PNUM];
|
||||
static uint8_t cpu_pct[LV_APP_SYSMON_PNUM];
|
||||
static lv_pbs_t cpu_pbs;
|
||||
static lv_pbs_t mem_pbs;
|
||||
static lv_style_t cpu_bar_bg;
|
||||
static lv_style_t mem_bar_bg;
|
||||
static lv_style_t cpu_bar_indic;
|
||||
static lv_style_t mem_bar_indic;
|
||||
#if USE_DYN_MEM != 0 && DM_CUSTOM == 0
|
||||
static dm_mon_t mem_mon;
|
||||
#endif
|
||||
@@ -108,31 +110,31 @@ const lv_app_dsc_t * lv_app_sysmon_init(void)
|
||||
memset(mem_pct, 0, sizeof(mem_pct));
|
||||
memset(cpu_pct, 0, sizeof(cpu_pct));
|
||||
|
||||
/*Create progress bar styles for the shortcut*/
|
||||
lv_pbs_get(LV_PBS_DEF, &cpu_pbs);
|
||||
cpu_pbs.bg.gcolor = COLOR_MAKE(0xFF, 0xE0, 0xE0);
|
||||
cpu_pbs.bg.objs.color = COLOR_MAKE(0xFF, 0xD0, 0xD0);
|
||||
cpu_pbs.bg.bcolor = COLOR_MAKE(0xFF, 0x20, 0x20);
|
||||
cpu_pbs.bg.bwidth = 1 * LV_DOWNSCALE;
|
||||
/*Create bar styles for the shortcut*/
|
||||
lv_style_get(LV_STYLE_PRETTY, &cpu_bar_bg);
|
||||
cpu_bar_bg.ccolor = COLOR_MAKE(0x40, 0x00, 0x00);
|
||||
cpu_bar_bg.font = font_get(LV_APP_FONT_MEDIUM);
|
||||
cpu_bar_bg.line_space = 0;
|
||||
cpu_bar_bg.txt_align = 1;
|
||||
cpu_bar_bg.hpad = 0;
|
||||
cpu_bar_bg.vpad = 0;
|
||||
|
||||
cpu_pbs.bar.gcolor = COLOR_MARRON;
|
||||
cpu_pbs.bar.objs.color = COLOR_RED;
|
||||
cpu_pbs.bar.bwidth = 0;
|
||||
memcpy(&mem_bar_bg, &cpu_bar_bg, sizeof(lv_style_t));
|
||||
mem_bar_bg.ccolor = COLOR_MAKE(0x00, 0x40, 0x00);
|
||||
|
||||
cpu_pbs.label.objs.color = COLOR_MAKE(0x40, 0x00, 0x00);
|
||||
cpu_pbs.label.font = LV_APP_FONT_MEDIUM;
|
||||
cpu_pbs.label.line_space = 0;
|
||||
cpu_pbs.label.mid = 1;
|
||||
lv_style_get(LV_STYLE_PRETTY_COLOR, &cpu_bar_indic);
|
||||
cpu_bar_indic.gcolor = COLOR_MARRON;
|
||||
cpu_bar_indic.mcolor = COLOR_RED;
|
||||
cpu_bar_indic.bcolor = COLOR_BLACK;
|
||||
//cpu_bar_indic.bwidth = 1 * LV_DOWNSCALE;
|
||||
cpu_bar_indic.bopa = OPA_50;
|
||||
cpu_bar_indic.hpad = 0 * LV_DOWNSCALE;
|
||||
cpu_bar_indic.vpad = 0 * LV_DOWNSCALE;
|
||||
|
||||
memcpy(&mem_pbs, &cpu_pbs, sizeof(mem_pbs));
|
||||
mem_pbs.bg.gcolor = COLOR_MAKE(0xD0, 0xFF, 0xD0);
|
||||
mem_pbs.bg.objs.color = COLOR_MAKE(0xE0, 0xFF, 0xE0);
|
||||
mem_pbs.bg.bcolor = COLOR_MAKE(0x20, 0xFF, 0x20);
|
||||
|
||||
mem_pbs.bar.gcolor = COLOR_GREEN;
|
||||
mem_pbs.bar.objs.color = COLOR_LIME;
|
||||
|
||||
mem_pbs.label.objs.color = COLOR_MAKE(0x00, 0x40, 0x00);
|
||||
memcpy(&mem_bar_indic, &cpu_bar_indic, sizeof(lv_style_t));
|
||||
mem_bar_indic.gcolor = COLOR_GREEN;
|
||||
mem_bar_indic.mcolor = COLOR_LIME;
|
||||
|
||||
return &my_app_dsc;
|
||||
}
|
||||
@@ -189,19 +191,25 @@ static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc)
|
||||
|
||||
cord_t w = lv_obj_get_width(sc) / 5;
|
||||
|
||||
/*Create 2 progress bars fr the CPU and the Memory*/
|
||||
sc_data->pb_cpu = lv_pb_create(sc, NULL);
|
||||
lv_obj_set_size(sc_data->pb_cpu, w, 5 * lv_obj_get_height(sc) / 8);
|
||||
lv_obj_align(sc_data->pb_cpu, NULL, LV_ALIGN_IN_BOTTOM_LEFT, w, - lv_obj_get_height(sc) / 8);
|
||||
lv_obj_set_style(sc_data->pb_cpu, &cpu_pbs);
|
||||
lv_obj_set_click(sc_data->pb_cpu, false);
|
||||
lv_pb_set_min_max_value(sc_data->pb_cpu, 0, 100);
|
||||
lv_pb_set_format_str(sc_data->pb_cpu, "C\nP\nU");
|
||||
/*Create 2 bars for the CPU and the Memory*/
|
||||
sc_data->bar_cpu = lv_bar_create(sc, NULL);
|
||||
lv_obj_set_size(sc_data->bar_cpu, w, 5 * lv_obj_get_height(sc) / 8);
|
||||
lv_obj_align(sc_data->bar_cpu, NULL, LV_ALIGN_IN_BOTTOM_LEFT, w, - lv_obj_get_height(sc) / 8);
|
||||
lv_obj_set_style(sc_data->bar_cpu, &cpu_bar_bg);
|
||||
lv_bar_set_style_indic(sc_data->bar_cpu, &cpu_bar_indic);
|
||||
lv_obj_set_click(sc_data->bar_cpu, false);
|
||||
lv_bar_set_range(sc_data->bar_cpu, 0, 100);
|
||||
lv_obj_t * label = lv_label_create(sc_data->bar_cpu, NULL);
|
||||
lv_label_set_text(label, "C\nP\nU");
|
||||
lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
sc_data->pb_mem = lv_pb_create(sc, sc_data->pb_cpu);
|
||||
lv_obj_align(sc_data->pb_mem, sc_data->pb_cpu, LV_ALIGN_OUT_RIGHT_MID, w, 0);
|
||||
lv_obj_set_style(sc_data->pb_mem, &mem_pbs);
|
||||
lv_pb_set_format_str(sc_data->pb_mem, "M\ne\nm");
|
||||
sc_data->bar_mem = lv_bar_create(sc, sc_data->bar_cpu);
|
||||
lv_obj_align(sc_data->bar_mem, sc_data->bar_cpu, LV_ALIGN_OUT_RIGHT_MID, w, 0);
|
||||
lv_obj_set_style(sc_data->bar_mem, &mem_bar_bg);
|
||||
lv_bar_set_style_indic(sc_data->bar_mem, &mem_bar_indic);
|
||||
label = lv_label_create(sc_data->bar_mem, NULL);
|
||||
lv_label_set_text(label, "M\nE\nM");
|
||||
lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
lv_app_sysmon_refr();
|
||||
}
|
||||
@@ -225,30 +233,31 @@ static void my_sc_close(lv_app_inst_t * app)
|
||||
static void my_win_open(lv_app_inst_t * app, lv_obj_t * win)
|
||||
{
|
||||
my_win_data_t * win_data = app->win_data;
|
||||
lv_app_style_t * app_style = lv_app_style_get();
|
||||
|
||||
/*Make the window content responsive*/
|
||||
lv_cont_set_layout(lv_page_get_scrl(lv_win_get_page(win)), LV_CONT_LAYOUT_PRETTY);
|
||||
|
||||
/*Create a chart with two data lines*/
|
||||
win_data->chart = lv_chart_create(win, NULL);
|
||||
lv_obj_set_size(win_data->chart, LV_HOR_RES / 2, LV_VER_RES / 2);
|
||||
lv_obj_set_pos(win_data->chart, LV_DPI / 10, LV_DPI / 10);
|
||||
lv_chart_set_pnum(win_data->chart, LV_APP_SYSMON_PNUM);
|
||||
lv_chart_set_range(win_data->chart, 0, 100);
|
||||
lv_chart_set_type(win_data->chart, LV_CHART_LINE);
|
||||
|
||||
win_data->cpu_dl = lv_chart_add_dataline(win_data->chart);
|
||||
win_data->mem_dl = lv_chart_add_dataline(win_data->chart);
|
||||
lv_chart_set_dl_width(win_data->chart, 2 * LV_DOWNSCALE);
|
||||
win_data->cpu_dl = lv_chart_add_data_line(win_data->chart, COLOR_RED);
|
||||
win_data->mem_dl = lv_chart_add_data_line(win_data->chart, COLOR_BLUE);
|
||||
|
||||
uint16_t i;
|
||||
for(i = 0; i < LV_APP_SYSMON_PNUM; i ++) {
|
||||
win_data->cpu_dl[i] = cpu_pct[i];
|
||||
win_data->mem_dl[i] = mem_pct[i];
|
||||
win_data->cpu_dl->points[i] = cpu_pct[i];
|
||||
win_data->mem_dl->points[i] = mem_pct[i];
|
||||
}
|
||||
|
||||
/*Create a label for the details of Memory and CPU usage*/
|
||||
cord_t opad = app_style->win_style.pages.scrl_rects.opad;
|
||||
win_data->label = lv_label_create(win, NULL);
|
||||
lv_label_set_recolor(win_data->label, true);
|
||||
lv_obj_align(win_data->label, win_data->chart, LV_ALIGN_OUT_RIGHT_MID, opad, 0);
|
||||
lv_obj_set_style(win_data->label, &app_style->win_txt_style);
|
||||
lv_obj_align(win_data->label, win_data->chart, LV_ALIGN_OUT_RIGHT_TOP, LV_DPI / 4, 0);
|
||||
|
||||
|
||||
lv_app_sysmon_refr();
|
||||
@@ -283,8 +292,10 @@ static void sysmon_task(void * param)
|
||||
|
||||
/*Get CPU and memory information */
|
||||
uint8_t cpu_busy = 0;
|
||||
#if USE_IDLE != 0
|
||||
#if USE_IDLE != 0 /*Use the more precise idle module if enabled*/
|
||||
cpu_busy = 100 - idle_get();
|
||||
#else
|
||||
cpu_busy = 100 - ptask_get_idle();
|
||||
#endif
|
||||
|
||||
uint8_t mem_used_pct = 0;
|
||||
@@ -315,8 +326,7 @@ static void sysmon_task(void * param)
|
||||
static bool mem_warn_report = false;
|
||||
if(mem_mon.size_free < LV_APP_SYSMON_MEM_WARN && mem_warn_report == false) {
|
||||
mem_warn_report = true;
|
||||
lv_obj_t * not = lv_app_notice_add("Critically low memory");
|
||||
lv_obj_set_style(not, lv_mboxs_get(LV_MBOXS_WARN, NULL));
|
||||
lv_app_notice_add("Critically low memory");
|
||||
}
|
||||
|
||||
if(mem_mon.size_free > LV_APP_SYSMON_MEM_WARN) mem_warn_report = false;
|
||||
@@ -325,8 +335,7 @@ static void sysmon_task(void * param)
|
||||
if(mem_mon.pct_frag > LV_APP_SYSMON_FRAG_WARN) {
|
||||
if(frag_warn_report == false) {
|
||||
frag_warn_report = true;
|
||||
lv_obj_t * not =lv_app_notice_add("Critical memory\nfragmentation");
|
||||
lv_obj_set_style(not, lv_mboxs_get(LV_MBOXS_WARN, NULL));
|
||||
lv_app_notice_add("Critical memory\nfragmentation");
|
||||
|
||||
dm_defrag(); /*Defrag. if the fragmentation is critical*/
|
||||
}
|
||||
@@ -344,13 +353,8 @@ static void lv_app_sysmon_refr(void)
|
||||
|
||||
char buf_long[256];
|
||||
char buf_short[128];
|
||||
#if USE_IDLE != 0
|
||||
sprintf(buf_long, "%c%s CPU: %d %%%c\n\n",TXT_RECOLOR_CMD, CPU_LABEL_COLOR, cpu_pct[LV_APP_SYSMON_PNUM - 1], TXT_RECOLOR_CMD);
|
||||
sprintf(buf_short, "CPU: %d %%\n", cpu_pct[LV_APP_SYSMON_PNUM - 1]);
|
||||
#else
|
||||
sprintf(buf_long, "%c%s CPU: N/A%c\n\n",TXT_RECOLOR_CMD, CPU_LABEL_COLOR, TXT_RECOLOR_CMD);
|
||||
strcpy(buf_short, "CPU: N/A\n");
|
||||
#endif
|
||||
|
||||
#if USE_DYN_MEM != 0 && DM_CUSTOM == 0
|
||||
sprintf(buf_long, "%s%c%s MEMORY: %d %%%c\nTotal: %d bytes\nUsed: %d bytes\nFree: %d bytes\nFrag: %d %%",
|
||||
@@ -359,8 +363,8 @@ static void lv_app_sysmon_refr(void)
|
||||
MEM_LABEL_COLOR,
|
||||
mem_pct[LV_APP_SYSMON_PNUM - 1],
|
||||
TXT_RECOLOR_CMD,
|
||||
mem_mon.size_total,
|
||||
mem_mon.size_total - mem_mon.size_free, mem_mon.size_free, mem_mon.pct_frag);
|
||||
(int)mem_mon.size_total,
|
||||
(int)mem_mon.size_total - mem_mon.size_free, mem_mon.size_free, mem_mon.pct_frag);
|
||||
|
||||
sprintf(buf_short, "%sMem: %d %%\nFrag: %d %%\n",
|
||||
buf_short, mem_pct[LV_APP_SYSMON_PNUM - 1], mem_mon.pct_frag);
|
||||
@@ -368,8 +372,6 @@ static void lv_app_sysmon_refr(void)
|
||||
sprintf(buf_long, "%s%c%s MEMORY: N/A%c", buf_long, TXT_RECOLOR_CMD, MEM_LABEL_COLOR, TXT_RECOLOR_CMD);
|
||||
sprintf(buf_short, "%sMem: N/A\nFrag: N/A", buf_short);
|
||||
#endif
|
||||
lv_app_style_t * app_style = lv_app_style_get();
|
||||
cord_t opad = app_style->win_style.pages.scrl_rects.opad;
|
||||
lv_app_inst_t * app;
|
||||
app = lv_app_get_next(NULL, &my_app_dsc);
|
||||
while(app != NULL) {
|
||||
@@ -377,7 +379,6 @@ static void lv_app_sysmon_refr(void)
|
||||
my_win_data_t * win_data = app->win_data;
|
||||
if(win_data != NULL) {
|
||||
lv_label_set_text(win_data->label, buf_long);
|
||||
lv_obj_align(win_data->label, win_data->chart, LV_ALIGN_OUT_RIGHT_TOP, opad, 0);
|
||||
|
||||
lv_chart_set_next(win_data->chart, win_data->mem_dl, mem_pct[LV_APP_SYSMON_PNUM - 1]);
|
||||
lv_chart_set_next(win_data->chart, win_data->cpu_dl, cpu_pct[LV_APP_SYSMON_PNUM - 1]);
|
||||
@@ -386,8 +387,8 @@ static void lv_app_sysmon_refr(void)
|
||||
/*Refresh the shortcut*/
|
||||
my_sc_data_t * sc_data = app->sc_data;
|
||||
if(sc_data != NULL) {
|
||||
lv_pb_set_value(sc_data->pb_cpu, cpu_pct[LV_APP_SYSMON_PNUM - 1]);
|
||||
lv_pb_set_value(sc_data->pb_mem, mem_pct[LV_APP_SYSMON_PNUM - 1]);
|
||||
lv_bar_set_value(sc_data->bar_cpu, cpu_pct[LV_APP_SYSMON_PNUM - 1]);
|
||||
lv_bar_set_value(sc_data->bar_mem, mem_pct[LV_APP_SYSMON_PNUM - 1]);
|
||||
}
|
||||
|
||||
lv_app_com_send(app, LV_APP_COM_TYPE_CHAR, buf_short, strlen(buf_short));
|
||||
|
||||
@@ -6,7 +6,23 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include <lv_conf.h>
|
||||
#include <misc/gfx/area.h>
|
||||
#include <lvgl/lv_obj/lv_dispi.h>
|
||||
#include <lvgl/lv_obj/lv_obj.h>
|
||||
#include <lvgl/lv_objx/lv_btn.h>
|
||||
#include <lvgl/lv_objx/lv_cont.h>
|
||||
#include <lvgl/lv_objx/lv_ddlist.h>
|
||||
#include <lvgl/lv_objx/lv_label.h>
|
||||
#include <lvgl/lv_objx/lv_page.h>
|
||||
#include <lvgl/lv_objx/lv_ta.h>
|
||||
#include <misc/gfx/color.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "lv_app_terminal.h"
|
||||
|
||||
#if LV_APP_ENABLE != 0 && USE_LV_APP_TERMINAL != 0
|
||||
|
||||
#include "lvgl/lv_app/lv_app_util/lv_app_kb.h"
|
||||
@@ -15,16 +31,19 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define OBJ_PAD (LV_DPI / 12)
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
|
||||
/*Application specific data for an instance of this application*/
|
||||
typedef struct
|
||||
{
|
||||
char txt[LV_APP_TERMINAL_LENGTH + 1];
|
||||
lv_app_com_type_t com_type;
|
||||
lv_app_terminal_format_t format;
|
||||
lv_app_inst_t * last_sender;
|
||||
}my_app_data_t;
|
||||
|
||||
@@ -33,7 +52,6 @@ typedef struct
|
||||
{
|
||||
lv_obj_t * label;
|
||||
lv_obj_t * ta;
|
||||
lv_obj_t * com_type_btn;
|
||||
lv_obj_t * clear_btn;
|
||||
}my_win_data_t;
|
||||
|
||||
@@ -53,10 +71,12 @@ static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc);
|
||||
static void my_sc_close(lv_app_inst_t * app);
|
||||
static void my_win_open(lv_app_inst_t * app, lv_obj_t * win);
|
||||
static void my_win_close(lv_app_inst_t * app);
|
||||
static void my_conf_open(lv_app_inst_t * app, lv_obj_t * conf_win);
|
||||
|
||||
static void add_data(lv_app_inst_t * app, const void * data, uint16_t data_len);
|
||||
static lv_action_res_t win_ta_rel_action(lv_obj_t * ta, lv_dispi_t * dispi);
|
||||
static lv_action_res_t win_comch_rel_action(lv_obj_t * btn, lv_dispi_t * dispi);
|
||||
static lv_action_res_t win_comtype_action(lv_obj_t * ddlist, lv_dispi_t * dispi);
|
||||
static lv_action_res_t win_format_action(lv_obj_t * ddlist, lv_dispi_t * dispi);
|
||||
static lv_action_res_t win_clear_rel_action(lv_obj_t * btn, lv_dispi_t * dispi);
|
||||
static void win_ta_kb_ok_action(lv_obj_t * ta);
|
||||
|
||||
@@ -74,14 +94,16 @@ static lv_app_dsc_t my_app_dsc =
|
||||
.win_close = my_win_close,
|
||||
.sc_open = my_sc_open,
|
||||
.sc_close = my_sc_close,
|
||||
.conf_open = my_conf_open,
|
||||
.app_data_size = sizeof(my_app_data_t),
|
||||
.sc_data_size = sizeof(my_sc_data_t),
|
||||
.win_data_size = sizeof(my_win_data_t),
|
||||
};
|
||||
|
||||
const char * com_type_txt [LV_APP_COM_TYPE_NUM];
|
||||
lv_objs_t sc_txt_bgs;
|
||||
lv_labels_t sc_txts;
|
||||
static const char * com_type_list_txt[] = {"Character", "Integer", "Log", "None", ""};
|
||||
static lv_app_com_type_t com_type_list[] = {LV_APP_COM_TYPE_CHAR, LV_APP_COM_TYPE_INT, LV_APP_COM_TYPE_LOG, LV_APP_COM_TYPE_INV};
|
||||
static const char * txt_format_list_txt[] = {"ASCII", "Hexadecimal", ""};
|
||||
static lv_style_t style_sc_term;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
@@ -97,22 +119,13 @@ lv_labels_t sc_txts;
|
||||
*/
|
||||
const lv_app_dsc_t * lv_app_terminal_init(void)
|
||||
{
|
||||
com_type_txt[LV_APP_COM_TYPE_INT] = "Ch: Num";
|
||||
com_type_txt[LV_APP_COM_TYPE_CHAR] = "Ch: Chars";
|
||||
com_type_txt[LV_APP_COM_TYPE_LOG] = "Ch: Log";
|
||||
com_type_txt[LV_APP_COM_TYPE_INV] = "Ch: None";
|
||||
|
||||
lv_app_style_t * app_style = lv_app_style_get();
|
||||
|
||||
memcpy(&sc_txts, &app_style->sc_txt_style, sizeof(lv_labels_t));
|
||||
sc_txts.line_space = 0;
|
||||
sc_txts.letter_space = 0;
|
||||
sc_txts.mid = 0;
|
||||
sc_txts.objs.color = COLOR_WHITE;
|
||||
|
||||
lv_objs_get(LV_OBJS_DEF, &sc_txt_bgs);
|
||||
sc_txt_bgs.color = COLOR_MAKE(0x20, 0x20, 0x20);
|
||||
|
||||
lv_style_get(LV_STYLE_PLAIN, &style_sc_term);
|
||||
style_sc_term.line_space = 0;
|
||||
style_sc_term.letter_space = 0;
|
||||
style_sc_term.txt_align = 0;
|
||||
style_sc_term.ccolor = COLOR_WHITE;
|
||||
style_sc_term.mcolor = COLOR_MAKE(0x20, 0x20, 0x20);
|
||||
style_sc_term.gcolor = COLOR_MAKE(0x20, 0x20, 0x20);
|
||||
|
||||
return &my_app_dsc;
|
||||
}
|
||||
@@ -131,8 +144,17 @@ static void my_app_run(lv_app_inst_t * app, void * conf)
|
||||
{
|
||||
/*Initialize the application*/
|
||||
my_app_data_t * app_data = app->app_data;
|
||||
app_data->com_type = LV_APP_COM_TYPE_CHAR;
|
||||
|
||||
if(conf != NULL) {
|
||||
app_data->com_type = ((lv_app_terminal_conf_t * ) conf)->com_type;
|
||||
app_data->format = ((lv_app_terminal_conf_t * ) conf)->format;
|
||||
} else {
|
||||
app_data->com_type = LV_APP_COM_TYPE_CHAR;
|
||||
app_data->format = LV_APP_TERMINAL_FORMAT_ASCII;
|
||||
}
|
||||
|
||||
app_data->last_sender = NULL;
|
||||
|
||||
memset(app_data->txt, 0, sizeof(app_data->txt));
|
||||
}
|
||||
|
||||
@@ -160,17 +182,27 @@ static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec,
|
||||
{
|
||||
my_app_data_t * app_data = app_rec->app_data;
|
||||
|
||||
/*Add the recevied data if the type is matches*/
|
||||
/*Add the received data if the type is matches*/
|
||||
if(type == app_data->com_type) {
|
||||
|
||||
/*Insert the name of the sender application if it is not the last*/
|
||||
if(app_data->last_sender != app_send) {
|
||||
if(app_data->txt[0] != '\0') add_data(app_rec, "\n", 1);
|
||||
add_data(app_rec, "@", 1);
|
||||
add_data(app_rec, app_send->name, strlen(app_send->name));
|
||||
add_data(app_rec, "\n", 1);
|
||||
}
|
||||
add_data(app_rec, data, size);
|
||||
|
||||
if(app_data->format == LV_APP_TERMINAL_FORMAT_HEX) {
|
||||
char hex_buf[8];
|
||||
const char * data_buf = data;
|
||||
uint32_t i;
|
||||
for(i = 0; i < size; i++) {
|
||||
sprintf(hex_buf, "%02x", data_buf[i]);
|
||||
add_data(app_rec, hex_buf, 2);
|
||||
}
|
||||
} else {
|
||||
add_data(app_rec, data, size);
|
||||
}
|
||||
}
|
||||
|
||||
app_data->last_sender = app_send;
|
||||
@@ -190,13 +222,12 @@ static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc)
|
||||
/*Create a dark background*/
|
||||
lv_obj_t * txt_bg = lv_obj_create(sc, NULL);
|
||||
lv_obj_set_size(txt_bg, 7 * LV_APP_SC_WIDTH / 8 , app->sc->cords.y2 - app->sc_title->cords.y2 - 10 * LV_DOWNSCALE);
|
||||
lv_obj_set_style(txt_bg, &sc_txt_bgs);
|
||||
lv_obj_set_style(txt_bg, &style_sc_term);
|
||||
lv_obj_align(txt_bg, app->sc_title, LV_ALIGN_OUT_BOTTOM_MID, 0, 3 * LV_DOWNSCALE);
|
||||
lv_obj_set_click(txt_bg, false);
|
||||
|
||||
/*Add a text with the text of the terminal*/
|
||||
sc_data->label = lv_label_create(txt_bg, NULL);
|
||||
lv_obj_set_style(sc_data->label, &sc_txts);
|
||||
lv_label_set_long_mode(sc_data->label, LV_LABEL_LONG_BREAK);
|
||||
lv_obj_set_width(sc_data->label, lv_obj_get_width(txt_bg) - LV_APP_SC_WIDTH / 8);
|
||||
lv_label_set_text_static(sc_data->label, app_data->txt);
|
||||
@@ -222,53 +253,36 @@ static void my_win_open(lv_app_inst_t * app, lv_obj_t * win)
|
||||
{
|
||||
my_win_data_t * win_data = app->win_data;
|
||||
my_app_data_t * app_data = app->app_data;
|
||||
lv_app_style_t * app_style = lv_app_style_get();
|
||||
|
||||
cord_t opad = app_style->win_style.pages.scrl_rects.opad;
|
||||
/*Make the window content responsive*/
|
||||
lv_cont_set_layout(lv_page_get_scrl(lv_win_get_page(win)), LV_CONT_LAYOUT_PRETTY);
|
||||
|
||||
/*Create a label for the text of the terminal*/
|
||||
win_data->label = lv_label_create(win, NULL);
|
||||
lv_label_set_long_mode(win_data->label, LV_LABEL_LONG_BREAK);
|
||||
lv_obj_set_width(win_data->label, LV_HOR_RES -
|
||||
2 * (app_style->win_style.pages.bg_rects.hpad +
|
||||
app_style->win_style.pages.scrl_rects.hpad));
|
||||
|
||||
lv_obj_set_style(win_data->label, &app_style->win_txt_style);
|
||||
lv_obj_set_width(win_data->label, lv_win_get_width(win));
|
||||
lv_label_set_text_static(win_data->label, app_data->txt); /*Use the app. data text directly*/
|
||||
|
||||
/*Create a text area. Text can be added to the terminal from here by app. keyboard.*/
|
||||
win_data->ta = lv_ta_create(win, NULL);
|
||||
lv_obj_set_size(win_data->ta, LV_HOR_RES / 2, LV_VER_RES / 4);
|
||||
lv_obj_set_size(win_data->ta, 3 * LV_HOR_RES / 5, LV_VER_RES / 4);
|
||||
lv_obj_set_free_p(win_data->ta, app);
|
||||
lv_page_set_rel_action(win_data->ta, win_ta_rel_action);
|
||||
lv_page_glue_obj(win_data->ta, true);
|
||||
lv_ta_set_text(win_data->ta, "");
|
||||
lv_obj_set_style(win_data->ta, lv_tas_get(LV_TAS_DEF, NULL));
|
||||
lv_obj_align(win_data->ta, win_data->label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, opad);
|
||||
|
||||
|
||||
/*Create a button to set the communication type (char, integer etc.)*/
|
||||
win_data->com_type_btn = lv_btn_create(win, NULL);
|
||||
lv_rect_set_fit(win_data->com_type_btn, true, true);
|
||||
lv_obj_set_free_p(win_data->com_type_btn, app);
|
||||
lv_btn_set_rel_action(win_data->com_type_btn, win_comch_rel_action);
|
||||
lv_obj_t * btn_label = lv_label_create(win_data->com_type_btn, NULL);
|
||||
lv_obj_set_style(btn_label, lv_labels_get(LV_LABELS_BTN, NULL));
|
||||
lv_label_set_text(btn_label, com_type_txt[app_data->com_type]);
|
||||
lv_obj_align(win_data->com_type_btn, win_data->ta, LV_ALIGN_OUT_RIGHT_TOP, opad, 0);
|
||||
|
||||
|
||||
/*Create a clear button*/
|
||||
win_data->clear_btn = lv_btn_create(win, win_data->com_type_btn);
|
||||
win_data->clear_btn = lv_btn_create(win, NULL);
|
||||
lv_cont_set_fit(win_data->clear_btn, true, true);
|
||||
lv_obj_set_free_p(win_data->clear_btn, app);
|
||||
lv_page_glue_obj(win_data->ta, true);
|
||||
lv_btn_set_rel_action(win_data->clear_btn, win_clear_rel_action);
|
||||
btn_label = lv_label_create(win_data->clear_btn, NULL);
|
||||
lv_obj_set_style(btn_label, lv_labels_get(LV_LABELS_BTN, NULL));
|
||||
lv_obj_t * btn_label = lv_label_create(win_data->clear_btn, NULL);
|
||||
lv_label_set_text(btn_label, "Clear");
|
||||
lv_obj_align(win_data->clear_btn, win_data->com_type_btn, LV_ALIGN_OUT_RIGHT_TOP, opad, 0);
|
||||
|
||||
/*Align the window to see the text area on the bottom*/
|
||||
lv_obj_align(lv_page_get_scrl(app->win), NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0,
|
||||
- app_style->win_style.pages.scrl_rects.vpad);
|
||||
|
||||
lv_obj_t * page = lv_win_get_page(app->win);
|
||||
lv_obj_align(lv_page_get_scrl(page), NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, - LV_VER_RES);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -280,6 +294,35 @@ static void my_win_close(lv_app_inst_t * app)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create objects to configure the applications
|
||||
* @param app pointer to an application which settings should be created
|
||||
* @param conf_win pointer to a window where the objects can be created
|
||||
* (the window has the proper layout)
|
||||
*/
|
||||
static void my_conf_open(lv_app_inst_t * app, lv_obj_t * conf_win)
|
||||
{
|
||||
my_app_data_t * app_data = app->app_data;
|
||||
|
||||
lv_obj_t * label;
|
||||
label = lv_label_create(conf_win, NULL);
|
||||
lv_label_set_text(label, "Communication type");
|
||||
|
||||
lv_obj_t * ddl;
|
||||
ddl = lv_ddlist_create(conf_win, NULL);
|
||||
lv_obj_set_free_p(ddl, app);
|
||||
lv_ddlist_set_options(ddl, com_type_list_txt);
|
||||
lv_ddlist_set_action(ddl, win_comtype_action);
|
||||
lv_ddlist_set_selected(ddl, app_data->com_type);
|
||||
|
||||
label = lv_label_create(conf_win, label);
|
||||
lv_label_set_text(label, "\nText format"); /*First '\n' keeps space from the list above*/
|
||||
ddl = lv_ddlist_create(conf_win, ddl);
|
||||
lv_ddlist_set_options(ddl, txt_format_list_txt);
|
||||
lv_ddlist_set_selected(ddl, app_data->format);
|
||||
lv_ddlist_set_action(ddl, win_format_action);
|
||||
}
|
||||
|
||||
/*--------------------
|
||||
* OTHER FUNCTIONS
|
||||
---------------------*/
|
||||
@@ -292,34 +335,50 @@ static void my_win_close(lv_app_inst_t * app)
|
||||
*/
|
||||
static lv_action_res_t win_ta_rel_action(lv_obj_t * ta, lv_dispi_t * dispi)
|
||||
{
|
||||
lv_app_kb_open(ta, LV_APP_KB_MODE_TXT, NULL, win_ta_kb_ok_action);
|
||||
lv_app_kb_open(ta, LV_APP_KB_MODE_TXT | LV_APP_KB_MODE_WIN_RESIZE, NULL, win_ta_kb_ok_action);
|
||||
|
||||
return LV_ACTION_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the communication type button is released to change the type
|
||||
* @param btn pointer to the comm. type button
|
||||
* Called when an option is chosen in the communication type drop down list on the configuration window
|
||||
* @param ddl pointer to the drop down list
|
||||
* @param dispi pointer to the caller display input
|
||||
* @return LV_ACTION_RES_OK because the button is not deleted
|
||||
* @return LV_ACTION_RES_OK because the list is not deleted
|
||||
*/
|
||||
static lv_action_res_t win_comch_rel_action(lv_obj_t * btn, lv_dispi_t * dispi)
|
||||
static lv_action_res_t win_comtype_action(lv_obj_t * ddlist, lv_dispi_t * dispi)
|
||||
{
|
||||
lv_app_inst_t * app = lv_obj_get_free_p(btn);
|
||||
lv_app_inst_t * app = lv_obj_get_free_p(ddlist);
|
||||
my_app_data_t * app_data = app->app_data;
|
||||
my_win_data_t * win_data = app->win_data;
|
||||
|
||||
if(app_data->com_type == LV_APP_COM_TYPE_CHAR) app_data->com_type = LV_APP_COM_TYPE_LOG;
|
||||
else if(app_data->com_type == LV_APP_COM_TYPE_LOG) app_data->com_type = LV_APP_COM_TYPE_INT;
|
||||
else if(app_data->com_type == LV_APP_COM_TYPE_INT) app_data->com_type = LV_APP_COM_TYPE_INV;
|
||||
else app_data->com_type = LV_APP_COM_TYPE_CHAR;
|
||||
app_data->com_type = com_type_list[lv_ddlist_get_selected(ddlist)];
|
||||
|
||||
lv_label_set_text(lv_obj_get_child(win_data->com_type_btn, NULL), com_type_txt[app_data->com_type]);
|
||||
return LV_ACTION_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the Clear button is released to clear the ex od the terminal
|
||||
* Called when an option is chosen in the format drop down list on the configuration window
|
||||
* @param ddl pointer to the drop down list
|
||||
* @param dispi pointer to the caller display input
|
||||
* @return LV_ACTION_RES_OK because the list is not deleted
|
||||
*/
|
||||
static lv_action_res_t win_format_action(lv_obj_t * ddlist, lv_dispi_t * dispi)
|
||||
{
|
||||
lv_app_inst_t * app = lv_obj_get_free_p(ddlist);
|
||||
my_app_data_t * app_data = app->app_data;
|
||||
uint16_t opt = lv_ddlist_get_selected(ddlist);
|
||||
if(strcmp(txt_format_list_txt[opt], "Hexadecimal") == 0) {
|
||||
app_data->format = LV_APP_TERMINAL_FORMAT_HEX;
|
||||
} else if (strcmp(txt_format_list_txt[opt], "ASCII") == 0) {
|
||||
app_data->format = LV_APP_TERMINAL_FORMAT_ASCII;
|
||||
}
|
||||
|
||||
return LV_ACTION_RES_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called when the Clear button is released to clear the text of the terminal
|
||||
* @param btn pointer to the clear button
|
||||
* @param dispi pointer to the caller display input
|
||||
* @return LV_ACTION_RES_OK because the button is not deleted
|
||||
@@ -339,14 +398,9 @@ static lv_action_res_t win_clear_rel_action(lv_obj_t * btn, lv_dispi_t * dispi)
|
||||
}
|
||||
|
||||
if(win_data != NULL) {
|
||||
lv_app_style_t * app_style =lv_app_style_get();
|
||||
cord_t opad = app_style->win_style.pages.scrl_rects.opad;
|
||||
lv_label_set_text_static(win_data->label, app_data->txt);
|
||||
lv_obj_align(win_data->ta, win_data->label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, opad);
|
||||
lv_obj_align(win_data->com_type_btn, win_data->ta, LV_ALIGN_OUT_RIGHT_TOP, opad, 0);
|
||||
lv_obj_align(win_data->clear_btn, win_data->com_type_btn, LV_ALIGN_OUT_RIGHT_TOP, opad, 0);
|
||||
lv_obj_align(lv_page_get_scrl(app->win), NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0,
|
||||
- app_style->win_style.pages.scrl_rects.vpad);
|
||||
lv_obj_t * page = lv_win_get_page(app->win);
|
||||
lv_obj_align(lv_page_get_scrl(page), NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, - LV_VER_RES);
|
||||
}
|
||||
|
||||
return LV_ACTION_RES_OK;
|
||||
@@ -424,16 +478,11 @@ static void add_data(lv_app_inst_t * app, const void * data, uint16_t data_len)
|
||||
|
||||
my_win_data_t * win_data = app->win_data;
|
||||
my_sc_data_t * sc_data = app->sc_data;
|
||||
lv_app_style_t * app_style = lv_app_style_get();
|
||||
|
||||
if(win_data != NULL) {
|
||||
cord_t opad = app_style->win_style.pages.scrl_rects.opad;
|
||||
lv_label_set_text_static(win_data->label, app_data->txt);
|
||||
lv_obj_align(win_data->ta, win_data->label, LV_ALIGN_OUT_BOTTOM_LEFT, 0, opad);
|
||||
lv_obj_align(win_data->com_type_btn, win_data->ta, LV_ALIGN_OUT_RIGHT_TOP, opad, 0);
|
||||
lv_obj_align(win_data->clear_btn, win_data->com_type_btn, LV_ALIGN_OUT_RIGHT_TOP, opad, 0);
|
||||
lv_obj_align(lv_page_get_scrl(app->win), NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0,
|
||||
- app_style->win_style.pages.scrl_rects.vpad);
|
||||
lv_obj_t * page = lv_win_get_page(app->win);
|
||||
lv_obj_align(lv_page_get_scrl(page), NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, - LV_VER_RES);
|
||||
}
|
||||
|
||||
/*Set the last line on the shortcut*/
|
||||
|
||||
@@ -20,9 +20,16 @@
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef enum
|
||||
{
|
||||
LV_APP_TERMINAL_FORMAT_ASCII,
|
||||
LV_APP_TERMINAL_FORMAT_HEX,
|
||||
}lv_app_terminal_format_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
lv_app_terminal_format_t format; /*Data display format*/
|
||||
lv_app_com_type_t com_type; /*The listened communication type (channel) */
|
||||
}lv_app_terminal_conf_t;
|
||||
|
||||
/**********************
|
||||
|
||||
182
lv_appx/lv_app_visual.c
Normal file
182
lv_appx/lv_app_visual.c
Normal file
@@ -0,0 +1,182 @@
|
||||
/**
|
||||
* @file lv_app_visual.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_app_example.h"
|
||||
#if LV_APP_ENABLE != 0 && USE_LV_APP_VISUAL != 0
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/*Application specific data for an instance of this application*/
|
||||
typedef struct
|
||||
{
|
||||
|
||||
}my_app_data_t;
|
||||
|
||||
/*Application specific data a window of this application*/
|
||||
typedef struct
|
||||
{
|
||||
|
||||
}my_win_data_t;
|
||||
|
||||
/*Application specific data for a shortcut of this application*/
|
||||
typedef struct
|
||||
{
|
||||
lv_obj_t * label;
|
||||
}my_sc_data_t;
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void my_app_run(lv_app_inst_t * app, void * conf);
|
||||
static void my_app_close(lv_app_inst_t * app);
|
||||
static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec, lv_app_com_type_t type , const void * data, uint32_t size);
|
||||
static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc);
|
||||
static void my_sc_close(lv_app_inst_t * app);
|
||||
static void my_win_open(lv_app_inst_t * app, lv_obj_t * win);
|
||||
static void my_win_close(lv_app_inst_t * app);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_app_dsc_t my_app_dsc =
|
||||
{
|
||||
.name = "Visualizer",
|
||||
.mode = LV_APP_MODE_NONE,
|
||||
.app_run = my_app_run,
|
||||
.app_close = my_app_close,
|
||||
.com_rec = my_com_rec,
|
||||
.win_open = my_win_open,
|
||||
.win_close = my_win_close,
|
||||
.sc_open = my_sc_open,
|
||||
.sc_close = my_sc_close,
|
||||
.app_data_size = sizeof(my_app_data_t),
|
||||
.sc_data_size = sizeof(my_sc_data_t),
|
||||
.win_data_size = sizeof(my_win_data_t),
|
||||
};
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize the application
|
||||
* @return pointer to the application descriptor of this application
|
||||
*/
|
||||
const lv_app_dsc_t * lv_app_visual_init(void)
|
||||
{
|
||||
return &my_app_dsc;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Run an application according to 'app_dsc'
|
||||
* @param app_dsc pointer to an application descriptor
|
||||
* @param conf pointer to a lv_app_example_conf_t structure with configuration data or NULL if unused
|
||||
* @return pointer to the opened application or NULL if any error occurred
|
||||
*/
|
||||
static void my_app_run(lv_app_inst_t * app, void * conf)
|
||||
{
|
||||
/*Initialize the application*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Close a running application.
|
||||
* Close the Window and the Shortcut too if opened.
|
||||
* Free all the allocated memory by this application.
|
||||
* @param app pointer to an application
|
||||
*/
|
||||
static void my_app_close(lv_app_inst_t * app)
|
||||
{
|
||||
/*No dynamically allocated data in 'my_app_data'*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the data have been sent to this application
|
||||
* @param app_send pointer to an application which sent the message
|
||||
* @param app_rec pointer to an application which is receiving the message
|
||||
* @param type type of data from 'lv_app_com_type_t' enum
|
||||
* @param data pointer to the sent data
|
||||
* @param size length of 'data' in bytes
|
||||
*/
|
||||
static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec,
|
||||
lv_app_com_type_t type , const void * data, uint32_t size)
|
||||
{
|
||||
if(type == LV_APP_COM_TYPE_CHAR) { /*data: string*/
|
||||
my_sc_data_t * sc_data = app_rec->sc_data;
|
||||
if (sc_data->label != NULL) {
|
||||
lv_label_set_text_array(sc_data->label, data, size);
|
||||
lv_obj_align(sc_data->label , NULL,LV_ALIGN_CENTER, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a shortcut for an application
|
||||
* @param app pointer to an application
|
||||
* @param sc pointer to an object where the application
|
||||
* can create content of the shortcut
|
||||
*/
|
||||
static void my_sc_open(lv_app_inst_t * app, lv_obj_t * sc)
|
||||
{
|
||||
my_sc_data_t * sc_data = app->sc_data;
|
||||
|
||||
sc_data->label = lv_label_create(sc, NULL);
|
||||
lv_label_set_text(sc_data->label, "Empty");
|
||||
lv_obj_align(sc_data->label, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the shortcut of an application
|
||||
* @param app pointer to an application
|
||||
*/
|
||||
static void my_sc_close(lv_app_inst_t * app)
|
||||
{
|
||||
/*No dynamically allocated data in 'my_sc_data'*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Open the application in a window
|
||||
* @param app pointer to an application
|
||||
* @param win pointer to a window object where
|
||||
* the application can create content
|
||||
*/
|
||||
static void my_win_open(lv_app_inst_t * app, lv_obj_t * win)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the window of an application
|
||||
* @param app pointer to an application
|
||||
*/
|
||||
static void my_win_close(lv_app_inst_t * app)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*--------------------
|
||||
* OTHER FUNCTIONS
|
||||
---------------------*/
|
||||
|
||||
#endif /*LV_APP_ENABLE != 0 && USE_LV_APP_VISUAL != 0*/
|
||||
39
lv_appx/lv_app_visual.h
Normal file
39
lv_appx/lv_app_visual.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @file lv_app_visual.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_APP_VISUAL_H
|
||||
#define LV_APP_VISUAL_H
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lvgl/lv_app/lv_app.h"
|
||||
|
||||
#if LV_APP_ENABLE != 0 && USE_LV_APP_VISUAL != 0
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef struct
|
||||
{
|
||||
|
||||
}lv_app_visual_conf_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
const lv_app_dsc_t * lv_app_visual_init(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_APP_ENABLE != 0 && USE_LV_APP_VISUAL != 0*/
|
||||
|
||||
#endif /* LV_APP_VISUAL_H */
|
||||
232
lv_conf_temp.h
232
lv_conf_temp.h
@@ -1,232 +0,0 @@
|
||||
/**
|
||||
* @file lv_conf.h
|
||||
*
|
||||
*/
|
||||
|
||||
#if 0 /*Remove this to enable the content (Delete the last #endif too!)*/
|
||||
|
||||
#ifndef LV_CONF_H
|
||||
#define LV_CONF_H
|
||||
|
||||
/*===================
|
||||
Graphical settings
|
||||
*=====================*/
|
||||
|
||||
/* Horizontal and vertical resolution of the library.
|
||||
* Screen resolution multiplied by LV_DOWN_SCALE*/
|
||||
#define LV_HOR_RES (480 * LV_DOWNSCALE)
|
||||
#define LV_VER_RES (320 * LV_DOWNSCALE)
|
||||
|
||||
/* Buffered rendering: >= LV_DOWNSCALE * LV_HOR_RES or 0 to disable buffering*/
|
||||
|
||||
#define LV_VDB_SIZE (LV_HOR_RES * (LV_VER_RES / 20))
|
||||
|
||||
/* Enable antialaiassing
|
||||
* If enabled everything will half-sized
|
||||
* Use LV_DOWNSCALE to compensate
|
||||
* the down scaling effect of antialiassing*/
|
||||
#define LV_ANTIALIAS 1
|
||||
/*Set the downscaling value*/
|
||||
#if LV_ANTIALIAS == 0
|
||||
#define LV_DOWNSCALE 1
|
||||
#else
|
||||
#define LV_DOWNSCALE 2
|
||||
#endif
|
||||
|
||||
#define LV_REFR_PERIOD 40 /*Screen refresh period in milliseconds*/
|
||||
#define LV_INV_FIFO_SIZE 32 /*The average number of objects on a screen */
|
||||
|
||||
/*=================
|
||||
Misc. setting
|
||||
*=================*/
|
||||
/*Display Input settings*/
|
||||
#define LV_DISPI_READ_PERIOD 50 /*Input device read period milliseconds*/
|
||||
#define LV_DISPI_TP_MARKER 0 /*Mark the pressed points*/
|
||||
#define LV_DISPI_DRAG_LIMIT 10 /*Drag threshold in pixels */
|
||||
#define LV_DISPI_DRAG_THROW 20 /*Drag throw slow-down in [%]. Greater value means faster slow-down */
|
||||
#define LV_DISPI_LONG_PRESS_TIME 400 /*Long press time in milliseconds*/
|
||||
#define LV_DISPI_LONG_PRESS_REP_TIME 100 /*Repeated trigger period in long press [ms] */
|
||||
|
||||
/*Coordinates*/
|
||||
#define LV_CORD_TYPE int16_t /*Coordinate type*/
|
||||
#define LV_CORD_MAX (32000)
|
||||
#define LV_CORD_MIN (-32000)
|
||||
|
||||
/*Fonts and texts*/
|
||||
#define USE_FONT_DEJAVU_8 1
|
||||
#define USE_FONT_DEJAVU_10 1
|
||||
#define USE_FONT_DEJAVU_14 1
|
||||
#define USE_FONT_DEJAVU_20 1
|
||||
#define USE_FONT_DEJAVU_30 1
|
||||
#define USE_FONT_DEJAVU_40 1
|
||||
#define USE_FONT_DEJAVU_60 1
|
||||
#define USE_FONT_DEJAVU_80 1
|
||||
#define USE_FONT_SYMBOL_30 1
|
||||
#define USE_FONT_SYMBOL_60 1
|
||||
#define LV_FONT_DEFAULT FONT_DEJAVU_30 /*Always set a default font*/
|
||||
#define LV_TXT_BREAK_CHARS " ,.;-" /*Can break texts on these chars*/
|
||||
|
||||
/*lv_obj (base object) settings*/
|
||||
#define LV_OBJ_FREE_P 1 /*Enable the free pointer attribute*/
|
||||
#define LV_OBJ_DEF_SCR_COLOR COLOR_SILVER /*Default screen color*/
|
||||
|
||||
/*Others*/
|
||||
#define LV_COLOR_TRANSP COLOR_LIME
|
||||
|
||||
/*==================
|
||||
* LV OBJ X USAGE
|
||||
* ================*/
|
||||
|
||||
/*Rectangle (dependencies: -*/
|
||||
#define USE_LV_RECT 1
|
||||
|
||||
/*Label (dependencies: -*/
|
||||
#define USE_LV_LABEL 1
|
||||
#if USE_LV_LABEL != 0
|
||||
#define LV_LABEL_SCROLL_SPEED (25 * LV_DOWNSCALE) /*Hor, or ver. scroll speed (px/sec) in 'LV_LABEL_LONG_SCROLL' mode*/
|
||||
#define LV_LABEL_SCROLL_SPEED_VER (10 * LV_DOWNSCALE) /*Ver. scroll speed if hor. scroll is applied too*/
|
||||
#define LV_LABEL_SCROLL_PLAYBACK_PAUSE 500 /*Wait before the scroll turns back in ms*/
|
||||
#define LV_LABEL_SCROLL_REPEAT_PAUSE 500 /*Wait before the scroll begins again in ms*/
|
||||
#endif
|
||||
|
||||
/*Button (dependencies: lv_rect*/
|
||||
#define USE_LV_BTN 1
|
||||
|
||||
/*Line (dependencies: -*/
|
||||
#define USE_LV_LINE 1
|
||||
|
||||
/*Image (dependencies: lv_label (if symbols are enabled) from misc: FSINT, UFS)*/
|
||||
#define USE_LV_IMG 1
|
||||
#if USE_LV_IMG != 0
|
||||
#define LV_IMG_DEF_WALLPAPER img_square_x2 /*Comment this line to NOT use wallpaper*/
|
||||
/* 1: enables to interpret the file names as symbol name
|
||||
* from symbol_def.h if they begin with a lower case letter.
|
||||
* (driver letters are always upper case)*/
|
||||
#define LV_IMG_ENABLE_SYMBOLS 1
|
||||
#if LV_IMG_ENABLE_SYMBOLS != 0
|
||||
#define LV_IMG_DEF_SYMBOL_FONT FONT_SYMBOL_30
|
||||
#endif /*LV_IMG_ENABLE_SYMBOLS*/
|
||||
#endif /*USE_LV_IMG*/
|
||||
|
||||
/*Page (dependencies: lv_rect)*/
|
||||
#define USE_LV_PAGE 1
|
||||
#if USE_LV_PAGE != 0
|
||||
#define LV_PAGE_ANIM_FOCUS_TIME 300 /*List focus animation time [ms] (0: turn off the animation)*/
|
||||
#endif
|
||||
|
||||
/*List (dependencies: lv_btn, lv_label, lv_img)*/
|
||||
#define USE_LV_LIST 1
|
||||
|
||||
/*Check box (dependencies: lv_btn, lv_label)*/
|
||||
#define USE_LV_CB 1
|
||||
|
||||
/*Progress bar (dependencies: lv_rect, lv_label)*/
|
||||
#define USE_LV_PB 1
|
||||
|
||||
/*LED (dependencies: lv_rect)*/
|
||||
#define USE_LV_LED 1
|
||||
|
||||
/*Chart (dependencies: lv_rect, lv_line)*/
|
||||
#define USE_LV_CHART 1
|
||||
|
||||
/*Text area (dependencies: lv_label, lv_page)*/
|
||||
#define USE_LV_TA 1
|
||||
#if USE_LV_TA != 0
|
||||
#define LV_TA_MAX_LENGTH 256
|
||||
#define LV_TA_CUR_BLINK_TIME 400 /*ms*/
|
||||
#endif
|
||||
|
||||
/*Button matrix (dependencies: lv_rect, lv_label)*/
|
||||
#define USE_LV_BTNM 1
|
||||
|
||||
/*Window (dependencies: lv_rect, lv_btn, lv_label, lv_img, lv_page)*/
|
||||
#define USE_LV_WIN 1
|
||||
|
||||
/*Message box (dependencies: lv_rect, lv_btn, lv_label)*/
|
||||
#define USE_LV_MBOX 1
|
||||
#if USE_LV_MBOX != 0
|
||||
#define LV_MBOX_ANIM_TIME 250 /*How fast animate out the message box in auto close. 0: no animation [ms]*/
|
||||
#endif
|
||||
|
||||
/*Gauge (dependencies: lv_rect, lv_label, lv_line, misc: trigo)*/
|
||||
#define USE_LV_GAUGE 1
|
||||
|
||||
/*==================
|
||||
* LV APP SETTINGS
|
||||
* =================*/
|
||||
|
||||
/*Enable the application system*/
|
||||
#define LV_APP_ENABLE 1
|
||||
|
||||
#if LV_APP_ENABLE != 0
|
||||
#define LV_APP_SC_WIDTH (LV_HOR_RES / 4) /*Shortcut width*/
|
||||
#define LV_APP_SC_HEIGHT (LV_VER_RES / 3) /*Shortcut height*/
|
||||
#define LV_APP_FONT_SMALL FONT_DEJAVU_20
|
||||
#define LV_APP_FONT_MEDIUM LV_FONT_DEFAULT
|
||||
#define LV_APP_FONT_LARGE FONT_DEJAVU_40
|
||||
|
||||
/* Internal icons:
|
||||
* 0: Do not use internal icons (img_close, img_add etc. icons have to be provided)
|
||||
* 1: Use simple sized icons
|
||||
* 2: Use double sized icons*/
|
||||
#define LV_APP_USE_INTERNAL_ICONS 2
|
||||
|
||||
/*Enable or disable the internal icons individually*/
|
||||
#if LV_APP_USE_INTERNAL_ICONS != 0
|
||||
#define USE_IMG_CLOSE 1
|
||||
#define USE_IMG_DOWN 1
|
||||
#define USE_IMG_DRIVER 1
|
||||
#define USE_IMG_FILE 1
|
||||
#define USE_IMG_FOLDER 1
|
||||
#define USE_IMG_LEFT 1
|
||||
#define USE_IMG_OK 1
|
||||
#define USE_IMG_RIGHT 1
|
||||
#define USE_IMG_UP 1
|
||||
#endif
|
||||
|
||||
/*Animation settings*/
|
||||
#define LV_APP_EFFECT_OPA 1 /*Enable the opacity in the application style (can be modified)*/
|
||||
#define LV_APP_EFFECT_ANIM 1 /*Enable the animation of the applications*/
|
||||
#define LV_APP_EFFECT_OPA_ANIM 1 /*Enable the using opacity in the application animations*/
|
||||
#define LV_APP_ANIM_WIN 200 /*Animation time in milliseconds (0: turn off animation)*/
|
||||
#define LV_APP_ANIM_SC 200 /*Animation time in milliseconds (0: turn off animation)*/
|
||||
#define LV_APP_ANIM_NOTICE 300 /*Obsolete, use LV_MBOX_ANIM. */
|
||||
|
||||
/* App. utility settings */
|
||||
#define LV_APP_NOTICE_SHOW_TIME 4000 /*Notices will be shown for this time [ms]*/
|
||||
#define LV_APP_NOTICE_MAX_LEN 256 /*Max. number of characters on a notice*/
|
||||
/*==================
|
||||
* LV APP X USAGE
|
||||
* ================*/
|
||||
|
||||
#define USE_LV_APP_EXAMPLE 1
|
||||
|
||||
#define USE_LV_APP_SYSMON 1
|
||||
#if USE_LV_APP_SYSMON != 0
|
||||
#define LV_APP_SYSMON_REFR_TIME 500 /*[ms]*/
|
||||
#define LV_APP_SYSMON_PNUM 64
|
||||
#define LV_APP_SYSMON_MEM_WARN (4 * 1024)
|
||||
#define LV_APP_SYSMON_FRAG_WARN (70) /*[%]*/
|
||||
#define LV_APP_SYSMON_DEFRAG_PERIOD (5000) /*[%]*/
|
||||
#endif /*USE_LV_APP_SYSMON != 0*/
|
||||
|
||||
#define USE_LV_APP_TERMINAL 1
|
||||
#if USE_LV_APP_TERMINAL != 0
|
||||
#define LV_APP_TERMINAL_LENGTH 512 /*Memory of the terminal*/
|
||||
#endif /*USE_LV_APP_TERMINAL != 0*/
|
||||
|
||||
#define USE_LV_APP_FILES 1
|
||||
#if USE_LV_APP_FILES != 0
|
||||
#define LV_APP_FILES_PAGE_SIZE 8 /*Max. number of files/folder on a page*/
|
||||
#define LV_APP_FILES_FN_MAX_LEN 128
|
||||
#define LV_APP_FILES_PATH_MAX_LEN 256
|
||||
#define LV_APP_FILES_CHUNK_DEF_SIZE 256
|
||||
#define LV_APP_FILES_CHUNK_DEF_TIME 100
|
||||
#define LV_APP_FILES_CHUNK_MAX_SIZE 1024
|
||||
#endif /*USE_LV_APP_FILES != 0*/
|
||||
#endif /*LV_APP_ENABLE != 0*/
|
||||
|
||||
#endif /*LV_CONF_H*/
|
||||
|
||||
#endif /*Remove this to enable the content*/
|
||||
|
||||
244
lv_conf_templ.h
Normal file
244
lv_conf_templ.h
Normal file
@@ -0,0 +1,244 @@
|
||||
/**
|
||||
* @file lv_conf.h
|
||||
*
|
||||
*/
|
||||
|
||||
#if 0 /*Remove this to enable the content (Delete the last #endif too!)*/
|
||||
|
||||
#ifndef LV_CONF_H
|
||||
#define LV_CONF_H
|
||||
|
||||
/*===================
|
||||
Graphical settings
|
||||
*=====================*/
|
||||
|
||||
/* Horizontal and vertical resolution of the library.
|
||||
* Screen resolution multiplied by LV_DOWN_SCALE*/
|
||||
#define LV_HOR_RES (320 * LV_DOWNSCALE)
|
||||
#define LV_VER_RES (240 * LV_DOWNSCALE)
|
||||
#define LV_DPI (80 * LV_DOWNSCALE)
|
||||
|
||||
/* Buffered rendering: >= LV_DOWNSCALE * LV_HOR_RES or 0 to disable buffering*/
|
||||
#define LV_VDB_SIZE (LV_HOR_RES * 30)
|
||||
|
||||
/* Enable antialaiassing
|
||||
* If enabled everything will half-sized
|
||||
* Use LV_DOWNSCALE to compensate
|
||||
* the down scaling effect of antialiassing*/
|
||||
#define LV_ANTIALIAS 1
|
||||
|
||||
/*Set the downscaling value*/
|
||||
#define LV_DOWNSCALE (1 << LV_ANTIALIAS)
|
||||
|
||||
#define LV_REFR_PERIOD 40 /*Screen refresh period in milliseconds*/
|
||||
#define LV_INV_FIFO_SIZE 32 /*The average number of objects on a screen */
|
||||
|
||||
/*=================
|
||||
Misc. setting
|
||||
*=================*/
|
||||
/*Display Input settings*/
|
||||
#define LV_DISPI_READ_PERIOD 50 /*Input device read period milliseconds*/
|
||||
#define LV_DISPI_TP_MARKER 0 /*Mark the pressed points (Value means marker point size)*/
|
||||
#define LV_DISPI_DRAG_LIMIT (10 * LV_DOWNSCALE) /*Drag threshold in pixels */
|
||||
#define LV_DISPI_DRAG_THROW 20 /*Drag throw slow-down in [%]. Greater value means faster slow-down */
|
||||
#define LV_DISPI_LONG_PRESS_TIME 400 /*Long press time in milliseconds*/
|
||||
#define LV_DISPI_LONG_PRESS_REP_TIME 100 /*Repeated trigger period in long press [ms] */
|
||||
|
||||
/*lv_obj (base object) settings*/
|
||||
#define LV_OBJ_FREE_NUM 1 /*Enable the free number attribute*/
|
||||
#define LV_OBJ_FREE_P 1 /*Enable the free pointer attribute*/
|
||||
|
||||
/*Others*/
|
||||
#define LV_COLOR_TRANSP COLOR_LIME
|
||||
|
||||
/*==================
|
||||
* LV OBJ X USAGE
|
||||
* ================*/
|
||||
|
||||
/*****************
|
||||
* Simple object
|
||||
*****************/
|
||||
|
||||
/*Label (dependencies: -*/
|
||||
#define USE_LV_LABEL 1
|
||||
#if USE_LV_LABEL != 0
|
||||
#define LV_LABEL_SCROLL_SPEED (25 * LV_DOWNSCALE) /*Hor, or ver. scroll speed (px/sec) in 'LV_LABEL_LONG_SCROLL' mode*/
|
||||
#define LV_LABEL_SCROLL_SPEED_VER (10 * LV_DOWNSCALE) /*Ver. scroll speed if hor. scroll is applied too*/
|
||||
#define LV_LABEL_SCROLL_PLAYBACK_PAUSE 500 /*Wait before the scroll turns back in ms*/
|
||||
#define LV_LABEL_SCROLL_REPEAT_PAUSE 500 /*Wait before the scroll begins again in ms*/
|
||||
#endif
|
||||
|
||||
/*Image (dependencies: lv_label (if symbols are enabled) from misc: FSINT, UFS)*/
|
||||
#define USE_LV_IMG 1
|
||||
#if USE_LV_IMG != 0
|
||||
//#define LV_IMG_DEF_WALLPAPER img_square_x1 /*Comment this line to NOT use wallpaper*/
|
||||
/* 1: enables to interpret the file names as symbol name
|
||||
* from symbol_def.h if they begin with a lower case letter.
|
||||
* (driver letters are always upper case)*/
|
||||
#define LV_IMG_ENABLE_SYMBOLS 1
|
||||
#if LV_IMG_ENABLE_SYMBOLS != 0
|
||||
#define LV_IMG_DEF_SYMBOL_FONT FONT_SYMBOL_30
|
||||
#endif /*LV_IMG_ENABLE_SYMBOLS*/
|
||||
#endif /*USE_LV_IMG*/
|
||||
|
||||
/*Line (dependencies: -*/
|
||||
#define USE_LV_LINE 1
|
||||
|
||||
/*******************
|
||||
* Container object
|
||||
*******************/
|
||||
|
||||
/*Container (dependencies: -*/
|
||||
#define USE_LV_CONT 1
|
||||
|
||||
/*Page (dependencies: lv_cont)*/
|
||||
#define USE_LV_PAGE 1
|
||||
|
||||
/*Window (dependencies: lv_cont, lv_btn, lv_label, lv_img, lv_page)*/
|
||||
#define USE_LV_WIN 1
|
||||
|
||||
/*************************
|
||||
* Data visualizer object
|
||||
*************************/
|
||||
|
||||
/*Bar (dependencies: -)*/
|
||||
#define USE_LV_BAR 1
|
||||
|
||||
/*Line meter (dependencies: bar; misc: trigo)*/
|
||||
#define USE_LV_LMETER 1
|
||||
|
||||
/*Gauge (dependencies:bar, lmeter; misc: trigo)*/
|
||||
#define USE_LV_GAUGE 1
|
||||
|
||||
/*Chart (dependencies: -)*/
|
||||
#define USE_LV_CHART 1
|
||||
|
||||
/*LED (dependencies: -)*/
|
||||
#define USE_LV_LED 1
|
||||
|
||||
/*Message box (dependencies: lv_rect, lv_btn, lv_label)*/
|
||||
#define USE_LV_MBOX 1
|
||||
|
||||
/*Text area (dependencies: lv_label, lv_page)*/
|
||||
#define USE_LV_TA 1
|
||||
#if USE_LV_TA != 0
|
||||
#define LV_TA_MAX_LENGTH 256
|
||||
#define LV_TA_CUR_BLINK_TIME 400 /*ms*/
|
||||
#endif
|
||||
|
||||
/*************************
|
||||
* User input object
|
||||
*************************/
|
||||
|
||||
/*Button (dependencies: lv_cont*/
|
||||
#define USE_LV_BTN 1
|
||||
|
||||
/*Button matrix (dependencies: -)*/
|
||||
#define USE_LV_BTNM 1
|
||||
|
||||
/*Check box (dependencies: lv_btn, lv_label)*/
|
||||
#define USE_LV_CB 1
|
||||
|
||||
/*List (dependencies: lv_page, lv_btn, lv_label, lv_img)*/
|
||||
#define USE_LV_LIST 1
|
||||
|
||||
/*Drop down list (dependencies: lv_page, lv_label)*/
|
||||
#define USE_LV_DDLIST 1
|
||||
|
||||
/*Slider (dependencies: lv_bar)*/
|
||||
#define USE_LV_SLIDER 1
|
||||
|
||||
|
||||
/*==================
|
||||
* LV APP SETTINGS
|
||||
* =================*/
|
||||
|
||||
/*Enable the application system*/
|
||||
#define LV_APP_ENABLE 0
|
||||
#if LV_APP_ENABLE != 0
|
||||
|
||||
/****************************
|
||||
* Basic application settings
|
||||
*****************************/
|
||||
#define LV_APP_DESKTOP 1 /*Create a desktop-like environment*/
|
||||
|
||||
#define LV_APP_SC_WIDTH (LV_HOR_RES / 4) /*Shortcut width*/
|
||||
#define LV_APP_SC_HEIGHT (LV_VER_RES / 3) /*Shortcut height*/
|
||||
#define LV_APP_FONT_SMALL FONT_DEJAVU_20 /*A small font*/
|
||||
#define LV_APP_FONT_MEDIUM FONT_DEFAULT /*A medium font*/
|
||||
#define LV_APP_FONT_LARGE FONT_DEJAVU_40 /*A large font*/
|
||||
|
||||
/***********************
|
||||
* Animation settings
|
||||
***********************/
|
||||
#define LV_APP_ANIM_WIN 200 /*Animation time of windows [ms] (0: turn off animations)*/
|
||||
#define LV_APP_ANIM_DESKTOP 200 /*Animation time the desktop [ms] (0: turn off animations)*/
|
||||
|
||||
/************************
|
||||
* App. utility settings
|
||||
************************/
|
||||
|
||||
/*Notice*/
|
||||
#define USE_LV_APP_NOTICE 1
|
||||
#if USE_LV_APP_NOTICE != 0
|
||||
#define LV_APP_NOTICE_SHOW_TIME 4000 /*Notices will be shown for this time [ms]*/
|
||||
#define LV_APP_NOTICE_CLOSE_ANIM_TIME 300 /*Notice close animation time. [ms] 0: no animation */
|
||||
#define LV_APP_NOTICE_MAX_NUM 6 /*Max. number of notices*/
|
||||
#define LV_APP_NOTICE_MAX_LEN 256 /*Max. number of characters on a notice*/
|
||||
#endif
|
||||
|
||||
/*File selector*/
|
||||
#define USE_LV_APP_FSEL 1
|
||||
#if USE_LV_APP_FSEL != 0
|
||||
#define LV_APP_FSEL_PAGE_SIZE 8 /*Max. number of files/folder on a page*/
|
||||
#define LV_APP_FSEL_FN_MAX_LEN 32 /*Max file name length*/
|
||||
#define LV_APP_FSEL_PATH_MAX_LEN 256 /*Max path length*/
|
||||
#endif
|
||||
|
||||
/*Keyboard*/
|
||||
#define USE_LV_APP_KB 1
|
||||
#if USE_LV_APP_KB != 0
|
||||
/*No settings*/
|
||||
#endif
|
||||
|
||||
/*==================
|
||||
* LV APP X USAGE
|
||||
* ================*/
|
||||
|
||||
/*Example application*/
|
||||
#define USE_LV_APP_EXAMPLE 1
|
||||
|
||||
/*System monitor*/
|
||||
#define USE_LV_APP_SYSMON 1
|
||||
#if USE_LV_APP_SYSMON != 0
|
||||
#define LV_APP_SYSMON_REFR_TIME 500 /*Mem. and CPU usage read period [ms]*/
|
||||
#define LV_APP_SYSMON_PNUM 64 /*Number of point on the window's chart*/
|
||||
#define LV_APP_SYSMON_MEM_WARN (2 * 1024) /*Make a notice less then this remaining memory [bytes]*/
|
||||
#define LV_APP_SYSMON_FRAG_WARN (70) /*Make a notice above this fragmentation level [%]*/
|
||||
#define LV_APP_SYSMON_DEFRAG_PERIOD (5000) /*Auto-defrag period [ms]*/
|
||||
#endif /*USE_LV_APP_SYSMON != 0*/
|
||||
|
||||
/*Terminal*/
|
||||
#define USE_LV_APP_TERMINAL 1
|
||||
#if USE_LV_APP_TERMINAL != 0
|
||||
#define LV_APP_TERMINAL_LENGTH 512 /*Memory of the terminal [character number]*/
|
||||
#endif /*USE_LV_APP_TERMINAL != 0*/
|
||||
|
||||
/*Files*/
|
||||
#define USE_LV_APP_FILES 1
|
||||
#if USE_LV_APP_FILES != 0
|
||||
#define LV_APP_FILES_PAGE_SIZE 8 /*Max. number of files/folder on a page*/
|
||||
#define LV_APP_FILES_FN_MAX_LEN 32 /*Max file name length*/
|
||||
#define LV_APP_FILES_PATH_MAX_LEN 256 /*Max path length*/
|
||||
#define LV_APP_FILES_CHUNK_DEF_SIZE 256 /*Chunk size when sending a file*/
|
||||
#define LV_APP_FILES_CHUNK_DEF_TIME 100 /*Delay between sent chunks*/
|
||||
#define LV_APP_FILES_CHUNK_MAX_SIZE 1024 /*Max chunk size when the user sets it*/
|
||||
#endif /*USE_LV_APP_FILES != 0*/
|
||||
|
||||
#endif /*LV_APP_ENABLE != 0*/
|
||||
|
||||
#endif /*LV_CONF_H*/
|
||||
|
||||
|
||||
#endif /*Remove this to enable the content*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @file lv_draw_img.h
|
||||
* @file lv_draw.h
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -9,14 +9,9 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../lv_objx/lv_btn.h"
|
||||
#include "../lv_objx/lv_rect.h"
|
||||
#include "../lv_objx/lv_line.h"
|
||||
#include "../lv_objx/lv_img.h"
|
||||
#include "../lv_objx/lv_label.h"
|
||||
|
||||
#include "misc_conf.h"
|
||||
#include "../lv_misc/text.h"
|
||||
#include "misc/gfx/text.h"
|
||||
#include "../lv_obj/lv_style.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -34,52 +29,52 @@
|
||||
* Draw a rectangle
|
||||
* @param cords_p the coordinates of the rectangle
|
||||
* @param mask_p the rectangle will be drawn only in this mask
|
||||
* @param rects_p pointer to a rectangle style
|
||||
* @param opa the opacity of the rectangle (0..255)
|
||||
* @param style_p pointer to a style
|
||||
*/
|
||||
#if USE_LV_RECT != 0
|
||||
void lv_draw_rect(const area_t * cords_p, const area_t * mask_p,
|
||||
const lv_rects_t * rects_p, opa_t opa);
|
||||
void lv_draw_rect(const area_t * cords_p, const area_t * mask_p, const lv_style_t * style_p);
|
||||
|
||||
|
||||
/*Experimental use for 3D modeling*/
|
||||
#define USE_LV_TRIANGLE 0
|
||||
#if USE_LV_TRIANGLE != 0
|
||||
/**
|
||||
*
|
||||
* @param points pointer to an array with 3 points
|
||||
* @param mask_p the triangle will be drawn only in this mask
|
||||
* @param color color of the triangle
|
||||
*/
|
||||
void lv_draw_triangle(const point_t * points, const area_t * mask_p, color_t color);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Write a text
|
||||
* @param cords_p coordinates of the label
|
||||
* @param mask_p the label will be drawn only in this area
|
||||
* @param labels_p pointer to a label style
|
||||
* @param opa opacity of the text (0..255)
|
||||
* @param style_p pointer to a style
|
||||
* @param txt 0 terminated text to write
|
||||
* @param flags settings for the text from 'txt_flag_t' enum
|
||||
*/
|
||||
#if USE_LV_LABEL != 0
|
||||
void lv_draw_label(const area_t * cords_p,const area_t * mask_p,
|
||||
const lv_labels_t * labels_p, opa_t opa, const char * txt, txt_flag_t flag);
|
||||
#endif
|
||||
void lv_draw_label(const area_t * cords_p,const area_t * mask_p, const lv_style_t * style_p,
|
||||
const char * txt, txt_flag_t flag);
|
||||
|
||||
/**
|
||||
* Draw an image
|
||||
* @param cords_p the coordinates of the image
|
||||
* @param mask_p the image will be drawn only in this area
|
||||
* @param map_p pointer to a color_t array which contains the pixels of the image
|
||||
* @param opa opacity of the image (0..255)
|
||||
*/
|
||||
#if USE_LV_IMG != 0 && USE_FSINT != 0 && USE_UFS != 0
|
||||
void lv_draw_img(const area_t * cords_p, const area_t * mask_p,
|
||||
const lv_imgs_t * imgs_p, opa_t opa, const char * fn);
|
||||
#endif
|
||||
const lv_style_t * style_p, const char * fn);
|
||||
|
||||
/**
|
||||
* Draw a line
|
||||
* @param p1 first point of the line
|
||||
* @param p2 second point of the line
|
||||
* @param mask_pthe line will be drawn only on this area
|
||||
* @param lines_p pointer to a line style
|
||||
* @param opa opacity of the line (0..255)
|
||||
* @param style_p pointer to a style
|
||||
*/
|
||||
#if USE_LV_LINE != 0
|
||||
void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
|
||||
const lv_lines_t * lines_p, opa_t opa);
|
||||
#endif
|
||||
const lv_style_t * style_p);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "lv_draw_rbasic.h"
|
||||
#include "lv_conf.h"
|
||||
#include "hal/disp/disp.h"
|
||||
#include "../lv_misc/font.h"
|
||||
#include "misc/gfx/font.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -22,7 +22,6 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void lv_rpx(cord_t x, cord_t y, const area_t * mask_p, color_t color);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -36,6 +35,25 @@ static void lv_rpx(cord_t x, cord_t y, const area_t * mask_p, color_t color);
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Put a pixel to the display
|
||||
* @param x x coordinate of the pixel
|
||||
* @param y y coordinate of the pixel
|
||||
* @param mask_p the pixel will be drawn on this area
|
||||
* @param color color of the pixel
|
||||
* @param opa opacity (ignored, only for compatibility with lv_vpx)
|
||||
*/
|
||||
void lv_rpx(cord_t x, cord_t y, const area_t * mask_p, color_t color, opa_t opa)
|
||||
{
|
||||
area_t area;
|
||||
area.x1 = x;
|
||||
area.y1 = y;
|
||||
area.x2 = x;
|
||||
area.y2 = y;
|
||||
|
||||
lv_rfill(&area, mask_p, color, OPA_COVER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill an area on the display
|
||||
* @param cords_p coordinates of the area to fill
|
||||
@@ -59,8 +77,7 @@ void lv_rfill(const area_t * cords_p, const area_t * mask_p,
|
||||
|
||||
|
||||
if(union_ok != false){
|
||||
disp_area(DISP_ID_ALL, masked_area.x1, masked_area.y1, masked_area.x2, masked_area.y2);
|
||||
disp_fill(DISP_ID_ALL, color);
|
||||
disp_fill(masked_area.x1, masked_area.y1, masked_area.x2, masked_area.y2, color);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +90,7 @@ void lv_rfill(const area_t * cords_p, const area_t * mask_p,
|
||||
* @param color color of letter
|
||||
* @param opa opacity of letter (ignored, only for compatibility with lv_vletter)
|
||||
*/
|
||||
void lv_rletter(const point_t * pos_p, const area_t * mask_p,
|
||||
void lv_rletter(const point_t * pos_p, const area_t * mask_p,
|
||||
const font_t * font_p, uint8_t letter,
|
||||
color_t color, opa_t opa)
|
||||
{
|
||||
@@ -81,11 +98,11 @@ void lv_rletter(const point_t * pos_p, const area_t * mask_p,
|
||||
const uint8_t * bitmap_p = font_get_bitmap(font_p, letter);
|
||||
|
||||
uint8_t col, col_sub, row;
|
||||
|
||||
#if FONT_ANTIALIAS == 0
|
||||
for(row = 0; row < font_p->height_row; row ++) {
|
||||
for(col = 0, col_sub = 7; col < w; col ++, col_sub--) {
|
||||
if(*bitmap_p & (1 << col_sub)) {
|
||||
lv_rpx(pos_p->x + col, pos_p->y + row, mask_p, color);
|
||||
lv_rpx(pos_p->x + col, pos_p->y + row, mask_p, color, opa);
|
||||
}
|
||||
|
||||
if(col_sub == 0) {
|
||||
@@ -99,6 +116,48 @@ void lv_rletter(const point_t * pos_p, const area_t * mask_p,
|
||||
/*Go to the next row*/
|
||||
bitmap_p ++;
|
||||
}
|
||||
#else
|
||||
const uint8_t * map1_p = bitmap_p;
|
||||
const uint8_t * map2_p = bitmap_p + font_p->width_byte;
|
||||
uint8_t px_cnt;
|
||||
uint8_t col_byte_cnt;
|
||||
for(row = 0; row < (font_p->height_row >> 1); row ++) {
|
||||
col_byte_cnt = 0;
|
||||
col_sub = 7;
|
||||
for(col = 0; col < (w >> 1); col ++) {
|
||||
|
||||
px_cnt = 0;
|
||||
if((*map1_p & (1 << col_sub)) != 0) px_cnt++;
|
||||
if((*map2_p & (1 << col_sub)) != 0) px_cnt++;
|
||||
if(col_sub != 0) col_sub --;
|
||||
else {
|
||||
col_sub = 7;
|
||||
col_byte_cnt ++;
|
||||
map1_p ++;
|
||||
map2_p ++;
|
||||
}
|
||||
if((*map1_p & (1 << col_sub)) != 0) px_cnt++;
|
||||
if((*map2_p & (1 << col_sub)) != 0) px_cnt++;
|
||||
if(col_sub != 0) col_sub --;
|
||||
else {
|
||||
col_sub = 7;
|
||||
col_byte_cnt ++;
|
||||
map1_p ++;
|
||||
map2_p ++;
|
||||
}
|
||||
|
||||
|
||||
if(px_cnt != 0) {
|
||||
lv_rpx(pos_p->x + col, pos_p->y + row, mask_p, color_mix(color, COLOR_SILVER, 63 * px_cnt), OPA_COVER);
|
||||
}
|
||||
}
|
||||
|
||||
map1_p += font_p->width_byte;
|
||||
map2_p += font_p->width_byte;
|
||||
map1_p += font_p->width_byte - col_byte_cnt;
|
||||
map2_p += font_p->width_byte - col_byte_cnt;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,11 +190,10 @@ void lv_rmap(const area_t * cords_p, const area_t * mask_p,
|
||||
|
||||
if(transp == false) {
|
||||
cord_t row;
|
||||
cord_t mask_w = area_get_width(&masked_a) - 1;
|
||||
for(row = 0; row < area_get_height(&masked_a); row++) {
|
||||
cord_t col;
|
||||
for(col = 0; col < area_get_width(&masked_a); col ++) {
|
||||
lv_rpx(masked_a.x1 + col, masked_a.y1 + row, mask_p, map_p[col]);
|
||||
}
|
||||
disp_map(masked_a.x1, masked_a.y1 + row, masked_a.x1 + mask_w, masked_a.y1 + row, map_p);
|
||||
|
||||
map_p += map_width;
|
||||
}
|
||||
}else {
|
||||
@@ -145,7 +203,7 @@ void lv_rmap(const area_t * cords_p, const area_t * mask_p,
|
||||
cord_t col;
|
||||
for(col = 0; col < area_get_width(&masked_a); col ++) {
|
||||
if(map_p[col].full != transp_color.full) {
|
||||
lv_rpx(masked_a.x1 + col, masked_a.y1 + row, mask_p, map_p[col]);
|
||||
lv_rpx(masked_a.x1 + col, masked_a.y1 + row, mask_p, map_p[col], opa);
|
||||
}
|
||||
}
|
||||
map_p += map_width;
|
||||
@@ -156,21 +214,3 @@ void lv_rmap(const area_t * cords_p, const area_t * mask_p,
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Put a pixel to the display
|
||||
* @param x x coordinate of the pixel
|
||||
* @param y y coordinate of the pixel
|
||||
* @param mask_p the pixel will be drawn on this area
|
||||
* @param color color of the pixel
|
||||
*/
|
||||
static void lv_rpx(cord_t x, cord_t y, const area_t * mask_p, color_t color)
|
||||
{
|
||||
area_t area;
|
||||
area.x1 = x;
|
||||
area.y1 = y;
|
||||
area.x2 = x;
|
||||
area.y2 = y;
|
||||
|
||||
lv_rfill(&area, mask_p, color, OPA_COVER);
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "misc/others/color.h"
|
||||
#include "../lv_misc/area.h"
|
||||
#include "../lv_misc/font.h"
|
||||
#include "misc/gfx/color.h"
|
||||
#include "misc/gfx/area.h"
|
||||
#include "misc/gfx/font.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -24,6 +24,9 @@
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_rpx(cord_t x, cord_t y, const area_t * mask_p, color_t color, opa_t opa);
|
||||
|
||||
/**
|
||||
* Fill an area on the display
|
||||
* @param cords_p coordinates of the area to fill
|
||||
|
||||
@@ -2,7 +2,15 @@
|
||||
* @file lv_vdraw.c
|
||||
*
|
||||
*/
|
||||
#include "lv_conf.h"
|
||||
|
||||
#include <lv_conf.h>
|
||||
#include <misc/gfx/area.h>
|
||||
#include <misc/gfx/font.h>
|
||||
#include <misc/gfx/color.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#if LV_VDB_SIZE != 0
|
||||
|
||||
#include <stddef.h>
|
||||
@@ -36,10 +44,45 @@
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
|
||||
/**
|
||||
* Put a pixel in the Virtual Display Buffer
|
||||
* @param x pixel x coordinate
|
||||
* @param y pixel y coordinate
|
||||
* @param mask_p fill only on this mask (truncated to VDB area)
|
||||
* @param color pixel color
|
||||
* @param opa opacity of the area (0..255)
|
||||
*/
|
||||
void lv_vpx(cord_t x, cord_t y, const area_t * mask_p, color_t color, opa_t opa)
|
||||
{
|
||||
lv_vdb_t * vdb_p = lv_vdb_get();
|
||||
|
||||
/*Pixel out of the mask*/
|
||||
if(x < mask_p->x1 || x > mask_p->x2 ||
|
||||
y < mask_p->y1 || y > mask_p->y2) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t vdb_width = area_get_width(&vdb_p->area);
|
||||
|
||||
/*Make the coordinates relative to VDB*/
|
||||
x-=vdb_p->area.x1;
|
||||
y-=vdb_p->area.y1;
|
||||
color_t * vdb_px_p = vdb_p->buf + y * vdb_width + x;
|
||||
if(opa == OPA_COVER) {
|
||||
*vdb_px_p = color;
|
||||
}
|
||||
else {
|
||||
*vdb_px_p = color_mix(color,*vdb_px_p, opa);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fill an area in the Virtual Display Buffer
|
||||
* @param cords_p coordinates of the area to fill
|
||||
* @param mask_p fill only o this mask
|
||||
* @param mask_p fill only o this mask (truncated to VDB area)
|
||||
* @param color fill color
|
||||
* @param opa opacity of the area (0..255)
|
||||
*/
|
||||
@@ -58,13 +101,13 @@ void lv_vfill(const area_t * cords_p, const area_t * mask_p,
|
||||
/*If there are common part of the three area then draw to the vdb*/
|
||||
if(union_ok == true) {
|
||||
area_t vdb_rel_a; /*Stores relative coordinates on vdb*/
|
||||
vdb_rel_a.x1 = res_a.x1 - vdb_p->vdb_area.x1;
|
||||
vdb_rel_a.y1 = res_a.y1 - vdb_p->vdb_area.y1;
|
||||
vdb_rel_a.x2 = res_a.x2 - vdb_p->vdb_area.x1;
|
||||
vdb_rel_a.y2 = res_a.y2 - vdb_p->vdb_area.y1;
|
||||
vdb_rel_a.x1 = res_a.x1 - vdb_p->area.x1;
|
||||
vdb_rel_a.y1 = res_a.y1 - vdb_p->area.y1;
|
||||
vdb_rel_a.x2 = res_a.x2 - vdb_p->area.x1;
|
||||
vdb_rel_a.y2 = res_a.y2 - vdb_p->area.y1;
|
||||
|
||||
color_t * vdb_buf_tmp = vdb_p->buf;
|
||||
uint32_t vdb_width = area_get_width(&vdb_p->vdb_area);
|
||||
uint32_t vdb_width = area_get_width(&vdb_p->area);
|
||||
/*Move the vdb_tmp to the first row*/
|
||||
vdb_buf_tmp += vdb_width * vdb_rel_a.y1;
|
||||
|
||||
@@ -74,20 +117,32 @@ void lv_vfill(const area_t * cords_p, const area_t * mask_p,
|
||||
|
||||
/*Run simpler function without opacity*/
|
||||
if(opa == OPA_COVER) {
|
||||
for(row = vdb_rel_a.y1; row <= vdb_rel_a.y2; row++) {
|
||||
for(col = vdb_rel_a.x1; col <= vdb_rel_a.x2; col++) {
|
||||
vdb_buf_tmp[col] = color;
|
||||
}
|
||||
|
||||
/*Fill the first row with 'color'*/
|
||||
for(col = vdb_rel_a.x1; col <= vdb_rel_a.x2; col++) {
|
||||
vdb_buf_tmp[col] = color;
|
||||
}
|
||||
/*Copy the first row to all other rows*/
|
||||
color_t * vdb_buf_first = &vdb_buf_tmp[vdb_rel_a.x1];
|
||||
cord_t copy_size = (vdb_rel_a.x2 - vdb_rel_a.x1 + 1) * sizeof(color_t);
|
||||
vdb_buf_tmp += vdb_width;
|
||||
|
||||
for(row = vdb_rel_a.y1 + 1; row <= vdb_rel_a.y2; row++) {
|
||||
memcpy(&vdb_buf_tmp[vdb_rel_a.x1], vdb_buf_first, copy_size);
|
||||
vdb_buf_tmp += vdb_width;
|
||||
}
|
||||
}
|
||||
/*Calculate the alpha too*/
|
||||
/*Calculate with alpha too*/
|
||||
else {
|
||||
color_t bg_tmp = COLOR_BLACK;
|
||||
color_t opa_tmp = color_mix(color, bg_tmp, opa);
|
||||
for(row = vdb_rel_a.y1; row <= vdb_rel_a.y2; row++) {
|
||||
for(col = vdb_rel_a.x1; col <= vdb_rel_a.x2; col++) {
|
||||
color_t c = color_mix(color, vdb_buf_tmp[col], opa);
|
||||
vdb_buf_tmp[col] = c;
|
||||
/*If the bg color changed recalculate the result color*/
|
||||
if(vdb_buf_tmp[col].full != bg_tmp.full) {
|
||||
bg_tmp = vdb_buf_tmp[col];
|
||||
opa_tmp = color_mix(color, bg_tmp, opa);
|
||||
}
|
||||
vdb_buf_tmp[col] = opa_tmp;
|
||||
}
|
||||
vdb_buf_tmp += vdb_width;
|
||||
}
|
||||
@@ -98,7 +153,7 @@ void lv_vfill(const area_t * cords_p, const area_t * mask_p,
|
||||
/**
|
||||
* Draw a letter in the Virtual Display Buffer
|
||||
* @param pos_p left-top coordinate of the latter
|
||||
* @param mask_p the letter will be drawn only on this area
|
||||
* @param mask_p the letter will be drawn only on this area (truncated to VDB area)
|
||||
* @param font_p pointer to font
|
||||
* @param letter a letter to draw
|
||||
* @param color color of letter
|
||||
@@ -122,27 +177,76 @@ void lv_vletter(const point_t * pos_p, const area_t * mask_p,
|
||||
pos_p->y + letter_h < mask_p->y1 || pos_p->y > mask_p->y2) return;
|
||||
|
||||
lv_vdb_t * vdb_p = lv_vdb_get();
|
||||
cord_t vdb_width = area_get_width(&vdb_p->vdb_area);
|
||||
cord_t vdb_width = area_get_width(&vdb_p->area);
|
||||
color_t * vdb_buf_tmp = vdb_p->buf;
|
||||
cord_t col, row;
|
||||
uint8_t col_bit;
|
||||
uint8_t col_byte_cnt;
|
||||
|
||||
/* Calculate the col/row start/end on the map
|
||||
* If font anti alaiassing is enabled use the reduced letter sizes*/
|
||||
cord_t col_start = pos_p->x > mask_p->x1 ? 0 : mask_p->x1 - pos_p->x;
|
||||
cord_t col_end = pos_p->x + letter_w < mask_p->x2 ? letter_w : mask_p->x2 - pos_p->x + 1;
|
||||
cord_t col_end = pos_p->x + (letter_w >> FONT_ANTIALIAS) < mask_p->x2 ? (letter_w >> FONT_ANTIALIAS) : mask_p->x2 - pos_p->x + 1;
|
||||
cord_t row_start = pos_p->y > mask_p->y1 ? 0 : mask_p->y1 - pos_p->y;
|
||||
cord_t row_end = pos_p->y + letter_h < mask_p->y2 ? letter_h : mask_p->y2 - pos_p->y + 1;
|
||||
cord_t row_end = pos_p->y + (letter_h >> FONT_ANTIALIAS) < mask_p->y2 ? (letter_h >> FONT_ANTIALIAS) : mask_p->y2 - pos_p->y + 1;
|
||||
|
||||
/*Set a pointer on VDB to the first pixel of the letter*/
|
||||
vdb_buf_tmp += ((pos_p->y - vdb_p->vdb_area.y1) * vdb_width)
|
||||
+ pos_p->x - vdb_p->vdb_area.x1;
|
||||
vdb_buf_tmp += ((pos_p->y - vdb_p->area.y1) * vdb_width)
|
||||
+ pos_p->x - vdb_p->area.x1;
|
||||
|
||||
/*If the letter is partially out of mask the move there on VDB*/
|
||||
vdb_buf_tmp += (row_start * vdb_width) + col_start;
|
||||
|
||||
/*Move on the map too*/
|
||||
map_p += (row_start * font_p->width_byte) + (col_start>>3);
|
||||
map_p += ((row_start << FONT_ANTIALIAS) * font_p->width_byte) + ((col_start << FONT_ANTIALIAS) >> 3);
|
||||
|
||||
#if FONT_ANTIALIAS != 0
|
||||
opa_t opa_tmp = opa;
|
||||
if(opa_tmp != OPA_COVER) opa_tmp = opa_tmp >> 2; /*Opacity per pixel (used when sum the pixels)*/
|
||||
const uint8_t * map1_p = map_p;
|
||||
const uint8_t * map2_p = map_p + font_p->width_byte;
|
||||
uint8_t px_cnt;
|
||||
for(row = row_start; row < row_end; row ++) {
|
||||
col_byte_cnt = 0;
|
||||
col_bit = 7 - ((col_start << FONT_ANTIALIAS) % 8);
|
||||
for(col = col_start; col < col_end; col ++) {
|
||||
|
||||
px_cnt = 0;
|
||||
if((*map1_p & (1 << col_bit)) != 0) px_cnt++;
|
||||
if((*map2_p & (1 << col_bit)) != 0) px_cnt++;
|
||||
if(col_bit != 0) col_bit --;
|
||||
else {
|
||||
col_bit = 7;
|
||||
col_byte_cnt ++;
|
||||
map1_p ++;
|
||||
map2_p ++;
|
||||
}
|
||||
if((*map1_p & (1 << col_bit)) != 0) px_cnt++;
|
||||
if((*map2_p & (1 << col_bit)) != 0) px_cnt++;
|
||||
if(col_bit != 0) col_bit --;
|
||||
else {
|
||||
col_bit = 7;
|
||||
col_byte_cnt ++;
|
||||
map1_p ++;
|
||||
map2_p ++;
|
||||
}
|
||||
|
||||
|
||||
if(px_cnt != 0) {
|
||||
if(opa == OPA_COVER) *vdb_buf_tmp = color_mix(color, *vdb_buf_tmp, 63*px_cnt);
|
||||
else *vdb_buf_tmp = color_mix(color, *vdb_buf_tmp, opa_tmp * px_cnt);
|
||||
}
|
||||
|
||||
vdb_buf_tmp++;
|
||||
}
|
||||
|
||||
map1_p += font_p->width_byte;
|
||||
map2_p += font_p->width_byte;
|
||||
map1_p += font_p->width_byte - col_byte_cnt;
|
||||
map2_p += font_p->width_byte - col_byte_cnt;
|
||||
vdb_buf_tmp += vdb_width - ((col_end) - (col_start)); /*Next row in VDB*/
|
||||
}
|
||||
#else
|
||||
for(row = row_start; row < row_end; row ++) {
|
||||
col_byte_cnt = 0;
|
||||
col_bit = 7 - (col_start % 8);
|
||||
@@ -152,9 +256,9 @@ void lv_vletter(const point_t * pos_p, const area_t * mask_p,
|
||||
if(opa == OPA_COVER) *vdb_buf_tmp = color;
|
||||
else *vdb_buf_tmp = color_mix(color, *vdb_buf_tmp, opa);
|
||||
}
|
||||
vdb_buf_tmp++;
|
||||
|
||||
/*Use a col. more times depending on LV_UPSCALE_FONT*/
|
||||
vdb_buf_tmp++;
|
||||
|
||||
if(col_bit != 0) col_bit --;
|
||||
else {
|
||||
col_bit = 7;
|
||||
@@ -166,12 +270,13 @@ void lv_vletter(const point_t * pos_p, const area_t * mask_p,
|
||||
map_p += font_p->width_byte - col_byte_cnt;
|
||||
vdb_buf_tmp += vdb_width - (col_end - col_start); /*Next row in VDB*/
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw a color map to the display
|
||||
* @param cords_p coordinates the color map
|
||||
* @param mask_p the map will drawn only on this area
|
||||
* @param mask_p the map will drawn only on this area (truncated to VDB area)
|
||||
* @param map_p pointer to a color_t array
|
||||
* @param opa opacity of the map (ignored, only for compatibility with lv_vmap)
|
||||
* @param transp true: enable transparency of LV_IMG_COLOR_TRANSP color pixels
|
||||
@@ -208,43 +313,19 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p,
|
||||
}
|
||||
|
||||
/*Stores coordinates relative to the act vdb*/
|
||||
masked_a.x1 = masked_a.x1 - vdb_p->vdb_area.x1;
|
||||
masked_a.y1 = masked_a.y1 - vdb_p->vdb_area.y1;
|
||||
masked_a.x2 = masked_a.x2 - vdb_p->vdb_area.x1;
|
||||
masked_a.y2 = masked_a.y2 - vdb_p->vdb_area.y1;
|
||||
masked_a.x1 = masked_a.x1 - vdb_p->area.x1;
|
||||
masked_a.y1 = masked_a.y1 - vdb_p->area.y1;
|
||||
masked_a.x2 = masked_a.x2 - vdb_p->area.x1;
|
||||
masked_a.y2 = masked_a.y2 - vdb_p->area.y1;
|
||||
|
||||
cord_t vdb_width = area_get_width(&vdb_p->vdb_area);
|
||||
cord_t vdb_width = area_get_width(&vdb_p->area);
|
||||
color_t * vdb_buf_tmp = vdb_p->buf;
|
||||
vdb_buf_tmp += (uint32_t) vdb_width * masked_a.y1; /*Move to the first row*/
|
||||
|
||||
map_p -= (masked_a.x1 >> ds_shift);
|
||||
|
||||
if(upscale != false) {
|
||||
cord_t row;
|
||||
cord_t col;
|
||||
color_t transp_color = LV_COLOR_TRANSP;
|
||||
color_t color_tmp;
|
||||
color_t prev_color = COLOR_BLACK;
|
||||
cord_t map_col;
|
||||
|
||||
color_tmp = color_mix(recolor, prev_color, recolor_opa);
|
||||
for(row = masked_a.y1; row <= masked_a.y2; row++) {
|
||||
for(col = masked_a.x1; col <= masked_a.x2; col ++) {
|
||||
map_col = col >> 1;
|
||||
|
||||
if(map_p[map_col].full != prev_color.full) {
|
||||
prev_color.full = map_p[map_col].full;
|
||||
color_tmp = color_mix(recolor, prev_color, recolor_opa);
|
||||
}
|
||||
if(transp == false || map_p[map_col].full != transp_color.full) {
|
||||
vdb_buf_tmp[col] = color_mix( color_tmp, vdb_buf_tmp[col], opa);
|
||||
}
|
||||
}
|
||||
if((row & 0x1) != 0) map_p += map_width; /*Next row on the map*/
|
||||
vdb_buf_tmp += vdb_width ; /*Next row on the VDB*/
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*No upscalse*/
|
||||
if(upscale == false) {
|
||||
if(transp == false) { /*Simply copy the pixels to the VDB*/
|
||||
cord_t row;
|
||||
|
||||
@@ -256,7 +337,7 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p,
|
||||
map_p += map_width; /*Next row on the map*/
|
||||
vdb_buf_tmp += vdb_width; /*Next row on the VDB*/
|
||||
}
|
||||
} else {
|
||||
} else { /*with opacity*/
|
||||
cord_t col;
|
||||
for(row = masked_a.y1; row <= masked_a.y2; row++) {
|
||||
for(col = masked_a.x1; col <= masked_a.x2; col ++) {
|
||||
@@ -267,9 +348,11 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p,
|
||||
}
|
||||
}
|
||||
|
||||
/*To recolor draw simply a rectangle above the image*/
|
||||
#if LV_VDB_SIZE != 0
|
||||
lv_vfill(cords_p, mask_p, recolor, recolor_opa);
|
||||
/*To recolor draw simply a rectangle above the image*/
|
||||
if(recolor_opa != OPA_TRANSP) {
|
||||
lv_vfill(cords_p, mask_p, recolor, recolor_opa);
|
||||
}
|
||||
#endif
|
||||
} else { /*transp == true: Check all pixels */
|
||||
cord_t row;
|
||||
@@ -285,8 +368,8 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p,
|
||||
}
|
||||
}
|
||||
|
||||
map_p += map_width; /*Next row on the map*/
|
||||
vdb_buf_tmp += vdb_width; /*Next row on the VDB*/
|
||||
map_p += map_width; /*Next row on the map*/
|
||||
vdb_buf_tmp += vdb_width; /*Next row on the VDB*/
|
||||
}
|
||||
} else {
|
||||
for(row = masked_a.y1; row <= masked_a.y2; row++) {
|
||||
@@ -296,8 +379,8 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p,
|
||||
}
|
||||
}
|
||||
|
||||
map_p += map_width; /*Next row on the map*/
|
||||
vdb_buf_tmp += vdb_width; /*Next row on the VDB*/
|
||||
map_p += map_width; /*Next row on the map*/
|
||||
vdb_buf_tmp += vdb_width; /*Next row on the VDB*/
|
||||
}
|
||||
}
|
||||
} else { /*Recolor needed*/
|
||||
@@ -330,6 +413,64 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p,
|
||||
}
|
||||
}
|
||||
}
|
||||
/*Upscalse*/
|
||||
else {
|
||||
cord_t row;
|
||||
cord_t col;
|
||||
color_t transp_color = LV_COLOR_TRANSP;
|
||||
color_t color_tmp;
|
||||
color_t prev_color = COLOR_BLACK;
|
||||
cord_t map_col;
|
||||
|
||||
/*The most simple case (but upscale): 0 opacity, no recolor, no transp. pixels*/
|
||||
if(transp == false && opa == OPA_COVER && recolor_opa == OPA_TRANSP) {
|
||||
cord_t map_col_start = masked_a.x1 >> 1;
|
||||
cord_t map_col_end = masked_a.x2 >> 1;
|
||||
cord_t map_col;
|
||||
cord_t vdb_col = masked_a.x1;
|
||||
for(row = masked_a.y1; row <= masked_a.y2; row++) {
|
||||
map_col_start = masked_a.x1 >> 1;
|
||||
map_col_end = masked_a.x2 >> 1;
|
||||
vdb_col = masked_a.x1;
|
||||
for(map_col = map_col_start; map_col <= map_col_end; map_col ++, vdb_col += 2) {
|
||||
vdb_buf_tmp[vdb_col].full = map_p[map_col].full;
|
||||
vdb_buf_tmp[vdb_col + 1].full = map_p[map_col].full;
|
||||
}
|
||||
if((row & 0x1) != 0) map_p += map_width; /*Next row on the map*/
|
||||
vdb_buf_tmp += vdb_width ; /*Next row on the VDB*/
|
||||
}
|
||||
}
|
||||
/*Handle other cases*/
|
||||
else {
|
||||
color_tmp = color_mix(recolor, prev_color, recolor_opa);
|
||||
for(row = masked_a.y1; row <= masked_a.y2; row++) {
|
||||
for(col = masked_a.x1; col <= masked_a.x2; col ++) {
|
||||
map_col = col >> 1;
|
||||
|
||||
/*Handle recoloring*/
|
||||
if(recolor_opa == OPA_TRANSP) {
|
||||
color_tmp.full = map_p[map_col].full;
|
||||
} else {
|
||||
if(map_p[map_col].full != prev_color.full) {
|
||||
prev_color.full = map_p[map_col].full;
|
||||
color_tmp = color_mix(recolor, prev_color, recolor_opa);
|
||||
}
|
||||
}
|
||||
/*Put the NOT transparent pixels*/
|
||||
if(transp == false || map_p[map_col].full != transp_color.full) {
|
||||
/*Handle opacity*/
|
||||
if(opa == OPA_COVER) {
|
||||
vdb_buf_tmp[col] = color_tmp;
|
||||
} else {
|
||||
vdb_buf_tmp[col] = color_mix( color_tmp, vdb_buf_tmp[col], opa);
|
||||
}
|
||||
}
|
||||
}
|
||||
if((row & 0x1) != 0) map_p += map_width; /*Next row on the map*/
|
||||
vdb_buf_tmp += vdb_width ; /*Next row on the VDB*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
|
||||
#if LV_VDB_SIZE != 0
|
||||
|
||||
#include "misc/others/color.h"
|
||||
#include "../lv_misc/area.h"
|
||||
#include "../lv_misc/font.h"
|
||||
#include "misc/gfx/color.h"
|
||||
#include "misc/gfx/area.h"
|
||||
#include "misc/gfx/font.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -29,6 +29,7 @@
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_vpx(cord_t x, cord_t y, const area_t * mask_p, color_t color, opa_t opa);
|
||||
/**
|
||||
* Fill an area in the Virtual Display Buffer
|
||||
* @param cords_p coordinates of the area to fill
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_CLOSE != 0 && LV_APP_USE_INTERNAL_ICONS == 1
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
const color_int_t img_close [] = { /*Width = 14, Height = 15*/
|
||||
14, /*Width*/
|
||||
15, /*Heigth*/
|
||||
16, /*Color depth = 16*/
|
||||
1, /*Flags: Transp = 1*/
|
||||
2016, 6339, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 4258, 2016,
|
||||
6371, 0, 32, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2113, 0, 4226,
|
||||
10597, 0, 0, 0, 2016, 2016, 2016, 2016, 2016, 2016, 32, 0, 0, 8452,
|
||||
2016, 10597, 0, 0, 0, 2016, 2016, 2016, 2016, 32, 0, 0, 8452, 2016,
|
||||
2016, 2016, 10597, 0, 0, 0, 2016, 2016, 32, 0, 0, 8452, 2016, 2016,
|
||||
2016, 2016, 2016, 10565, 0, 0, 32, 2113, 0, 0, 6339, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 10597, 0, 0, 0, 0, 8452, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 0, 0, 0, 0, 35953, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 32, 0, 0, 0, 0, 0, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2113, 0, 0, 6339, 8484, 0, 0, 32, 2016, 2016, 2016,
|
||||
2016, 2016, 32, 0, 0, 8452, 2016, 2016, 10597, 0, 0, 0, 2016, 2016,
|
||||
2016, 32, 0, 0, 8452, 2016, 2016, 2016, 2016, 10597, 0, 0, 0, 2016,
|
||||
2113, 0, 0, 6339, 2016, 2016, 2016, 2016, 2016, 2016, 10565, 0, 0, 32,
|
||||
19049, 0, 8452, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12678, 0, 14823,
|
||||
2016, 23275, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 23243, 2016,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,26 +0,0 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_DOWN != 0 && LV_APP_USE_INTERNAL_ICONS == 1
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
const color_int_t img_down [] = { /*Width = 15, Height = 10*/
|
||||
15, /*Width*/
|
||||
10, /*Heigth*/
|
||||
16, /*Color depth = 16*/
|
||||
1, /*Flags: Transp = 1*/
|
||||
2016, 2016, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 33840, 2016, 2016,
|
||||
2016, 12710, 0, 19049, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 4226, 0, 35953, 2016,
|
||||
14791, 0, 0, 0, 19049, 2016, 2016, 2016, 2016, 2016, 4226, 0, 0, 0, 35953,
|
||||
10565, 0, 0, 0, 0, 16936, 2016, 2016, 2016, 2145, 0, 0, 0, 0, 29614,
|
||||
2016, 8484, 0, 0, 0, 0, 19049, 2016, 4226, 0, 0, 0, 0, 29582, 2016,
|
||||
2016, 2016, 10565, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31695, 2016, 2016,
|
||||
2016, 2016, 2016, 8484, 0, 0, 0, 0, 0, 0, 0, 29582, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 8484, 0, 0, 0, 0, 0, 29582, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 8484, 0, 0, 0, 29582, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 8484, 0, 29582, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,30 +0,0 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_DRIVER != 0 && LV_APP_USE_INTERNAL_ICONS == 1
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
const color_int_t img_driver [] = { /*Width = 16, Height = 14*/
|
||||
16, /*Width*/
|
||||
14, /*Heigth*/
|
||||
16, /*Color depth = 16*/
|
||||
1, /*Flags: Transp = 1*/
|
||||
2016, 2016, 2016, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33808, 2016, 2016,
|
||||
2016, 2016, 14823, 2113, 44373, 44373, 44373, 44373, 44373, 44373, 44373, 44373, 6339, 8452, 2016, 2016,
|
||||
2016, 2016, 0, 23275, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 27469, 0, 2016, 2016,
|
||||
2016, 29614, 0, 46518, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 48599, 0, 23275, 2016,
|
||||
2016, 4258, 4258, 65503, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65503, 4226, 2113, 2016,
|
||||
2016, 0, 27501, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 23243, 0, 40147,
|
||||
21130, 0, 50744, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 44373, 0, 12710,
|
||||
4226, 0, 21162, 21162, 21162, 57083, 65535, 65535, 65535, 65535, 61309, 21162, 21162, 19017, 0, 0,
|
||||
2145, 0, 0, 0, 0, 23275, 65535, 65535, 65535, 65535, 31695, 0, 0, 0, 0, 0,
|
||||
2145, 0, 0, 0, 0, 32, 21162, 21162, 21162, 21162, 2145, 0, 0, 0, 0, 0,
|
||||
2145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
2145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
2145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,32 +0,0 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_FILE != 0 && LV_APP_USE_INTERNAL_ICONS == 1
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
const color_int_t img_file [] = { /*Width = 12, Height = 16*/
|
||||
12, /*Width*/
|
||||
16, /*Heigth*/
|
||||
16, /*Color depth = 16*/
|
||||
1, /*Flags: Transp = 1*/
|
||||
23275, 21162, 21162, 21162, 21162, 21162, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2145, 0, 0, 0, 0, 0, 2113, 2016, 2016, 2016, 2016, 2016,
|
||||
2145, 0, 42260, 44373, 44373, 2113, 12678, 2145, 2016, 2016, 2016, 2016,
|
||||
2145, 0, 63390, 65535, 65535, 2145, 59196, 16904, 2113, 2016, 2016, 2016,
|
||||
2145, 0, 63390, 65535, 65535, 2145, 63390, 63422, 16904, 2113, 2016, 2016,
|
||||
2145, 0, 63390, 65535, 65535, 2145, 63390, 65535, 63422, 16904, 2113, 2016,
|
||||
2145, 0, 63390, 65535, 65535, 2145, 21130, 21162, 21162, 19017, 0, 2145,
|
||||
2145, 0, 63390, 65535, 65535, 44405, 44373, 44373, 44373, 44373, 2113, 0,
|
||||
2145, 0, 63390, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 2145, 0,
|
||||
2145, 0, 63390, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 2145, 0,
|
||||
2145, 0, 63390, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 2145, 0,
|
||||
2145, 0, 63390, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 2145, 0,
|
||||
2145, 0, 63390, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 2145, 0,
|
||||
2145, 0, 63390, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 2145, 0,
|
||||
2145, 0, 21130, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 32, 0,
|
||||
2145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,28 +0,0 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_FOLDER != 0 && LV_APP_USE_INTERNAL_ICONS == 1
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
const color_int_t img_folder [] = { /*Width = 16, Height = 12*/
|
||||
16, /*Width*/
|
||||
12, /*Heigth*/
|
||||
16, /*Color depth = 16*/
|
||||
1, /*Flags: Transp = 1*/
|
||||
2016, 2016, 40147, 21162, 21162, 21162, 35921, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 23275, 2113, 0, 0, 0, 0, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 2016,
|
||||
2016, 2145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
25388, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162, 21162,
|
||||
12678, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6339,
|
||||
21130, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14791,
|
||||
29582, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23243,
|
||||
38034, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31695,
|
||||
2016, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 38066,
|
||||
2016, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2016,
|
||||
2016, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2016,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,31 +0,0 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_LEFT != 0 && LV_APP_USE_INTERNAL_ICONS == 1
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
const color_int_t img_left [] = { /*Width = 10, Height = 15*/
|
||||
10, /*Width*/
|
||||
15, /*Heigth*/
|
||||
16, /*Color depth = 16*/
|
||||
1, /*Flags: Transp = 1*/
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 27501, 21130, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 29582, 0, 0, 21130, 2016,
|
||||
2016, 2016, 2016, 2016, 31695, 0, 0, 0, 0, 27469,
|
||||
2016, 2016, 2016, 29582, 0, 0, 0, 0, 4226, 2016,
|
||||
2016, 2016, 29582, 0, 0, 0, 0, 4226, 2016, 2016,
|
||||
2016, 29582, 0, 0, 0, 0, 4226, 2016, 2016, 2016,
|
||||
29582, 0, 0, 0, 0, 4226, 2016, 2016, 2016, 2016,
|
||||
0, 0, 0, 0, 0, 2016, 2016, 2016, 2016, 2016,
|
||||
19049, 0, 0, 0, 0, 8484, 2016, 2016, 2016, 2016,
|
||||
2016, 19049, 0, 0, 0, 0, 8484, 2016, 2016, 2016,
|
||||
2016, 2016, 21130, 0, 0, 0, 0, 8484, 2016, 2016,
|
||||
2016, 2016, 2016, 21130, 0, 0, 0, 0, 8484, 2016,
|
||||
2016, 2016, 2016, 2016, 19017, 0, 0, 0, 0, 23243,
|
||||
2016, 2016, 2016, 2016, 2016, 21130, 0, 0, 12710, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 21130, 14791, 2016, 2016,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,28 +0,0 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_OK != 0 && LV_APP_USE_INTERNAL_ICONS == 1
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
const color_int_t img_ok [] = { /*Width = 16, Height = 12*/
|
||||
16, /*Width*/
|
||||
12, /*Heigth*/
|
||||
16, /*Color depth = 16*/
|
||||
1, /*Flags: Transp = 1*/
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 32, 2113, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2113, 0, 0, 10597,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 32, 0, 0, 8452, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 32, 0, 0, 8452, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 32, 0, 0, 8452, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2113, 0, 0, 6371, 2016, 2016, 2016, 2016,
|
||||
2016, 4258, 0, 40147, 2016, 2016, 2016, 32, 0, 0, 8452, 2016, 2016, 2016, 2016, 2016,
|
||||
16936, 0, 0, 32, 2016, 2016, 2113, 0, 0, 6371, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 10565, 0, 0, 32, 2113, 0, 0, 6371, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 12710, 0, 0, 0, 0, 8452, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 12710, 0, 0, 8484, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 12710, 8484, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,31 +0,0 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_RIGHT != 0 && LV_APP_USE_INTERNAL_ICONS == 1
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
const color_int_t img_right [] = { /*Width = 10, Height = 15*/
|
||||
10, /*Width*/
|
||||
15, /*Heigth*/
|
||||
16, /*Color depth = 16*/
|
||||
1, /*Flags: Transp = 1*/
|
||||
2016, 2016, 21130, 27501, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 21130, 0, 0, 29582, 2016, 2016, 2016, 2016, 2016,
|
||||
27469, 0, 0, 0, 0, 31695, 2016, 2016, 2016, 2016,
|
||||
2016, 4226, 0, 0, 0, 0, 29582, 2016, 2016, 2016,
|
||||
2016, 2016, 4226, 0, 0, 0, 0, 29582, 2016, 2016,
|
||||
2016, 2016, 2016, 4226, 0, 0, 0, 0, 29582, 2016,
|
||||
2016, 2016, 2016, 2016, 4226, 0, 0, 0, 0, 29582,
|
||||
2016, 2016, 2016, 2016, 2016, 0, 0, 0, 0, 0,
|
||||
2016, 2016, 2016, 2016, 8484, 0, 0, 0, 0, 19049,
|
||||
2016, 2016, 2016, 8484, 0, 0, 0, 0, 19049, 2016,
|
||||
2016, 2016, 8484, 0, 0, 0, 0, 21130, 2016, 2016,
|
||||
2016, 8484, 0, 0, 0, 0, 21130, 2016, 2016, 2016,
|
||||
23243, 0, 0, 0, 0, 19017, 2016, 2016, 2016, 2016,
|
||||
2016, 12710, 0, 0, 21130, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 14791, 21130, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,26 +0,0 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_UP != 0 && LV_APP_USE_INTERNAL_ICONS == 1
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
const color_int_t img_up [] = { /*Width = 15, Height = 10*/
|
||||
15, /*Width*/
|
||||
10, /*Heigth*/
|
||||
16, /*Color depth = 16*/
|
||||
1, /*Flags: Transp = 1*/
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 8484, 0, 29582, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 8484, 0, 0, 0, 29582, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 8484, 0, 0, 0, 0, 0, 29582, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 8484, 0, 0, 0, 0, 0, 0, 0, 29582, 2016, 2016, 2016,
|
||||
2016, 2016, 10565, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31695, 2016, 2016,
|
||||
2016, 8484, 0, 0, 0, 0, 19049, 2016, 4226, 0, 0, 0, 0, 29582, 2016,
|
||||
10565, 0, 0, 0, 0, 16936, 2016, 2016, 2016, 2145, 0, 0, 0, 0, 29614,
|
||||
14791, 0, 0, 0, 19049, 2016, 2016, 2016, 2016, 2016, 4226, 0, 0, 0, 35953,
|
||||
2016, 12710, 0, 19049, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 4226, 0, 35953, 2016,
|
||||
2016, 2016, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 33840, 2016, 2016,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,49 +0,0 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_CLOSE != 0 && LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
const color_int_t img_close [] = { /*Width = 35, Height = 33*/
|
||||
35, /*Width*/
|
||||
33, /*Heigth*/
|
||||
16, /*Color depth = 16*/
|
||||
1, /*Flags: Transp = 1*/
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 25356, 21130, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 21162, 23243, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 33808, 6371, 2145, 21162, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 25388, 4226, 4258, 29614, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 25388, 10565, 32, 0, 2145, 16936, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 21130, 4258, 0, 0, 6371, 23243, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 14791, 0, 0, 0, 0, 4226, 23275, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29582, 6339, 0, 0, 0, 0, 10597, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 16904, 32, 0, 0, 0, 0, 4226, 16936, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 19049, 4258, 32, 0, 0, 0, 0, 12710, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 31695, 14791, 4226, 0, 0, 0, 0, 2145, 21162, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 25388, 4226, 0, 0, 0, 0, 2145, 10597, 27501, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 14791, 32, 0, 0, 0, 0, 2145, 16904, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 19049, 4258, 0, 0, 0, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 31727, 14791, 4226, 0, 0, 0, 0, 2145, 21162, 2016, 2016, 2016, 2016, 2016, 2016, 25388, 4258, 0, 0, 0, 0, 2145, 10597, 29582, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 14791, 32, 0, 0, 0, 0, 2145, 16904, 2016, 2016, 2016, 2016, 19049, 4226, 0, 0, 0, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 31727, 14791, 4226, 0, 0, 0, 0, 4226, 23275, 2016, 2016, 27501, 4258, 0, 0, 0, 0, 2113, 10597, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12710, 0, 0, 0, 0, 32, 6339, 10565, 10597, 8452, 32, 0, 0, 0, 0, 10565, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31695, 12710, 4226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 10565, 27469, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 2113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12710, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29614, 12678, 2145, 0, 0, 0, 0, 0, 0, 2113, 8452, 25388, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29614, 6371, 0, 0, 0, 0, 0, 0, 4258, 23275, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 27501, 6339, 0, 0, 0, 0, 0, 0, 4258, 23243, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 19049, 4258, 32, 0, 0, 0, 0, 0, 0, 0, 4226, 16904, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 25388, 4258, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4226, 23243, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 21130, 4258, 0, 0, 0, 0, 32, 2113, 4226, 2145, 0, 0, 0, 0, 2145, 16936, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29582, 6339, 0, 0, 0, 0, 2145, 12710, 19049, 21162, 16904, 4258, 0, 0, 0, 0, 4226, 23275, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 19049, 4258, 32, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 14791, 32, 0, 0, 0, 0, 4226, 16936, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 25388, 4226, 0, 0, 0, 0, 2145, 10597, 29582, 2016, 2016, 2016, 2016, 31727, 14791, 4226, 0, 0, 0, 0, 2145, 21162, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 19017, 4226, 0, 0, 0, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14791, 32, 0, 0, 0, 0, 2145, 16904, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 25388, 4226, 0, 0, 0, 0, 2113, 10597, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31727, 14791, 4226, 0, 0, 0, 0, 2145, 21162, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 19017, 4226, 0, 0, 0, 0, 0, 10565, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12710, 0, 0, 0, 0, 0, 2113, 14823, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 12678, 0, 0, 0, 0, 2145, 10565, 27469, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31695, 14791, 4226, 0, 0, 0, 0, 8484, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 23243, 6339, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 14823, 2113, 0, 0, 2113, 19049, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 21162, 6371, 4226, 10597, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 33808, 14823, 4258, 4258, 16936, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 21162, 19017, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 19049, 19049, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,36 +0,0 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_DOWN != 0 && LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
const color_int_t img_down [] = { /*Width = 29, Height = 20*/
|
||||
29, /*Width*/
|
||||
20, /*Heigth*/
|
||||
16, /*Color depth = 16*/
|
||||
1, /*Flags: Transp = 1*/
|
||||
2016, 2016, 2016, 2016, 23243, 23275, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 25388, 31695, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 16904, 4258, 6371, 21162, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 23275, 8452, 4226, 12678, 2016, 2016, 2016,
|
||||
2016, 2016, 16904, 2113, 0, 0, 6339, 21162, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31727, 8452, 0, 0, 2113, 19017, 2016, 2016,
|
||||
33808, 16904, 4258, 0, 0, 0, 0, 6371, 21162, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 25356, 8452, 32, 0, 0, 0, 2113, 12710, 2016,
|
||||
19049, 2145, 0, 0, 0, 0, 0, 0, 6339, 21162, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31727, 8452, 0, 0, 0, 0, 0, 0, 2145, 23243,
|
||||
16936, 32, 0, 0, 0, 0, 0, 0, 0, 6371, 19049, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 23243, 6371, 32, 0, 0, 0, 0, 0, 0, 2113, 19049,
|
||||
29582, 12710, 2145, 0, 0, 0, 0, 0, 0, 0, 4258, 19049, 2016, 2016, 2016, 2016, 2016, 31695, 6371, 0, 0, 0, 0, 0, 0, 0, 32, 10597, 29582,
|
||||
2016, 2016, 12678, 0, 0, 0, 0, 0, 0, 0, 0, 6371, 23243, 2016, 2016, 2016, 25356, 8452, 32, 0, 0, 0, 0, 0, 0, 32, 12678, 29582, 2016,
|
||||
2016, 2016, 29614, 12710, 4226, 0, 0, 0, 0, 0, 0, 32, 8452, 19049, 2016, 2016, 8484, 0, 0, 0, 0, 0, 0, 0, 2113, 10597, 29614, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 14791, 32, 0, 0, 0, 0, 0, 0, 32, 4226, 8484, 8452, 2113, 0, 0, 0, 0, 0, 0, 2113, 14791, 31695, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 31695, 12710, 4226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 10597, 31695, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 12710, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 12678, 29614, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 29614, 12710, 2145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 10597, 29614, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12710, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 12710, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29614, 12710, 2145, 0, 0, 0, 0, 0, 0, 0, 32, 10597, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12710, 0, 0, 0, 0, 0, 0, 32, 12710, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29614, 12710, 2145, 0, 0, 0, 32, 10597, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12710, 0, 0, 0, 12710, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29614, 14791, 6371, 12678, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31727, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,45 +0,0 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_DRIVER != 0 && LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
const color_int_t img_driver [] = { /*Width = 32, Height = 29*/
|
||||
32, /*Width*/
|
||||
29, /*Heigth*/
|
||||
16, /*Color depth = 16*/
|
||||
1, /*Flags: Transp = 1*/
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 29614, 31695, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31695, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 23243, 10597, 12678, 12678, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12678, 10597, 21162, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 10597, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8484, 29614, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 23275, 4226, 0, 4226, 6371, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6371, 4226, 0, 2145, 16936, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 31727, 12678, 32, 4258, 25356, 35921, 33808, 33808, 33808, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 33808, 35921, 25388, 8452, 2113, 6371, 25356, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 21162, 4258, 2145, 14823, 42260, 54938, 52825, 50744, 50744, 50744, 50744, 50744, 50744, 50744, 50744, 50744, 50744, 52825, 54938, 44373, 19017, 4258, 32, 16904, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 12678, 0, 10565, 27501, 54938, 65535, 63422, 63390, 63390, 63390, 63390, 63390, 63390, 63390, 63390, 63390, 63390, 63422, 65535, 54970, 31695, 12710, 0, 10565, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 6339, 0, 19017, 40147, 61277, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 61309, 42292, 21162, 2113, 4258, 31695, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 25388, 2145, 4226, 29614, 50712, 63390, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 63390, 50744, 31727, 4258, 32, 19049, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 14791, 0, 8484, 40179, 59196, 65503, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65503, 59196, 40179, 8484, 0, 8484, 27501, 2016, 2016,
|
||||
2016, 2016, 21162, 4226, 0, 14791, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 48631, 12710, 0, 0, 16936, 2016, 2016,
|
||||
2016, 2016, 12710, 0, 2145, 21162, 54970, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 19049, 32, 0, 10565, 2016, 2016,
|
||||
2016, 2016, 8452, 0, 12710, 31727, 57083, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 57051, 29582, 8484, 0, 6371, 2016, 2016,
|
||||
2016, 29582, 4226, 2145, 25356, 44373, 61309, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 61277, 38066, 19049, 2113, 2145, 23243, 2016,
|
||||
2016, 16936, 32, 6371, 38034, 57083, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65503, 50712, 29614, 6339, 0, 10597, 29614,
|
||||
27469, 6371, 0, 8452, 35953, 52857, 57051, 59164, 57083, 59196, 63422, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65503, 59196, 57083, 59164, 54970, 46518, 29614, 6371, 0, 2113, 21130,
|
||||
19017, 0, 0, 4258, 23243, 31727, 31727, 31727, 29614, 38066, 54970, 65503, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 59164, 38066, 29614, 31727, 31695, 29582, 19049, 4226, 0, 0, 14791,
|
||||
14823, 0, 0, 2145, 10597, 14823, 14791, 12710, 10597, 21130, 42260, 57051, 65503, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 61277, 46486, 23243, 10597, 12710, 14791, 14791, 10565, 2113, 0, 0, 10597,
|
||||
14823, 0, 0, 0, 2113, 2145, 2145, 2113, 32, 8452, 23275, 42260, 63390, 65535, 65535, 65535, 65535, 65535, 65535, 63422, 48599, 29582, 8484, 32, 2113, 2145, 2145, 2113, 0, 0, 0, 12678,
|
||||
16904, 0, 0, 0, 0, 0, 0, 0, 0, 32, 10565, 25388, 50712, 61277, 59164, 57083, 57083, 59164, 61277, 50744, 31727, 14823, 2113, 0, 0, 0, 0, 0, 0, 0, 0, 12678,
|
||||
16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2113, 10565, 27469, 33840, 33808, 31727, 31727, 33808, 33840, 27501, 12710, 4226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678,
|
||||
16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2113, 10597, 14823, 14791, 14791, 14791, 14791, 14823, 10597, 2145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678,
|
||||
16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2113, 2145, 2145, 2145, 2145, 2145, 2145, 2113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678,
|
||||
16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678,
|
||||
16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678,
|
||||
14823, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10597,
|
||||
12710, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8484,
|
||||
23243, 6371, 6371, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 6371, 4226, 19017,
|
||||
2016, 31727, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 31727, 31695, 2016,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,49 +0,0 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_FILE != 0 && LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
const color_int_t img_file [] = { /*Width = 24, Height = 33*/
|
||||
24, /*Width*/
|
||||
33, /*Heigth*/
|
||||
16, /*Color depth = 16*/
|
||||
1, /*Flags: Transp = 1*/
|
||||
2016, 31695, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31695, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
27469, 12678, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12678, 12678, 19017, 31727, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
19017, 2113, 2113, 2113, 32, 0, 0, 0, 0, 0, 2113, 4226, 6339, 19049, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
14791, 0, 0, 0, 4226, 6339, 6339, 6339, 6371, 4258, 0, 0, 0, 6371, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
14823, 0, 0, 4258, 23275, 33808, 33808, 33808, 35921, 25388, 6371, 0, 4226, 6339, 6371, 19049, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
16904, 0, 0, 8484, 38066, 52857, 52825, 52857, 54970, 40179, 10565, 2145, 19017, 19049, 4226, 6371, 29582, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
16904, 0, 0, 10597, 46518, 63422, 63422, 65503, 65535, 48631, 10597, 8484, 42260, 46486, 19017, 6339, 6339, 19049, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
16904, 0, 0, 12678, 50712, 65535, 65535, 65535, 65535, 52857, 12678, 10597, 52825, 61309, 38066, 19017, 2145, 6339, 27501, 2016, 2016, 2016, 2016, 2016,
|
||||
16904, 0, 0, 12678, 50712, 65535, 65535, 65535, 65535, 52825, 10597, 10597, 50712, 65535, 61277, 44405, 19017, 4258, 6339, 19017, 2016, 2016, 2016, 2016,
|
||||
16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 52825, 10597, 10597, 50712, 65535, 65535, 61309, 38066, 19049, 4226, 6371, 27501, 2016, 2016, 2016,
|
||||
16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 52825, 10597, 10597, 50744, 65535, 65535, 65535, 63390, 48599, 21162, 8452, 6371, 19049, 2016, 2016,
|
||||
16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 52825, 10597, 8452, 42260, 57083, 57083, 59164, 61277, 50712, 27469, 10565, 0, 4226, 27501, 2016,
|
||||
16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 52825, 10597, 32, 19049, 29582, 29582, 29614, 29614, 27469, 21130, 10597, 32, 0, 4258, 23275,
|
||||
16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 54938, 21162, 8484, 19017, 23243, 23243, 23243, 23243, 23243, 25356, 19017, 4226, 0, 0, 12678,
|
||||
16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 59196, 42260, 33808, 35921, 35953, 35953, 35953, 35953, 38034, 40147, 29614, 8452, 0, 0, 10597,
|
||||
16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 63422, 54970, 50744, 50712, 50712, 50712, 50712, 50712, 50744, 52857, 40179, 12678, 0, 0, 10597,
|
||||
16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 63422, 63390, 63390, 63390, 63390, 63390, 63390, 63422, 65535, 50712, 14823, 0, 0, 10597,
|
||||
16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 16904, 0, 0, 12678,
|
||||
16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 16904, 0, 0, 12678,
|
||||
16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 12678,
|
||||
16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 12678,
|
||||
16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 12678,
|
||||
16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 12678,
|
||||
16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 12678,
|
||||
16904, 0, 0, 12678, 48631, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 52857, 16904, 0, 0, 12678,
|
||||
16904, 0, 0, 12678, 50712, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 54938, 16904, 0, 0, 12678,
|
||||
16904, 0, 0, 12678, 52825, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 57051, 16904, 0, 0, 12678,
|
||||
16904, 0, 0, 10565, 42292, 59164, 59164, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 57083, 59164, 61309, 46518, 14791, 0, 0, 12678,
|
||||
16904, 0, 0, 4258, 23275, 33808, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 33808, 33840, 25388, 8452, 0, 0, 12678,
|
||||
14823, 0, 0, 32, 8484, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 10565, 2113, 0, 0, 10597,
|
||||
12710, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8484,
|
||||
23243, 6371, 6371, 6371, 6371, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6339, 6371, 6371, 6371, 4226, 19017,
|
||||
2016, 31727, 33808, 33808, 33808, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 33808, 33808, 31727, 31695, 2016,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,44 +0,0 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_FOLDER != 0 && LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
const color_int_t img_folder [] = { /*Width = 34, Height = 28*/
|
||||
34, /*Width*/
|
||||
28, /*Heigth*/
|
||||
16, /*Color depth = 16*/
|
||||
1, /*Flags: Transp = 1*/
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31695, 31727, 31727, 31695, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 25356, 16904, 12710, 12710, 12710, 12710, 14823, 21162, 33808, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 27469, 12710, 6339, 4226, 2145, 2145, 2145, 2145, 2145, 4226, 10597, 27469, 2016, 33808, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31727, 31695, 29614, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 27469, 8452, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8484, 14791, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 12710, 10597, 8484, 23243, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 16904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 23243, 6339, 8452, 8484, 8484, 8484, 8484, 8484, 8484, 8484, 8484, 8452, 8452, 6371, 6371, 6371, 6371, 6371, 6371, 6371, 6371, 6371, 6371, 6371, 6371, 6339, 2145, 19017, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 33808, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 31695, 29582, 27501, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 29582, 27501, 29582, 29582, 2016, 2016,
|
||||
2016, 29582, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14823, 14791, 12678, 25388, 2016,
|
||||
2016, 25356, 8452, 4226, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 19049, 2016,
|
||||
2016, 25356, 6339, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19017, 2016,
|
||||
2016, 29582, 10597, 2113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4258, 23275, 2016,
|
||||
2016, 33808, 14823, 2145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2113, 8484, 27469, 2016,
|
||||
2016, 2016, 19017, 4226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 12678, 31695, 2016,
|
||||
2016, 2016, 23243, 4258, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4226, 16904, 2016, 2016,
|
||||
2016, 2016, 25388, 6339, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4226, 19049, 2016, 2016,
|
||||
2016, 2016, 29614, 6371, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4258, 23275, 2016, 2016,
|
||||
2016, 2016, 33808, 8452, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6339, 27469, 2016, 2016,
|
||||
2016, 2016, 2016, 8484, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6371, 31695, 2016, 2016,
|
||||
2016, 2016, 2016, 10565, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8452, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 10565, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8452, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 8484, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6371, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 19049, 4226, 6371, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 8452, 6371, 4226, 16936, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 31695, 31727, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 33808, 31727, 31695, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,46 +0,0 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_LEFT != 0 && LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
const color_int_t img_left [] = { /*Width = 19, Height = 30*/
|
||||
19, /*Width*/
|
||||
30, /*Heigth*/
|
||||
16, /*Color depth = 16*/
|
||||
1, /*Flags: Transp = 1*/
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 33808, 29582, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 27501, 14791, 10565, 21162, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29582, 10565, 32, 0, 6371, 23243, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29614, 12678, 32, 0, 0, 0, 6371, 23243, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31695, 10597, 32, 0, 0, 0, 0, 0, 8452, 25356,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31695, 14791, 2113, 0, 0, 0, 0, 0, 0, 2145, 21130,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 29582, 10597, 2113, 0, 0, 0, 0, 0, 0, 0, 8452, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 29582, 12678, 32, 0, 0, 0, 0, 0, 0, 32, 8452, 23275, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 29614, 10597, 32, 0, 0, 0, 0, 0, 0, 0, 8452, 31727, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 29614, 12710, 32, 0, 0, 0, 0, 0, 0, 32, 8452, 25356, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 29614, 10597, 32, 0, 0, 0, 0, 0, 0, 0, 8452, 31727, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 29614, 12710, 32, 0, 0, 0, 0, 0, 0, 2113, 8452, 25356, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 29614, 10597, 32, 0, 0, 0, 0, 0, 0, 0, 8452, 31727, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
29614, 12678, 32, 0, 0, 0, 0, 0, 0, 32, 8452, 23275, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
12678, 0, 0, 0, 0, 0, 0, 0, 0, 6371, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
8484, 0, 0, 0, 0, 0, 0, 0, 0, 6371, 31727, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
23243, 6339, 0, 0, 0, 0, 0, 0, 0, 2113, 10597, 29582, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 21162, 6371, 0, 0, 0, 0, 0, 0, 0, 32, 14791, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 21162, 6371, 0, 0, 0, 0, 0, 0, 0, 4226, 12710, 29614, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 23243, 8452, 0, 0, 0, 0, 0, 0, 0, 0, 12710, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 23243, 6371, 0, 0, 0, 0, 0, 0, 0, 2145, 12710, 29614, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 23243, 8452, 0, 0, 0, 0, 0, 0, 0, 0, 12710, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 23243, 6371, 0, 0, 0, 0, 0, 0, 0, 2145, 12710, 29614, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 23243, 6371, 0, 0, 0, 0, 0, 0, 0, 0, 12710, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 21130, 4258, 0, 0, 0, 0, 0, 0, 0, 4226, 19017,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 21130, 6371, 0, 0, 0, 0, 0, 0, 4258, 19049,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 23243, 6371, 0, 0, 0, 0, 2113, 16904, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 23243, 8452, 0, 0, 4258, 16904, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 21162, 8452, 4258, 16904, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 25388, 21162, 31727, 2016, 2016, 2016,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,47 +0,0 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_OK != 0 && LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
const color_int_t img_ok [] = { /*Width = 34, Height = 31*/
|
||||
34, /*Width*/
|
||||
31, /*Heigth*/
|
||||
16, /*Color depth = 16*/
|
||||
1, /*Flags: Transp = 1*/
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 19017, 6339, 6371, 21130, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 25388, 4226, 0, 0, 6339, 29582, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 19049, 4258, 0, 0, 0, 32, 8452, 25388, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 27501, 4258, 0, 0, 0, 0, 2145, 10565, 29582, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 19049, 4258, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 25388, 4226, 0, 0, 0, 0, 2145, 12678, 29582, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 19017, 4226, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 25388, 4226, 0, 0, 0, 0, 2145, 12678, 29582, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 19017, 4226, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 25388, 4226, 0, 0, 0, 0, 2145, 12678, 29582, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 21130, 4258, 0, 0, 0, 0, 0, 10565, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 33808, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 27501, 6339, 0, 0, 0, 0, 2145, 10597, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 25356, 10565, 6339, 14823, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 19049, 4258, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 8484, 0, 0, 2113, 21130, 2016, 2016, 2016, 2016, 2016, 2016, 25388, 4226, 0, 0, 0, 0, 2145, 12678, 29582, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 31727, 12710, 2113, 0, 0, 0, 2145, 16936, 2016, 2016, 2016, 2016, 21130, 4258, 0, 0, 0, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 33808, 14823, 4226, 0, 0, 0, 0, 4226, 25356, 2016, 2016, 29614, 6371, 0, 0, 0, 0, 2145, 10597, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 14791, 0, 0, 0, 0, 32, 6339, 10565, 12678, 8484, 2113, 0, 0, 0, 0, 10597, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 31727, 14791, 4226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2145, 10597, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 16904, 2113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 16904, 4258, 0, 0, 0, 0, 0, 0, 2145, 12678, 29582, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 2113, 0, 0, 0, 0, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 4258, 0, 0, 2145, 12678, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 16904, 2113, 0, 12678, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31727, 19017, 16904, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,46 +0,0 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_RIGHT != 0 && LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
const color_int_t img_right [] = { /*Width = 19, Height = 30*/
|
||||
19, /*Width*/
|
||||
30, /*Heigth*/
|
||||
16, /*Color depth = 16*/
|
||||
1, /*Flags: Transp = 1*/
|
||||
2016, 2016, 2016, 2016, 29582, 33808, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 21162, 10565, 14791, 27501, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 23243, 6371, 0, 32, 10565, 29582, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 23243, 6371, 0, 0, 0, 32, 12678, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
25356, 8452, 0, 0, 0, 0, 0, 32, 10597, 31695, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
21130, 2145, 0, 0, 0, 0, 0, 0, 2113, 14791, 31695, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 8452, 0, 0, 0, 0, 0, 0, 0, 2113, 10597, 29582, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 23275, 8452, 32, 0, 0, 0, 0, 0, 0, 32, 12678, 29582, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 31727, 8452, 0, 0, 0, 0, 0, 0, 0, 32, 10597, 29614, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 25356, 8452, 32, 0, 0, 0, 0, 0, 0, 32, 12710, 29614, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 31727, 8452, 0, 0, 0, 0, 0, 0, 0, 32, 10597, 29614, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 25356, 8452, 2113, 0, 0, 0, 0, 0, 0, 32, 12710, 29614, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 31727, 8452, 0, 0, 0, 0, 0, 0, 0, 32, 10597, 29614, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 23275, 8452, 32, 0, 0, 0, 0, 0, 0, 32, 12678, 29614,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29614, 6371, 0, 0, 0, 0, 0, 0, 0, 0, 12678,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31727, 6371, 0, 0, 0, 0, 0, 0, 0, 0, 8484,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 29582, 10597, 2113, 0, 0, 0, 0, 0, 0, 0, 6339, 23243,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 14791, 32, 0, 0, 0, 0, 0, 0, 0, 6371, 21162, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 29614, 12710, 4226, 0, 0, 0, 0, 0, 0, 0, 6371, 21162, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 12710, 0, 0, 0, 0, 0, 0, 0, 0, 8452, 23243, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 29614, 12710, 2145, 0, 0, 0, 0, 0, 0, 0, 6371, 23243, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 12710, 0, 0, 0, 0, 0, 0, 0, 0, 8452, 23243, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 29614, 12710, 2145, 0, 0, 0, 0, 0, 0, 0, 6371, 23243, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 12710, 0, 0, 0, 0, 0, 0, 0, 0, 6371, 23243, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
19017, 4226, 0, 0, 0, 0, 0, 0, 0, 4258, 21130, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
19049, 4258, 0, 0, 0, 0, 0, 0, 6371, 21130, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 16904, 2113, 0, 0, 0, 0, 6371, 23243, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 16904, 4258, 0, 0, 8452, 23243, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 16904, 4258, 8452, 21162, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 31727, 21162, 25388, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,36 +0,0 @@
|
||||
#include "img_conf.h"
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_IMG_UP != 0 && LV_APP_USE_INTERNAL_ICONS == 2
|
||||
|
||||
#include <stdint.h>
|
||||
#include "misc/others/color.h"
|
||||
|
||||
const color_int_t img_up [] = { /*Width = 29, Height = 20*/
|
||||
29, /*Width*/
|
||||
20, /*Heigth*/
|
||||
16, /*Color depth = 16*/
|
||||
1, /*Flags: Transp = 1*/
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31727, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29614, 14791, 6371, 12678, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12710, 0, 0, 0, 12710, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29614, 12710, 2145, 0, 0, 0, 32, 10597, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12710, 0, 0, 0, 0, 0, 0, 32, 12710, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 29614, 12710, 2145, 0, 0, 0, 0, 0, 0, 0, 32, 10597, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 12710, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 12710, 29614, 2016, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 29614, 12710, 2145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 10597, 29614, 2016, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 2016, 2016, 12710, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 12678, 29614, 2016, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 31695, 12710, 4226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 10597, 31695, 2016, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 14791, 32, 0, 0, 0, 0, 0, 0, 32, 4226, 8484, 8452, 2113, 0, 0, 0, 0, 0, 0, 2113, 14791, 31695, 2016, 2016, 2016,
|
||||
2016, 2016, 29614, 12710, 4226, 0, 0, 0, 0, 0, 0, 32, 8452, 19049, 2016, 2016, 8484, 0, 0, 0, 0, 0, 0, 0, 2113, 10597, 29614, 2016, 2016,
|
||||
2016, 2016, 12678, 0, 0, 0, 0, 0, 0, 0, 0, 6371, 23243, 2016, 2016, 2016, 25356, 8452, 32, 0, 0, 0, 0, 0, 0, 32, 12678, 29582, 2016,
|
||||
29582, 12710, 2145, 0, 0, 0, 0, 0, 0, 0, 4258, 19049, 2016, 2016, 2016, 2016, 2016, 31695, 6371, 0, 0, 0, 0, 0, 0, 0, 32, 10597, 29582,
|
||||
16936, 32, 0, 0, 0, 0, 0, 0, 0, 6371, 19049, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 23243, 6371, 32, 0, 0, 0, 0, 0, 0, 2113, 19049,
|
||||
19049, 2145, 0, 0, 0, 0, 0, 0, 6339, 21162, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31727, 8452, 0, 0, 0, 0, 0, 0, 2145, 23243,
|
||||
33808, 16904, 4258, 0, 0, 0, 0, 6371, 21162, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 25356, 8452, 32, 0, 0, 0, 2113, 12710, 2016,
|
||||
2016, 2016, 16904, 2113, 0, 0, 6339, 21162, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 31727, 8452, 0, 0, 2113, 19017, 2016, 2016,
|
||||
2016, 2016, 2016, 16904, 4258, 6371, 21162, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 23275, 8452, 4226, 12678, 2016, 2016, 2016,
|
||||
2016, 2016, 2016, 2016, 23243, 23275, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 25388, 31695, 2016, 2016, 2016,
|
||||
};
|
||||
|
||||
#endif
|
||||
259
lv_misc/anim.c
259
lv_misc/anim.c
@@ -1,259 +0,0 @@
|
||||
/**
|
||||
* @file anim.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <string.h>
|
||||
#include "anim.h"
|
||||
#include "misc/math/math_base.h"
|
||||
#include "misc/os/ptask.h"
|
||||
#include "hal/systick/systick.h"
|
||||
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define ANIM_PATH_LENGTH 129 /*Elements in a path array*/
|
||||
#define ANIM_PATH_START 64 /*In path array a value which corresponds to the start position*/
|
||||
#define ANIM_PATH_END 192 /* ... to the end position. Not required, just for clearance.*/
|
||||
#define ANIM_PATH_NORM_SHIFT 7 /*ANIM_PATH_START - ANIM_PATH_END. Must be 2^N. The exponent goes here. */
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void anim_task (void * param);
|
||||
static bool anim_ready_handler(anim_t * a);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static ll_dsc_t anim_ll;
|
||||
static uint32_t last_task_run;
|
||||
static bool anim_del_global_flag = false;
|
||||
|
||||
static anim_path_t anim_path_lin[] =
|
||||
{64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
|
||||
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
|
||||
128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
|
||||
160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192};
|
||||
|
||||
static anim_path_t anim_path_step[] =
|
||||
{64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
|
||||
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
|
||||
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
|
||||
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 192,};
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Init. the animation module
|
||||
*/
|
||||
void anim_init(void)
|
||||
{
|
||||
ll_init(&anim_ll, sizeof(anim_t));
|
||||
last_task_run = systick_get();
|
||||
ptask_create(anim_task, LV_REFR_PERIOD, PTASK_PRIO_MID, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an animation
|
||||
* @param anim_p an initialized 'anim_t' variable. Not required after call.
|
||||
*/
|
||||
void anim_create(anim_t * anim_p)
|
||||
{
|
||||
/*Add the new animation to the animation linked list*/
|
||||
anim_t * new_anim = ll_ins_head(&anim_ll);
|
||||
dm_assert(new_anim);
|
||||
|
||||
/*Initialize the animation descriptor*/
|
||||
anim_p->playback_now = 0;
|
||||
memcpy(new_anim, anim_p, sizeof(anim_t));
|
||||
|
||||
/*Set the start value*/
|
||||
if(new_anim->fp != NULL) new_anim->fp(new_anim->var, new_anim->start);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an animation for a variable with a given animatior function
|
||||
* @param var pointer to variable
|
||||
* @param fp a function pointer which is animating 'var',
|
||||
* or NULL to ignore it and delete all animation with 'var
|
||||
* @return true: at least 1 animation is deleted, false: no animation is deleted
|
||||
*/
|
||||
bool anim_del(void * var, anim_fp_t fp)
|
||||
{
|
||||
bool del = false;
|
||||
anim_t * a;
|
||||
anim_t * a_next;
|
||||
a = ll_get_head(&anim_ll);
|
||||
while(a != NULL) {
|
||||
/*'a' might be deleted, so get the next object while 'a' is valid*/
|
||||
a_next = ll_get_next(&anim_ll, a);
|
||||
|
||||
if(a->var == var && (a->fp == fp || fp == NULL)) {
|
||||
ll_rem(&anim_ll, a);
|
||||
dm_free(a);
|
||||
del = true;
|
||||
anim_del_global_flag = true;
|
||||
}
|
||||
|
||||
a = a_next;
|
||||
}
|
||||
|
||||
return del;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the time of an animation with a given speed and the start and end values
|
||||
* @param speed speed of animation in unit/sec
|
||||
* @param start start value of the animation
|
||||
* @param end end value of the animation
|
||||
* @return the required time [ms] for the animation with the given parameters
|
||||
*/
|
||||
uint16_t anim_speed_to_time(uint16_t speed, int32_t start, int32_t end)
|
||||
{
|
||||
int32_t d = MATH_ABS((int32_t) start - end);
|
||||
uint16_t time = (int32_t)((int32_t)(d * 1000) / speed);
|
||||
|
||||
if(time == 0) {
|
||||
time++;
|
||||
}
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a predefine animation path
|
||||
* @param name name of the path from 'anim_path_name_t'
|
||||
* @return pointer to the path array
|
||||
*/
|
||||
anim_path_t * anim_get_path(anim_path_name_t name)
|
||||
{
|
||||
switch (name) {
|
||||
case ANIM_PATH_LIN:
|
||||
return anim_path_lin;
|
||||
break;
|
||||
case ANIM_PATH_STEP:
|
||||
return anim_path_step;
|
||||
break;
|
||||
default:
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Periodically handle the animations.
|
||||
* @param param unused
|
||||
*/
|
||||
static void anim_task (void * param)
|
||||
{
|
||||
uint32_t elaps;
|
||||
elaps = systick_elaps(last_task_run);
|
||||
|
||||
anim_t * a;
|
||||
anim_t * a_next;
|
||||
a = ll_get_head(&anim_ll);
|
||||
while(a != NULL) {
|
||||
/*'a' might be deleted, so get the next object while 'a' is valid*/
|
||||
a_next = ll_get_next(&anim_ll, a);
|
||||
|
||||
a->act_time += elaps;
|
||||
if(a->act_time >= 0) {
|
||||
if(a->act_time > a->time) a->act_time = a->time;
|
||||
|
||||
/* Get the index of the path array based on the elapsed time*/
|
||||
uint8_t path_i;
|
||||
if(a->time == a->act_time) {
|
||||
path_i = ANIM_PATH_LENGTH - 1; /*Use the last value id the time fully elapsed*/
|
||||
} else {
|
||||
path_i = a->act_time * (ANIM_PATH_LENGTH - 1) / a->time;
|
||||
}
|
||||
/* Get the new value which will be proportional to the current element of 'path_p'
|
||||
* and the 'start' and 'end' values*/
|
||||
int32_t new_val;
|
||||
new_val = (int32_t)(a->path[path_i] - ANIM_PATH_START) * (a->end - a->start);
|
||||
new_val = new_val >> ANIM_PATH_NORM_SHIFT;
|
||||
new_val += a->start;
|
||||
|
||||
if(a->fp != NULL) a->fp(a->var, new_val); /*Apply the calculated value*/
|
||||
|
||||
/*If the time is elapsed the animation is ready*/
|
||||
if(a->act_time >= a->time) {
|
||||
bool invalid;
|
||||
invalid = anim_ready_handler(a);
|
||||
if(invalid != false) {
|
||||
a_next = ll_get_head(&anim_ll); /*a_next might be invalid if animation delete occurred*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
a = a_next;
|
||||
}
|
||||
|
||||
last_task_run = systick_get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when an animation is ready to do the necessary thinks
|
||||
* e.g. repeat, play back, delete etc.
|
||||
* @param a pointer to an animation descriptor
|
||||
* @return true: animation delete occurred
|
||||
* */
|
||||
static bool anim_ready_handler(anim_t * a)
|
||||
{
|
||||
bool invalid = false;
|
||||
|
||||
/*Delete the animation if
|
||||
* - no repeat and no play back (simple one shot animation)
|
||||
* - no repeat, play back is enabled and play back is ready */
|
||||
if((a->repeat == 0 && a->playback == 0) ||
|
||||
(a->repeat == 0 && a->playback == 1 && a->playback_now == 1)) {
|
||||
void (*cb) (void *) = a->end_cb;
|
||||
void * p = a->var;
|
||||
ll_rem(&anim_ll, a);
|
||||
dm_free(a);
|
||||
|
||||
/*Call the callback function at the end*/
|
||||
/* Check if an animation is deleted in the cb function
|
||||
* if yes then the caller function has to know this*/
|
||||
anim_del_global_flag = false;
|
||||
if(cb != NULL) cb(p);
|
||||
invalid = anim_del_global_flag;
|
||||
}
|
||||
/*If the animation is not deleted then restart it*/
|
||||
else {
|
||||
a->act_time = - a->repeat_pause; /*Restart the animation*/
|
||||
/*Swap the start and end values in play back mode*/
|
||||
if(a->playback != 0) {
|
||||
/*If now turning back use the 'playback_pause*/
|
||||
if(a->playback_now == 0) a->act_time = - a->playback_pause;
|
||||
|
||||
/*Toggle the play back state*/
|
||||
a->playback_now = a->playback_now == 0 ? 1: 0;
|
||||
/*Swap the start and end values*/
|
||||
int32_t tmp;
|
||||
tmp = a->start;
|
||||
a->start = a->end;
|
||||
a->end = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
return invalid;
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
/**
|
||||
* @file anim.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ANIM_H
|
||||
#define ANIM_H
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lvgl/lvgl.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ANIM_PATH_LIN,
|
||||
ANIM_PATH_STEP,
|
||||
}anim_path_name_t;
|
||||
|
||||
typedef uint8_t anim_path_t;
|
||||
|
||||
typedef void (*anim_fp_t)(void *, int32_t);
|
||||
typedef void (*anim_cb_t)(void *);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void * var; /*Variable to animate*/
|
||||
anim_fp_t fp; /*Animator function*/
|
||||
anim_cb_t end_cb; /*Call it when the animation is ready*/
|
||||
anim_path_t * path; /*An array with the steps of animations*/
|
||||
int32_t start; /*Start value*/
|
||||
int32_t end; /*End value*/
|
||||
int16_t time; /*Animation time in ms*/
|
||||
int16_t act_time; /*Current time in animation. Set to negative to make delay.*/
|
||||
uint16_t playback_pause; /*Wait before play back*/
|
||||
uint16_t repeat_pause; /*Wait before repeat*/
|
||||
uint8_t playback :1; /*When the animation is ready play it back*/
|
||||
uint8_t repeat :1; /*Repeat the animation infinitely*/
|
||||
/*Animation system use these - user shouldn't set*/
|
||||
uint8_t playback_now :1; /*Play back is in progress*/
|
||||
}anim_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Init. the animation module
|
||||
*/
|
||||
void anim_init(void);
|
||||
|
||||
/**
|
||||
* Create an animation
|
||||
* @param anim_p an initialized 'anim_t' variable. Not required after call.
|
||||
*/
|
||||
void anim_create(anim_t * anim_p);
|
||||
|
||||
/**
|
||||
* Delete an animation for a variable with a given animatior function
|
||||
* @param var pointer to variable
|
||||
* @param fp a function pointer which is animating 'var',
|
||||
* or NULL to ignore it and delete all animation with 'var
|
||||
* @return true: at least 1 animation is deleted, false: no animation is deleted
|
||||
*/
|
||||
bool anim_del(void * var, anim_fp_t fp);
|
||||
|
||||
/**
|
||||
* Calculate the time of an animation with a given speed and the start and end values
|
||||
* @param speed speed of animation in unit/sec
|
||||
* @param start start value of the animation
|
||||
* @param end end value of the animation
|
||||
* @return the required time [ms] for the animation with the given parameters
|
||||
*/
|
||||
uint16_t anim_speed_to_time(uint16_t speed, int32_t start, int32_t end);
|
||||
|
||||
/**
|
||||
* Get a predefine animation path
|
||||
* @param name name of the path from 'anim_path_name_t'
|
||||
* @return pointer to the path array
|
||||
*/
|
||||
anim_path_t * anim_get_path(anim_path_name_t name);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif
|
||||
233
lv_misc/area.c
233
lv_misc/area.c
@@ -1,233 +0,0 @@
|
||||
/**
|
||||
* @file 2d.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <lvgl/lv_misc/area.h>
|
||||
#include "misc/math/math_base.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize an area
|
||||
* @param area_p pointer to an area
|
||||
* @param x1 left coordinate of the area
|
||||
* @param y1 top coordinate of the area
|
||||
* @param x2 right coordinate of the area
|
||||
* @param y2 bottom coordinate of the area
|
||||
*/
|
||||
void area_set(area_t * area_p, cord_t x1, cord_t y1, cord_t x2, cord_t y2)
|
||||
{
|
||||
area_p->x1 = x1;
|
||||
area_p->y1 = y1;
|
||||
area_p->x2 = x2;
|
||||
area_p->y2 = y2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the width of an area
|
||||
* @param area_p pointer to an area
|
||||
* @param w the new width of the area (w == 1 makes x1 == x2)
|
||||
*/
|
||||
void area_set_width(area_t * area_p, cord_t w)
|
||||
{
|
||||
area_p->x2 = area_p->x1 + w - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the height of an area
|
||||
* @param area_p pointer to an area
|
||||
* @param h the new height of the area (h == 1 makes y1 == y2)
|
||||
*/
|
||||
void area_set_height(area_t * area_p, cord_t h)
|
||||
{
|
||||
area_p->y2 = area_p->y1 + h - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the position of an area (width and height will be kept)
|
||||
* @param area_p pointer to an area
|
||||
* @param x the new x coordinate of the area
|
||||
* @param y the new y coordinate of the area
|
||||
*/
|
||||
void area_set_pos(area_t * area_p, cord_t x, cord_t y)
|
||||
{
|
||||
cord_t w = area_get_width(area_p);
|
||||
cord_t h = area_get_height(area_p);
|
||||
area_p->x1 = x;
|
||||
area_p->y1 = y;
|
||||
area_set_width(area_p, w);
|
||||
area_set_height(area_p, h);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return with area of an area (x * y)
|
||||
* @param area_p pointer to an area
|
||||
* @return size of area
|
||||
*/
|
||||
uint32_t area_get_size(const area_t * area_p)
|
||||
{
|
||||
uint32_t size;
|
||||
|
||||
size = (uint32_t)(area_p->x2 - area_p->x1 + 1) *
|
||||
(area_p->y2 - area_p->y1 + 1);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the common parts of two areas
|
||||
* @param res_p pointer to an area, the result will be stored her
|
||||
* @param a1_p pointer to the first area
|
||||
* @param a2_p pointer to the second area
|
||||
* @return false: the two area has NO common parts, res_p is invalid
|
||||
*/
|
||||
bool area_union(area_t * res_p, const area_t * a1_p, const area_t * a2_p)
|
||||
{
|
||||
/* Get the smaller area from 'a1_p' and 'a2_p' */
|
||||
res_p->x1 = MATH_MAX(a1_p->x1, a2_p->x1);
|
||||
res_p->y1 = MATH_MAX(a1_p->y1, a2_p->y1);
|
||||
res_p->x2 = MATH_MIN(a1_p->x2, a2_p->x2);
|
||||
res_p->y2 = MATH_MIN(a1_p->y2, a2_p->y2);
|
||||
|
||||
/*If x1 or y1 greater then x2 or y2 then the areas union is empty*/
|
||||
bool union_ok = true;
|
||||
if((res_p->x1 > res_p->x2) ||
|
||||
(res_p->y1 > res_p->y2))
|
||||
{
|
||||
union_ok = false;
|
||||
}
|
||||
|
||||
return union_ok;
|
||||
}
|
||||
/**
|
||||
* Join two areas into a third which involves the other two
|
||||
* @param res_p pointer to an area, the result will be stored here
|
||||
* @param a1_p pointer to the first area
|
||||
* @param a2_p pointer to the second area
|
||||
*/
|
||||
void area_join(area_t * a_res_p, const area_t * a1_p, const area_t * a2_p)
|
||||
{
|
||||
a_res_p->x1 = MATH_MIN(a1_p->x1, a2_p->x1);
|
||||
a_res_p->y1 = MATH_MIN(a1_p->y1, a2_p->y1);
|
||||
a_res_p->x2 = MATH_MAX(a1_p->x2, a2_p->x2);
|
||||
a_res_p->y2 = MATH_MAX(a1_p->y2, a2_p->y2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a point is on an area
|
||||
* @param a_p pointer to an area
|
||||
* @param p_p pointer to a point
|
||||
* @return false:the point is out of the area
|
||||
*/
|
||||
bool area_is_point_on(const area_t * a_p, const point_t * p_p)
|
||||
{
|
||||
bool is_on = false;
|
||||
|
||||
if((p_p->x >= a_p->x1 && p_p->x <= a_p->x2) &&
|
||||
((p_p->y >= a_p->y1 && p_p->y <= a_p->y2)))
|
||||
{
|
||||
is_on = true;
|
||||
}
|
||||
|
||||
return is_on;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if two area has common parts
|
||||
* @param a1_p pointer to an area.
|
||||
* @param a2_p pointer to an other area
|
||||
* @return false: a1_p and a2_p has no common parts
|
||||
*/
|
||||
bool area_is_on(const area_t * a1_p, const area_t * a2_p)
|
||||
{
|
||||
/*Two area are on each other if... */
|
||||
|
||||
point_t p;
|
||||
/*a2 left-top corner is on a1*/
|
||||
p.x = a2_p->x1;
|
||||
p.y = a2_p->y1;
|
||||
if(area_is_point_on(a1_p, &p)) return true;
|
||||
|
||||
/*a2 right-top corner is on a1*/
|
||||
p.x = a2_p->x1;
|
||||
p.y = a2_p->y1;
|
||||
if(area_is_point_on(a1_p, &p)) return true;
|
||||
|
||||
/*a2 left-bottom corner is on a1*/
|
||||
p.x = a2_p->x1;
|
||||
p.y = a2_p->y2;
|
||||
if(area_is_point_on(a1_p, &p)) return true;
|
||||
|
||||
/*a2 right-bottom corner is on a1*/
|
||||
p.x = a2_p->x2;
|
||||
p.y = a2_p->y2;
|
||||
if(area_is_point_on(a1_p, &p)) return true;
|
||||
|
||||
/*a2 is horizontally bigger then a1 and covers it*/
|
||||
if((a2_p->x1 <= a1_p->x1 && a2_p->x2 >= a1_p->x2) && /*a2 hor. cover a1?*/
|
||||
((a2_p->y1 <= a1_p->y1 && a2_p->y1 >= a1_p->y2) || /*upper edge is on a1?*/
|
||||
(a2_p->y2 <= a1_p->y1 && a2_p->y2 >= a1_p->y2) ||/* or lower edge is on a1?*/
|
||||
(a2_p->y1 <= a1_p->y1 && a2_p->y2 >= a1_p->y2))) /*or a2 vert bigger then a1*/
|
||||
return true;
|
||||
|
||||
/*a2 is vertically bigger then a1 and covers it*/
|
||||
if((a2_p->y1 <= a1_p->y1 && a2_p->y2 >= a1_p->y2) && /*a2 vert. cover a1?*/
|
||||
((a2_p->x1 <= a1_p->x1 && a2_p->x1 >= a1_p->x2) || /*left edge is on a1?*/
|
||||
(a2_p->x2 <= a1_p->x1 && a2_p->x2 >= a1_p->x2) ||/* or right edge is on a1?*/
|
||||
(a2_p->x1 <= a1_p->x1 && a2_p->x2 >= a1_p->x2))) /*or a2 hor. bigger then a1*/
|
||||
return true;
|
||||
|
||||
/*Else no cover*/
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an area is fully on an other
|
||||
* @param ain_p pointer to an area which could be on aholder_p
|
||||
* @param aholder pointer to an area which could involve ain_p
|
||||
* @return
|
||||
*/
|
||||
bool area_is_in(const area_t * ain_p, const area_t * aholder_p)
|
||||
{
|
||||
bool is_in = false;
|
||||
|
||||
if(ain_p->x1 >= aholder_p->x1 &&
|
||||
ain_p->y1 >= aholder_p->y1 &&
|
||||
ain_p->x2 <= aholder_p->x2 &&
|
||||
ain_p->y2 <= aholder_p->y2)
|
||||
{
|
||||
is_in = true;
|
||||
}
|
||||
|
||||
return is_in;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
158
lv_misc/area.h
158
lv_misc/area.h
@@ -1,158 +0,0 @@
|
||||
/**
|
||||
* @file area.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AREA_H
|
||||
#define AREA_H
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_conf.h"
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef LV_CORD_TYPE cord_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
cord_t x;
|
||||
cord_t y;
|
||||
}point_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
cord_t x1;
|
||||
cord_t y1;
|
||||
cord_t x2;
|
||||
cord_t y2;
|
||||
}area_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize an area
|
||||
* @param area_p pointer to an area
|
||||
* @param x1 left coordinate of the area
|
||||
* @param y1 top coordinate of the area
|
||||
* @param x2 right coordinate of the area
|
||||
* @param y2 bottom coordinate of the area
|
||||
*/
|
||||
void area_set(area_t * area_p, cord_t x1, cord_t y1, cord_t x2, cord_t y2);
|
||||
|
||||
/**
|
||||
* Copy an area
|
||||
* @param dest pointer to the destination area
|
||||
* @param src pointer to the source area
|
||||
*/
|
||||
static void inline area_cpy(area_t * dest, const area_t * src)
|
||||
{
|
||||
memcpy(dest, src, sizeof(area_t));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the width of an area
|
||||
* @param area_p pointer to an area
|
||||
* @return the width of the area (if x1 == x2 -> width = 1)
|
||||
*/
|
||||
static inline cord_t area_get_width(const area_t * area_p)
|
||||
{
|
||||
return area_p->x2 - area_p->x1 + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the height of an area
|
||||
* @param area_p pointer to an area
|
||||
* @return the height of the area (if y1 == y2 -> height = 1)
|
||||
*/
|
||||
static inline cord_t area_get_height(const area_t * area_p)
|
||||
{
|
||||
return area_p->y2 - area_p->y1 + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the width of an area
|
||||
* @param area_p pointer to an area
|
||||
* @param w the new width of the area (w == 1 makes x1 == x2)
|
||||
*/
|
||||
void area_set_width(area_t * area_p, cord_t w);
|
||||
|
||||
/**
|
||||
* Set the height of an area
|
||||
* @param area_p pointer to an area
|
||||
* @param h the new height of the area (h == 1 makes y1 == y2)
|
||||
*/
|
||||
void area_set_height(area_t * area_p, cord_t h);
|
||||
|
||||
/**
|
||||
* Set the position of an area (width and height will be kept)
|
||||
* @param area_p pointer to an area
|
||||
* @param x the new x coordinate of the area
|
||||
* @param y the new y coordinate of the area
|
||||
*/
|
||||
void area_set_pos(area_t * area_p, cord_t x, cord_t y);
|
||||
|
||||
/**
|
||||
* Return with area of an area (x * y)
|
||||
* @param area_p pointer to an area
|
||||
* @return size of area
|
||||
*/
|
||||
uint32_t area_get_size(const area_t * area_p);
|
||||
|
||||
/**
|
||||
* Get the common parts of two areas
|
||||
* @param res_p pointer to an area, the result will be stored her
|
||||
* @param a1_p pointer to the first area
|
||||
* @param a2_p pointer to the second area
|
||||
* @return false: the two area has NO common parts, res_p is invalid
|
||||
*/
|
||||
bool area_union(area_t * res_p, const area_t * a1_p, const area_t * a2_p);
|
||||
|
||||
/**
|
||||
* Join two areas into a third which involves the other two
|
||||
* @param res_p pointer to an area, the result will be stored here
|
||||
* @param a1_p pointer to the first area
|
||||
* @param a2_p pointer to the second area
|
||||
*/
|
||||
void area_join(area_t * a_res_p, const area_t * a1_p, const area_t * a2_p);
|
||||
|
||||
/**
|
||||
* Check if a point is on an area
|
||||
* @param a_p pointer to an area
|
||||
* @param p_p pointer to a point
|
||||
* @return false:the point is out of the area
|
||||
*/
|
||||
bool area_is_point_on(const area_t * a_p, const point_t * p_p);
|
||||
|
||||
/**
|
||||
* Check if two area has common parts
|
||||
* @param a1_p pointer to an area.
|
||||
* @param a2_p pointer to an other area
|
||||
* @return false: a1_p and a2_p has no common parts
|
||||
*/
|
||||
bool area_is_on(const area_t * a1_p, const area_t * a2_p);
|
||||
|
||||
/**
|
||||
* Check if an area is fully on an other
|
||||
* @param ain_p pointer to an area which could be on aholder_p
|
||||
* @param aholder pointer to an area which could involve ain_p
|
||||
* @return
|
||||
*/
|
||||
bool area_is_in(const area_t * ain_p, const area_t * aholder_p);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif
|
||||
@@ -1,79 +0,0 @@
|
||||
/**
|
||||
* @file circ.c
|
||||
* Circle drawing algorithm (with Bresenham)
|
||||
* Only a 1/8 circle is calculated. Use CIRC_OCT1_X, CIRC_OCT1_Y macros to get
|
||||
* the other octets.
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <lvgl/lv_misc/area.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize the circle drawing
|
||||
* @param c pointer to a point. The coordinates will be calculated here
|
||||
* @param tmp point to a variable. It will store temporary data
|
||||
* @param radius radius of the circle
|
||||
*/
|
||||
void circ_init(point_t * c, cord_t * tmp, cord_t radius)
|
||||
{
|
||||
c->x = radius;
|
||||
c->y = 0;
|
||||
*tmp = 1 - radius;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the circle drawing is ready or not
|
||||
* @param c same as in circ_init
|
||||
* @return true if the circle is not ready yet
|
||||
*/
|
||||
bool circ_cont(point_t * c)
|
||||
{
|
||||
return c->y <= c->x ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the next point from the circle
|
||||
* @param c same as in circ_init. The next point stored here.
|
||||
* @param tmp same as in circ_init.
|
||||
*/
|
||||
void circ_next(point_t * c, cord_t * tmp)
|
||||
{
|
||||
c->y++;
|
||||
|
||||
if (*tmp <= 0) {
|
||||
(*tmp) += 2 * c->y + 1; // Change in decision criterion for y -> y+1
|
||||
} else {
|
||||
c->x--;
|
||||
(*tmp) += 2 * (c->y - c->x) + 1; // Change for y -> y+1, x -> x-1
|
||||
}
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
@@ -1,70 +0,0 @@
|
||||
/**
|
||||
* @file circ.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CIRC_H
|
||||
#define CIRC_H
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include <lvgl/lv_misc/area.h>
|
||||
#include <stddef.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define CIRC_OCT1_X(p) (p.x)
|
||||
#define CIRC_OCT1_Y(p) (p.y)
|
||||
#define CIRC_OCT2_X(p) (p.y)
|
||||
#define CIRC_OCT2_Y(p) (p.x)
|
||||
#define CIRC_OCT3_X(p) (-p.y)
|
||||
#define CIRC_OCT3_Y(p) (p.x)
|
||||
#define CIRC_OCT4_X(p) (-p.x)
|
||||
#define CIRC_OCT4_Y(p) (p.y)
|
||||
#define CIRC_OCT5_X(p) (-p.x)
|
||||
#define CIRC_OCT5_Y(p) (-p.y)
|
||||
#define CIRC_OCT6_X(p) (-p.y)
|
||||
#define CIRC_OCT6_Y(p) (-p.x)
|
||||
#define CIRC_OCT7_X(p) (p.y)
|
||||
#define CIRC_OCT7_Y(p) (-p.x)
|
||||
#define CIRC_OCT8_X(p) (p.x)
|
||||
#define CIRC_OCT8_Y(p) (-p.y)
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize the circle drawing
|
||||
* @param c pointer to a point. The coordinates will be calculated here
|
||||
* @param tmp point to a variable. It will store temporary data
|
||||
* @param radius radius of the circle
|
||||
*/
|
||||
void circ_init(point_t * c, cord_t * tmp, cord_t radius);
|
||||
|
||||
/**
|
||||
* Test the circle drawing is ready or not
|
||||
* @param c same as in circ_init
|
||||
* @return true if the circle is not ready yet
|
||||
*/
|
||||
bool circ_cont(point_t * c);
|
||||
|
||||
/**
|
||||
* Get the next point from the circle
|
||||
* @param c same as in circ_init. The next point stored here.
|
||||
* @param tmp same as in circ_init.
|
||||
*/
|
||||
void circ_next(point_t * c, cord_t * tmp);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif
|
||||
163
lv_misc/font.c
163
lv_misc/font.c
@@ -1,163 +0,0 @@
|
||||
/**
|
||||
* @file font.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <lvgl/lv_misc/fonts/symbol_30.h>
|
||||
#include <stddef.h>
|
||||
#include "font.h"
|
||||
#include "fonts/dejavu_8.h"
|
||||
#include "fonts/dejavu_10.h"
|
||||
#include "fonts/dejavu_14.h"
|
||||
#include "fonts/dejavu_20.h"
|
||||
#include "fonts/dejavu_30.h"
|
||||
#include "fonts/dejavu_40.h"
|
||||
#include "fonts/dejavu_60.h"
|
||||
#include "fonts/dejavu_80.h"
|
||||
#include "fonts/symbol_30.h"
|
||||
#include "fonts/symbol_60.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Get the font from its id
|
||||
* @param font_id: the id of a font (an element of font_types_t enum)
|
||||
* @return pointer to a font descriptor
|
||||
*/
|
||||
const font_t * font_get(font_types_t font_id)
|
||||
{
|
||||
const font_t * font_p = NULL;
|
||||
|
||||
switch(font_id)
|
||||
{
|
||||
#if USE_FONT_DEJAVU_8 != 0
|
||||
case FONT_DEJAVU_8:
|
||||
font_p = dejavu_8_get_dsc();
|
||||
break;
|
||||
#endif
|
||||
#if USE_FONT_DEJAVU_10 != 0
|
||||
case FONT_DEJAVU_10:
|
||||
font_p = dejavu_10_get_dsc();
|
||||
break;
|
||||
#endif
|
||||
#if USE_FONT_DEJAVU_14 != 0
|
||||
case FONT_DEJAVU_14:
|
||||
font_p = dejavu_14_get_dsc();
|
||||
break;
|
||||
#endif
|
||||
#if USE_FONT_DEJAVU_20 != 0
|
||||
case FONT_DEJAVU_20:
|
||||
font_p = dejavu_20_get_dsc();
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if USE_FONT_DEJAVU_30 != 0
|
||||
case FONT_DEJAVU_30:
|
||||
font_p = dejavu_30_get_dsc();
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if USE_FONT_DEJAVU_40 != 0
|
||||
case FONT_DEJAVU_40:
|
||||
font_p = dejavu_40_get_dsc();
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if USE_FONT_DEJAVU_60 != 0
|
||||
case FONT_DEJAVU_60:
|
||||
font_p = dejavu_60_get_dsc();
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if USE_FONT_DEJAVU_80 != 0
|
||||
case FONT_DEJAVU_80:
|
||||
font_p = dejavu_80_get_dsc();
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if USE_FONT_SYMBOL_30 != 0
|
||||
case FONT_SYMBOL_30:
|
||||
font_p = symbol_30_get_dsc();
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if USE_FONT_SYMBOL_60 != 0
|
||||
case FONT_SYMBOL_60:
|
||||
font_p = symbol_60_get_dsc();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
font_p = NULL;
|
||||
}
|
||||
|
||||
return font_p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return with the bitmap of a font.
|
||||
* @param font_p pointer to a font
|
||||
* @param letter a letter
|
||||
* @return pointer to the bitmap of the letter
|
||||
*/
|
||||
const uint8_t * font_get_bitmap(const font_t * font_p, uint8_t letter)
|
||||
{
|
||||
if(letter < font_p->start_ascii || letter >= font_p->start_ascii + font_p->letter_cnt) return NULL;
|
||||
|
||||
uint32_t index = (letter - font_p->start_ascii) * font_p->height_row * font_p->width_byte;
|
||||
return &font_p->bitmaps_a[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the width of a letter in a font
|
||||
* @param font_p pointer to a font
|
||||
* @param letter a letter
|
||||
* @return the width of a letter
|
||||
*/
|
||||
uint8_t font_get_width(const font_t * font_p, uint8_t letter)
|
||||
{
|
||||
if(letter < font_p->start_ascii) return 0;
|
||||
|
||||
letter -= font_p->start_ascii;
|
||||
uint8_t w = 0;
|
||||
if(letter < font_p->letter_cnt) {
|
||||
w = font_p->fixed_width != 0 ? font_p->fixed_width :
|
||||
font_p->width_bit_a[letter];
|
||||
}
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
|
||||
115
lv_misc/font.h
115
lv_misc/font.h
@@ -1,115 +0,0 @@
|
||||
/**
|
||||
* @file font.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef FONT_H
|
||||
#define FONT_H
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_conf.h"
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
#if USE_FONT_DEJAVU_8 != 0
|
||||
FONT_DEJAVU_8,
|
||||
#endif
|
||||
#if USE_FONT_DEJAVU_10 != 0
|
||||
FONT_DEJAVU_10,
|
||||
#endif
|
||||
#if USE_FONT_DEJAVU_14 != 0
|
||||
FONT_DEJAVU_14,
|
||||
#endif
|
||||
#if USE_FONT_DEJAVU_20 != 0
|
||||
FONT_DEJAVU_20,
|
||||
#endif
|
||||
#if USE_FONT_DEJAVU_30 != 0
|
||||
FONT_DEJAVU_30,
|
||||
#endif
|
||||
#if USE_FONT_DEJAVU_40 != 0
|
||||
FONT_DEJAVU_40,
|
||||
#endif
|
||||
#if USE_FONT_DEJAVU_60 != 0
|
||||
FONT_DEJAVU_60,
|
||||
#endif
|
||||
#if USE_FONT_DEJAVU_80 != 0
|
||||
FONT_DEJAVU_80,
|
||||
#endif
|
||||
#if USE_FONT_SYMBOL_30 != 0
|
||||
FONT_SYMBOL_30,
|
||||
#endif
|
||||
#if USE_FONT_SYMBOL_60 != 0
|
||||
FONT_SYMBOL_60,
|
||||
#endif
|
||||
FONT_TYPE_NUM,
|
||||
}font_types_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t letter_cnt;
|
||||
uint8_t start_ascii;
|
||||
uint8_t width_byte;
|
||||
uint8_t height_row;
|
||||
uint8_t fixed_width;
|
||||
const uint8_t * width_bit_a;
|
||||
const uint8_t * bitmaps_a;
|
||||
}font_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Get the font from its id
|
||||
* @param font_id: the id of a font (an element of font_types_t enum)
|
||||
* @return pointer to a font descriptor
|
||||
*/
|
||||
const font_t * font_get(font_types_t font_id);
|
||||
|
||||
|
||||
/**
|
||||
* Return with the bitmap of a font.
|
||||
* @param font_p pointer to a font
|
||||
* @param letter a letter
|
||||
* @return pointer to the bitmap of the letter
|
||||
*/
|
||||
const uint8_t * font_get_bitmap(const font_t * font_p, uint8_t letter);
|
||||
|
||||
/**
|
||||
* Get the height of a font
|
||||
* @param font_p pointer to a font
|
||||
* @return the height of a font
|
||||
*/
|
||||
static inline uint8_t font_get_height(const font_t * font_p)
|
||||
{
|
||||
return font_p->height_row;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the width of a letter in a font
|
||||
* @param font_p pointer to a font
|
||||
* @param letter a letter
|
||||
* @return the width of a letter
|
||||
*/
|
||||
uint8_t font_get_width(const font_t * font_p, uint8_t letter);
|
||||
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,18 +0,0 @@
|
||||
#ifndef DEJAVU_10_H
|
||||
#define DEJAVU_10_H
|
||||
|
||||
/*Use ISO8859-1 encoding in the IDE*/
|
||||
|
||||
#include "lv_conf.h"
|
||||
#if USE_FONT_DEJAVU_10 != 0
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include "../font.h"
|
||||
|
||||
|
||||
const font_t * dejavu_10_get_dsc(void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,18 +0,0 @@
|
||||
#ifndef DEJAVU_14_H
|
||||
#define DEJAVU_14_H
|
||||
|
||||
/*Use ISO8859-1 encoding in the IDE*/
|
||||
|
||||
#include "lv_conf.h"
|
||||
#if USE_FONT_DEJAVU_14 != 0
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include "../font.h"
|
||||
|
||||
|
||||
const font_t * dejavu_14_get_dsc(void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,18 +0,0 @@
|
||||
#ifndef DEJAVU_20_H
|
||||
#define DEJAVU_20_H
|
||||
|
||||
/*Use ISO8859-1 encoding in the IDE*/
|
||||
|
||||
#include "misc_conf.h"
|
||||
#if USE_FONT_DEJAVU_20 != 0
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include "../font.h"
|
||||
|
||||
|
||||
const font_t * dejavu_20_get_dsc(void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,18 +0,0 @@
|
||||
#ifndef DEJAVU_30_H
|
||||
#define DEJAVU_30_H
|
||||
|
||||
/*Use ISO8859-1 encoding in the IDE*/
|
||||
|
||||
#include "lv_conf.h"
|
||||
#if USE_FONT_DEJAVU_30 != 0
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include "../font.h"
|
||||
|
||||
|
||||
const font_t * dejavu_30_get_dsc(void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,18 +0,0 @@
|
||||
#ifndef DEJAVU_40_H
|
||||
#define DEJAVU_40_H
|
||||
|
||||
/*Use ISO8859-1 encoding in the IDE*/
|
||||
|
||||
#include "lv_conf.h"
|
||||
#if USE_FONT_DEJAVU_40 != 0
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include "../font.h"
|
||||
|
||||
|
||||
const font_t * dejavu_40_get_dsc(void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,18 +0,0 @@
|
||||
#ifndef DEJAVU_60_H
|
||||
#define DEJAVU_60_H
|
||||
|
||||
/*Use ISO8859-1 encoding in the IDE*/
|
||||
|
||||
#include "lv_conf.h"
|
||||
#if USE_FONT_DEJAVU_60 != 0
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include "../font.h"
|
||||
|
||||
|
||||
const font_t * dejavu_60_get_dsc(void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,18 +0,0 @@
|
||||
#ifndef DEJAVU_8_H
|
||||
#define DEJAVU_8_H
|
||||
|
||||
/*Use ISO8859-1 encoding in the IDE*/
|
||||
|
||||
#include "lv_conf.h"
|
||||
#if USE_FONT_DEJAVU_8 != 0
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include "../font.h"
|
||||
|
||||
|
||||
const font_t * dejavu_8_get_dsc(void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,15 +0,0 @@
|
||||
#ifndef DEJAVU_80_H
|
||||
#define DEJAVU_80_H
|
||||
|
||||
/*Use ISO8859-1 encoding in the IDE*/
|
||||
#include "lv_conf.h"
|
||||
#if USE_FONT_DEJAVU_80 != 0
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include "../font.h"
|
||||
const font_t * dejavu_80_get_dsc(void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,867 +0,0 @@
|
||||
#include "lv_conf.h"
|
||||
#if USE_FONT_SYMBOL_30 != 0
|
||||
|
||||
#include <stdint.h>
|
||||
#include "../font.h"
|
||||
|
||||
static const uint8_t symbol_30_bitmaps[3120] =
|
||||
{
|
||||
// ASCII: 97, char width: 30
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x03, 0xff, 0xff, 0x00, // ------OOOOOOOOOOOOOOOOOO------..
|
||||
0x07, 0xff, 0xff, 0x80, // -----OOOOOOOOOOOOOOOOOOOO-----..
|
||||
0x07, 0xff, 0xff, 0x80, // -----OOOOOOOOOOOOOOOOOOOO-----..
|
||||
0x07, 0xff, 0xff, 0x80, // -----OOOOOOOOOOOOOOOOOOOO-----..
|
||||
0x0f, 0xff, 0xff, 0xc0, // ----OOOOOOOOOOOOOOOOOOOOOO----..
|
||||
0x0f, 0xff, 0xff, 0xc0, // ----OOOOOOOOOOOOOOOOOOOOOO----..
|
||||
0x0f, 0xff, 0xff, 0xc0, // ----OOOOOOOOOOOOOOOOOOOOOO----..
|
||||
0x1f, 0xff, 0xff, 0xe0, // ---OOOOOOOOOOOOOOOOOOOOOOOO---..
|
||||
0x1f, 0xff, 0xff, 0xe0, // ---OOOOOOOOOOOOOOOOOOOOOOOO---..
|
||||
0x3f, 0xff, 0xff, 0xf0, // --OOOOOOOOOOOOOOOOOOOOOOOOOO--..
|
||||
0x3f, 0xff, 0xff, 0xf0, // --OOOOOOOOOOOOOOOOOOOOOOOOOO--..
|
||||
0x3f, 0xff, 0xff, 0xf0, // --OOOOOOOOOOOOOOOOOOOOOOOOOO--..
|
||||
0x7f, 0xff, 0xff, 0xf8, // -OOOOOOOOOOOOOOOOOOOOOOOOOOOO-..
|
||||
0x7f, 0xff, 0xff, 0xf8, // -OOOOOOOOOOOOOOOOOOOOOOOOOOOO-..
|
||||
0x7f, 0xff, 0xff, 0xf8, // -OOOOOOOOOOOOOOOOOOOOOOOOOOOO-..
|
||||
0xff, 0xff, 0xff, 0xfc, // OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO..
|
||||
0xff, 0xff, 0xff, 0xfc, // OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO..
|
||||
0xff, 0xff, 0xff, 0xfc, // OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO..
|
||||
0xe0, 0x00, 0x00, 0x1c, // OOO------------------------OOO..
|
||||
0x60, 0x00, 0x00, 0x18, // -OO------------------------OO-..
|
||||
0x60, 0x00, 0x03, 0x18, // -OO-------------------OO---OO-..
|
||||
0x60, 0x00, 0x03, 0x18, // -OO-------------------OO---OO-..
|
||||
0x70, 0x00, 0x00, 0x38, // -OOO----------------------OOO-..
|
||||
0x30, 0x00, 0x00, 0x30, // --OO----------------------OO--..
|
||||
0x3f, 0xff, 0xff, 0xf0, // --OOOOOOOOOOOOOOOOOOOOOOOOOO--..
|
||||
0x3f, 0xff, 0xff, 0xf0, // --OOOOOOOOOOOOOOOOOOOOOOOOOO--..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
|
||||
// ASCII: 98, char width: 26
|
||||
0xff, 0xfe, 0x40, 0x00, // OOOOOOOOOOOOOOO--O--------......
|
||||
0xff, 0xfe, 0x60, 0x00, // OOOOOOOOOOOOOOO--OO-------......
|
||||
0xff, 0xfe, 0x70, 0x00, // OOOOOOOOOOOOOOO--OOO------......
|
||||
0xff, 0xfe, 0x78, 0x00, // OOOOOOOOOOOOOOO--OOOO-----......
|
||||
0xff, 0xfe, 0x7c, 0x00, // OOOOOOOOOOOOOOO--OOOOO----......
|
||||
0xff, 0xfe, 0x7e, 0x00, // OOOOOOOOOOOOOOO--OOOOOO---......
|
||||
0xff, 0xfe, 0x7f, 0x00, // OOOOOOOOOOOOOOO--OOOOOOO--......
|
||||
0xff, 0xfe, 0x7f, 0x80, // OOOOOOOOOOOOOOO--OOOOOOOO-......
|
||||
0xff, 0xfe, 0x00, 0x00, // OOOOOOOOOOOOOOO-----------......
|
||||
0xff, 0xff, 0x00, 0x00, // OOOOOOOOOOOOOOOO----------......
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO......
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO......
|
||||
0xfe, 0x00, 0x1f, 0xc0, // OOOOOOO------------OOOOOOO......
|
||||
0xfe, 0x00, 0x1f, 0xc0, // OOOOOOO------------OOOOOOO......
|
||||
0xfe, 0x00, 0x1f, 0xc0, // OOOOOOO------------OOOOOOO......
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO......
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO......
|
||||
0xfe, 0x00, 0x1f, 0xc0, // OOOOOOO------------OOOOOOO......
|
||||
0xfe, 0x00, 0x1f, 0xc0, // OOOOOOO------------OOOOOOO......
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO......
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO......
|
||||
0xfe, 0x00, 0x1f, 0xc0, // OOOOOOO------------OOOOOOO......
|
||||
0xfe, 0x00, 0x1f, 0xc0, // OOOOOOO------------OOOOOOO......
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO......
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO......
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO......
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO......
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO......
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO......
|
||||
0xff, 0xff, 0xff, 0x80, // OOOOOOOOOOOOOOOOOOOOOOOOO-......
|
||||
|
||||
// ASCII: 99, char width: 32
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------------
|
||||
0x3f, 0xe0, 0x00, 0x00, // --OOOOOOOOO---------------------
|
||||
0x7f, 0xf0, 0x00, 0x00, // -OOOOOOOOOOO--------------------
|
||||
0xff, 0xf8, 0x00, 0x00, // OOOOOOOOOOOOO-------------------
|
||||
0xff, 0xf8, 0x00, 0x00, // OOOOOOOOOOOOO-------------------
|
||||
0xff, 0xff, 0xff, 0x00, // OOOOOOOOOOOOOOOOOOOOOOOO--------
|
||||
0xff, 0xff, 0xff, 0x80, // OOOOOOOOOOOOOOOOOOOOOOOOO-------
|
||||
0xff, 0xff, 0xff, 0x80, // OOOOOOOOOOOOOOOOOOOOOOOOO-------
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO------
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO------
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO------
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO------
|
||||
0xff, 0x80, 0x00, 0x00, // OOOOOOOOO-----------------------
|
||||
0xfe, 0x00, 0x00, 0x00, // OOOOOOO-------------------------
|
||||
0xfc, 0x3f, 0xff, 0xff, // OOOOOO----OOOOOOOOOOOOOOOOOOOOOO
|
||||
0xf8, 0xff, 0xff, 0xfe, // OOOOO---OOOOOOOOOOOOOOOOOOOOOOO-
|
||||
0xf1, 0xff, 0xff, 0xfe, // OOOO---OOOOOOOOOOOOOOOOOOOOOOOO-
|
||||
0xf3, 0xff, 0xff, 0xfc, // OOOO--OOOOOOOOOOOOOOOOOOOOOOOO--
|
||||
0xe7, 0xff, 0xff, 0xf8, // OOO--OOOOOOOOOOOOOOOOOOOOOOOO---
|
||||
0xcf, 0xff, 0xff, 0xf0, // OO--OOOOOOOOOOOOOOOOOOOOOOOO----
|
||||
0x8f, 0xff, 0xff, 0xe0, // O---OOOOOOOOOOOOOOOOOOOOOOO-----
|
||||
0x1f, 0xff, 0xff, 0xe0, // ---OOOOOOOOOOOOOOOOOOOOOOOO-----
|
||||
0x3f, 0xff, 0xff, 0xc0, // --OOOOOOOOOOOOOOOOOOOOOOOO------
|
||||
0x7f, 0xff, 0xff, 0x80, // -OOOOOOOOOOOOOOOOOOOOOOOO-------
|
||||
0x7f, 0xff, 0xfe, 0x00, // -OOOOOOOOOOOOOOOOOOOOOO---------
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------------
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------------
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------------
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------------
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------------
|
||||
|
||||
// ASCII: 100, char width: 24
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
0x00, 0xff, 0x00, 0x00, // --------OOOOOOOO--------........
|
||||
0x01, 0xff, 0x80, 0x00, // -------OOOOOOOOOO-------........
|
||||
0x03, 0x81, 0x80, 0x00, // ------OOO------OO-------........
|
||||
0x03, 0x01, 0xc0, 0x00, // ------OO-------OOO------........
|
||||
0xff, 0xff, 0xff, 0x00, // OOOOOOOOOOOOOOOOOOOOOOOO........
|
||||
0xff, 0xff, 0xff, 0x00, // OOOOOOOOOOOOOOOOOOOOOOOO........
|
||||
0x30, 0x00, 0x1c, 0x00, // --OO---------------OOO--........
|
||||
0x30, 0x00, 0x1c, 0x00, // --OO---------------OOO--........
|
||||
0x30, 0x00, 0x1c, 0x00, // --OO---------------OOO--........
|
||||
0x30, 0x00, 0x1c, 0x00, // --OO---------------OOO--........
|
||||
0x33, 0x99, 0x9c, 0x00, // --OO--OOO--OO--OO--OOO--........
|
||||
0x33, 0x99, 0x9c, 0x00, // --OO--OOO--OO--OO--OOO--........
|
||||
0x33, 0x99, 0x9c, 0x00, // --OO--OOO--OO--OO--OOO--........
|
||||
0x33, 0x99, 0x9c, 0x00, // --OO--OOO--OO--OO--OOO--........
|
||||
0x33, 0x99, 0x9c, 0x00, // --OO--OOO--OO--OO--OOO--........
|
||||
0x33, 0x99, 0x9c, 0x00, // --OO--OOO--OO--OO--OOO--........
|
||||
0x33, 0x99, 0x9c, 0x00, // --OO--OOO--OO--OO--OOO--........
|
||||
0x33, 0x99, 0x9c, 0x00, // --OO--OOO--OO--OO--OOO--........
|
||||
0x33, 0x99, 0x9c, 0x00, // --OO--OOO--OO--OO--OOO--........
|
||||
0x33, 0x99, 0x9c, 0x00, // --OO--OOO--OO--OO--OOO--........
|
||||
0x33, 0x99, 0x9c, 0x00, // --OO--OOO--OO--OO--OOO--........
|
||||
0x30, 0x00, 0x1c, 0x00, // --OO---------------OOO--........
|
||||
0x30, 0x00, 0x1c, 0x00, // --OO---------------OOO--........
|
||||
0x38, 0x00, 0x18, 0x00, // --OOO--------------OO---........
|
||||
0x1f, 0xff, 0xf8, 0x00, // ---OOOOOOOOOOOOOOOOOO---........
|
||||
0x1f, 0xff, 0xf0, 0x00, // ---OOOOOOOOOOOOOOOOO----........
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
|
||||
// ASCII: 101, char width: 26
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------......
|
||||
0xff, 0xff, 0xe0, 0x00, // OOOOOOOOOOOOOOOOOOO-------......
|
||||
0xff, 0xff, 0xf0, 0x00, // OOOOOOOOOOOOOOOOOOOO------......
|
||||
0xcf, 0xe1, 0xb8, 0x00, // OO--OOOOOOO----OO-OOO-----......
|
||||
0xcf, 0xe1, 0x9c, 0x00, // OO--OOOOOOO----OO--OOO----......
|
||||
0xcf, 0xe1, 0x8e, 0x00, // OO--OOOOOOO----OO---OOO---......
|
||||
0xcf, 0xe1, 0x87, 0x00, // OO--OOOOOOO----OO----OOO--......
|
||||
0xcf, 0xe1, 0x83, 0x80, // OO--OOOOOOO----OO-----OOO-......
|
||||
0xcf, 0xe1, 0x81, 0xc0, // OO--OOOOOOO----OO------OOO......
|
||||
0xcf, 0xe1, 0x81, 0xc0, // OO--OOOOOOO----OO------OOO......
|
||||
0xcf, 0xff, 0x81, 0xc0, // OO--OOOOOOOOOOOOO------OOO......
|
||||
0xc7, 0xff, 0x81, 0xc0, // OO---OOOOOOOOOOOO------OOO......
|
||||
0xc0, 0x00, 0x01, 0xc0, // OO---------------------OOO......
|
||||
0xc0, 0x00, 0x01, 0xc0, // OO---------------------OOO......
|
||||
0xc0, 0x00, 0x01, 0xc0, // OO---------------------OOO......
|
||||
0xc0, 0x00, 0x01, 0xc0, // OO---------------------OOO......
|
||||
0xc7, 0xff, 0xf9, 0xc0, // OO---OOOOOOOOOOOOOOOO--OOO......
|
||||
0xcf, 0xff, 0xfd, 0xc0, // OO--OOOOOOOOOOOOOOOOOO-OOO......
|
||||
0xce, 0x00, 0x1d, 0xc0, // OO--OOO------------OOO-OOO......
|
||||
0xce, 0x00, 0x1d, 0xc0, // OO--OOO------------OOO-OOO......
|
||||
0xce, 0x00, 0x1d, 0xc0, // OO--OOO------------OOO-OOO......
|
||||
0xce, 0x00, 0x1d, 0xc0, // OO--OOO------------OOO-OOO......
|
||||
0xce, 0x00, 0x1d, 0xc0, // OO--OOO------------OOO-OOO......
|
||||
0xce, 0x00, 0x1d, 0xc0, // OO--OOO------------OOO-OOO......
|
||||
0xce, 0x00, 0x1d, 0xc0, // OO--OOO------------OOO-OOO......
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO......
|
||||
0xff, 0xff, 0xff, 0x80, // OOOOOOOOOOOOOOOOOOOOOOOOO-......
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------......
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------......
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------......
|
||||
|
||||
// ASCII: 102, char width: 26
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------......
|
||||
0x00, 0x00, 0x38, 0x00, // ------------------OOO-----......
|
||||
0x00, 0x00, 0x7c, 0x00, // -----------------OOOOO----......
|
||||
0x00, 0x00, 0xfe, 0x00, // ----------------OOOOOOO---......
|
||||
0x00, 0x01, 0xff, 0x00, // ---------------OOOOOOOOO--......
|
||||
0x00, 0x00, 0xff, 0x80, // ----------------OOOOOOOOO-......
|
||||
0x00, 0x06, 0x7f, 0x80, // -------------OO--OOOOOOOO-......
|
||||
0x00, 0x0f, 0x3f, 0x80, // ------------OOOO--OOOOOOO-......
|
||||
0x00, 0x1f, 0x9f, 0x80, // -----------OOOOOO--OOOOOO-......
|
||||
0x00, 0x3f, 0xcf, 0x00, // ----------OOOOOOOO--OOOO--......
|
||||
0x00, 0x7b, 0xe6, 0x00, // ---------OOOO-OOOOO--OO---......
|
||||
0x00, 0xf7, 0xf0, 0x00, // --------OOOO-OOOOOOO------......
|
||||
0x01, 0xef, 0xf8, 0x00, // -------OOOO-OOOOOOOOO-----......
|
||||
0x03, 0xdf, 0xf0, 0x00, // ------OOOO-OOOOOOOOO------......
|
||||
0x07, 0xbf, 0xe0, 0x00, // -----OOOO-OOOOOOOOO-------......
|
||||
0x0f, 0x7f, 0xc0, 0x00, // ----OOOO-OOOOOOOOO--------......
|
||||
0x1e, 0xff, 0x80, 0x00, // ---OOOO-OOOOOOOOO---------......
|
||||
0x3d, 0xff, 0x00, 0x00, // --OOOO-OOOOOOOOO----------......
|
||||
0x7b, 0xfe, 0x00, 0x00, // -OOOO-OOOOOOOOO-----------......
|
||||
0xff, 0xfc, 0x00, 0x00, // OOOOOOOOOOOOOO------------......
|
||||
0xe7, 0xf8, 0x00, 0x00, // OOO--OOOOOOOO-------------......
|
||||
0xc3, 0xf0, 0x00, 0x00, // OO----OOOOOO--------------......
|
||||
0xc1, 0xe0, 0x00, 0x00, // OO-----OOOO---------------......
|
||||
0xf1, 0xc0, 0x00, 0x00, // OOOO---OOO----------------......
|
||||
0xf1, 0xc0, 0x00, 0x00, // OOOO---OOO----------------......
|
||||
0xff, 0x80, 0x00, 0x00, // OOOOOOOOO-----------------......
|
||||
0xff, 0x00, 0x00, 0x00, // OOOOOOOO------------------......
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------......
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------......
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------......
|
||||
|
||||
// ASCII: 103, char width: 30
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x03, 0xc0, // ----------------------OOOO----..
|
||||
0x00, 0x00, 0x07, 0xe0, // ---------------------OOOOOO---..
|
||||
0x00, 0x00, 0x0f, 0xf0, // --------------------OOOOOOOO--..
|
||||
0x00, 0x00, 0x0f, 0xf0, // --------------------OOOOOOOO--..
|
||||
0x00, 0x00, 0x1f, 0xf0, // -------------------OOOOOOOOO--..
|
||||
0x00, 0x00, 0x3f, 0xe0, // ------------------OOOOOOOOO---..
|
||||
0x06, 0x00, 0x7f, 0xc0, // -----OO----------OOOOOOOOO----..
|
||||
0x0f, 0x00, 0xff, 0x80, // ----OOOO--------OOOOOOOOO-----..
|
||||
0x1f, 0x81, 0xff, 0x00, // ---OOOOOO------OOOOOOOOO------..
|
||||
0x3f, 0xc3, 0xfe, 0x00, // --OOOOOOOO----OOOOOOOOO-------..
|
||||
0x3f, 0xe7, 0xfc, 0x00, // --OOOOOOOOO--OOOOOOOOO--------..
|
||||
0x1f, 0xff, 0xf8, 0x00, // ---OOOOOOOOOOOOOOOOOO---------..
|
||||
0x0f, 0xff, 0xf0, 0x00, // ----OOOOOOOOOOOOOOOO----------..
|
||||
0x07, 0xff, 0xe0, 0x00, // -----OOOOOOOOOOOOOO-----------..
|
||||
0x03, 0xff, 0xc0, 0x00, // ------OOOOOOOOOOOO------------..
|
||||
0x01, 0xff, 0x80, 0x00, // -------OOOOOOOOOO-------------..
|
||||
0x00, 0xff, 0x00, 0x00, // --------OOOOOOOO--------------..
|
||||
0x00, 0x7e, 0x00, 0x00, // ---------OOOOOO---------------..
|
||||
0x00, 0x3c, 0x00, 0x00, // ----------OOOO----------------..
|
||||
0x00, 0x18, 0x00, 0x00, // -----------OO-----------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
|
||||
// ASCII: 104, char width: 24
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
0x0e, 0x00, 0x60, 0x00, // ----OOO----------OO-----........
|
||||
0x0f, 0x00, 0xf0, 0x00, // ----OOOO--------OOOO----........
|
||||
0x1f, 0x81, 0xf8, 0x00, // ---OOOOOO------OOOOOO---........
|
||||
0x3f, 0xc3, 0xfc, 0x00, // --OOOOOOOO----OOOOOOOO--........
|
||||
0x3f, 0xe7, 0xfc, 0x00, // --OOOOOOOOO--OOOOOOOOO--........
|
||||
0x1f, 0xff, 0xf8, 0x00, // ---OOOOOOOOOOOOOOOOOO---........
|
||||
0x0f, 0xff, 0xf0, 0x00, // ----OOOOOOOOOOOOOOOO----........
|
||||
0x07, 0xff, 0xe0, 0x00, // -----OOOOOOOOOOOOOO-----........
|
||||
0x03, 0xff, 0xc0, 0x00, // ------OOOOOOOOOOOO------........
|
||||
0x01, 0xff, 0x80, 0x00, // -------OOOOOOOOOO-------........
|
||||
0x01, 0xff, 0x80, 0x00, // -------OOOOOOOOOO-------........
|
||||
0x03, 0xff, 0xc0, 0x00, // ------OOOOOOOOOOOO------........
|
||||
0x07, 0xff, 0xe0, 0x00, // -----OOOOOOOOOOOOOO-----........
|
||||
0x0f, 0xff, 0xf0, 0x00, // ----OOOOOOOOOOOOOOOO----........
|
||||
0x1f, 0xff, 0xf8, 0x00, // ---OOOOOOOOOOOOOOOOOO---........
|
||||
0x3f, 0xe7, 0xfc, 0x00, // --OOOOOOOOO--OOOOOOOOO--........
|
||||
0x3f, 0xc3, 0xfc, 0x00, // --OOOOOOOO----OOOOOOOO--........
|
||||
0x3f, 0x81, 0xf8, 0x00, // --OOOOOOO------OOOOOO---........
|
||||
0x1f, 0x00, 0xf0, 0x00, // ---OOOOO--------OOOO----........
|
||||
0x0e, 0x00, 0x60, 0x00, // ----OOO----------OO-----........
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
|
||||
// ASCII: 105, char width: 30
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x0c, 0x00, 0x00, 0xc0, // ----OO------------------OO----..
|
||||
0x1e, 0x00, 0x01, 0xe0, // ---OOOO----------------OOOO---..
|
||||
0x3f, 0x00, 0x03, 0xf0, // --OOOOOO--------------OOOOOO--..
|
||||
0x3f, 0x80, 0x07, 0xf8, // --OOOOOOO------------OOOOOOOO-..
|
||||
0x7f, 0xc0, 0x0f, 0xf0, // -OOOOOOOOO----------OOOOOOOO--..
|
||||
0x3f, 0xe0, 0x1f, 0xf0, // --OOOOOOOOO--------OOOOOOOOO--..
|
||||
0x1f, 0xf0, 0x3f, 0xe0, // ---OOOOOOOOO------OOOOOOOOO---..
|
||||
0x0f, 0xf8, 0x7f, 0xc0, // ----OOOOOOOOO----OOOOOOOOO----..
|
||||
0x07, 0xfc, 0xff, 0x80, // -----OOOOOOOOO--OOOOOOOOO-----..
|
||||
0x03, 0xff, 0xff, 0x00, // ------OOOOOOOOOOOOOOOOOO------..
|
||||
0x01, 0xff, 0xfe, 0x00, // -------OOOOOOOOOOOOOOOO-------..
|
||||
0x00, 0xff, 0xfc, 0x00, // --------OOOOOOOOOOOOOO--------..
|
||||
0x00, 0x7f, 0xf8, 0x00, // ---------OOOOOOOOOOOO---------..
|
||||
0x00, 0x3f, 0xf0, 0x00, // ----------OOOOOOOOOO----------..
|
||||
0x00, 0x1f, 0xe0, 0x00, // -----------OOOOOOOO-----------..
|
||||
0x00, 0x0f, 0xc0, 0x00, // ------------OOOOOO------------..
|
||||
0x00, 0x07, 0x80, 0x00, // -------------OOOO-------------..
|
||||
0x00, 0x03, 0x00, 0x00, // --------------OO--------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
|
||||
// ASCII: 106, char width: 21
|
||||
0x00, 0x03, 0xc0, 0x00, // --------------OOOO---...........
|
||||
0x00, 0x07, 0xe0, 0x00, // -------------OOOOOO--...........
|
||||
0x00, 0x0f, 0xf0, 0x00, // ------------OOOOOOOO-...........
|
||||
0x00, 0x1f, 0xf0, 0x00, // -----------OOOOOOOOO-...........
|
||||
0x00, 0x3f, 0xe0, 0x00, // ----------OOOOOOOOO--...........
|
||||
0x00, 0x7f, 0xc0, 0x00, // ---------OOOOOOOOO---...........
|
||||
0x00, 0xff, 0x80, 0x00, // --------OOOOOOOOO----...........
|
||||
0x01, 0xff, 0x00, 0x00, // -------OOOOOOOOO-----...........
|
||||
0x03, 0xfe, 0x00, 0x00, // ------OOOOOOOOO------...........
|
||||
0x07, 0xfc, 0x00, 0x00, // -----OOOOOOOOO-------...........
|
||||
0x0f, 0xf8, 0x00, 0x00, // ----OOOOOOOOO--------...........
|
||||
0x0f, 0xf0, 0x00, 0x00, // ----OOOOOOOO---------...........
|
||||
0x1f, 0xe0, 0x00, 0x00, // ---OOOOOOOO----------...........
|
||||
0x3f, 0xe0, 0x00, 0x00, // --OOOOOOOOO----------...........
|
||||
0x0f, 0xf0, 0x00, 0x00, // ----OOOOOOOO---------...........
|
||||
0x0f, 0xf8, 0x00, 0x00, // ----OOOOOOOOO--------...........
|
||||
0x07, 0xfc, 0x00, 0x00, // -----OOOOOOOOO-------...........
|
||||
0x03, 0xfe, 0x00, 0x00, // ------OOOOOOOOO------...........
|
||||
0x01, 0xff, 0x00, 0x00, // -------OOOOOOOOO-----...........
|
||||
0x00, 0xff, 0x80, 0x00, // --------OOOOOOOOO----...........
|
||||
0x00, 0x7f, 0xc0, 0x00, // ---------OOOOOOOOO---...........
|
||||
0x00, 0x3f, 0xe0, 0x00, // ----------OOOOOOOOO--...........
|
||||
0x00, 0x1f, 0xf0, 0x00, // -----------OOOOOOOOO-...........
|
||||
0x00, 0x0f, 0xf0, 0x00, // ------------OOOOOOOO-...........
|
||||
0x00, 0x07, 0xe0, 0x00, // -------------OOOOOO--...........
|
||||
0x00, 0x03, 0xc0, 0x00, // --------------OOOO---...........
|
||||
0x00, 0x01, 0x80, 0x00, // ---------------OO----...........
|
||||
0x00, 0x00, 0x00, 0x00, // ---------------------...........
|
||||
0x00, 0x00, 0x00, 0x00, // ---------------------...........
|
||||
0x00, 0x00, 0x00, 0x00, // ---------------------...........
|
||||
|
||||
// ASCII: 107, char width: 21
|
||||
0x1e, 0x00, 0x00, 0x00, // ---OOOO--------------...........
|
||||
0x3f, 0x00, 0x00, 0x00, // --OOOOOO-------------...........
|
||||
0x3f, 0x80, 0x00, 0x00, // --OOOOOOO------------...........
|
||||
0x7f, 0xc0, 0x00, 0x00, // -OOOOOOOOO-----------...........
|
||||
0x3f, 0xe0, 0x00, 0x00, // --OOOOOOOOO----------...........
|
||||
0x1f, 0xf0, 0x00, 0x00, // ---OOOOOOOOO---------...........
|
||||
0x0f, 0xf8, 0x00, 0x00, // ----OOOOOOOOO--------...........
|
||||
0x07, 0xfc, 0x00, 0x00, // -----OOOOOOOOO-------...........
|
||||
0x03, 0xfe, 0x00, 0x00, // ------OOOOOOOOO------...........
|
||||
0x01, 0xff, 0x00, 0x00, // -------OOOOOOOOO-----...........
|
||||
0x00, 0xff, 0x80, 0x00, // --------OOOOOOOOO----...........
|
||||
0x00, 0x7f, 0xc0, 0x00, // ---------OOOOOOOOO---...........
|
||||
0x00, 0x3f, 0xe0, 0x00, // ----------OOOOOOOOO--...........
|
||||
0x00, 0x3f, 0xe0, 0x00, // ----------OOOOOOOOO--...........
|
||||
0x00, 0x7f, 0xc0, 0x00, // ---------OOOOOOOOO---...........
|
||||
0x00, 0xff, 0x80, 0x00, // --------OOOOOOOOO----...........
|
||||
0x01, 0xff, 0x00, 0x00, // -------OOOOOOOOO-----...........
|
||||
0x03, 0xfe, 0x00, 0x00, // ------OOOOOOOOO------...........
|
||||
0x07, 0xfc, 0x00, 0x00, // -----OOOOOOOOO-------...........
|
||||
0x0f, 0xf8, 0x00, 0x00, // ----OOOOOOOOO--------...........
|
||||
0x1f, 0xf0, 0x00, 0x00, // ---OOOOOOOOO---------...........
|
||||
0x1f, 0xe0, 0x00, 0x00, // ---OOOOOOOO----------...........
|
||||
0x3f, 0xc0, 0x00, 0x00, // --OOOOOOOO-----------...........
|
||||
0x7f, 0x80, 0x00, 0x00, // -OOOOOOOO------------...........
|
||||
0x3f, 0x00, 0x00, 0x00, // --OOOOOO-------------...........
|
||||
0x1e, 0x00, 0x00, 0x00, // ---OOOO--------------...........
|
||||
0x0c, 0x00, 0x00, 0x00, // ----OO---------------...........
|
||||
0x00, 0x00, 0x00, 0x00, // ---------------------...........
|
||||
0x00, 0x00, 0x00, 0x00, // ---------------------...........
|
||||
0x00, 0x00, 0x00, 0x00, // ---------------------...........
|
||||
|
||||
// ASCII: 108, char width: 30
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x03, 0x00, 0x00, // --------------OO--------------..
|
||||
0x00, 0x07, 0x80, 0x00, // -------------OOOO-------------..
|
||||
0x00, 0x0f, 0xc0, 0x00, // ------------OOOOOO------------..
|
||||
0x00, 0x1f, 0xe0, 0x00, // -----------OOOOOOOO-----------..
|
||||
0x00, 0x3f, 0xf0, 0x00, // ----------OOOOOOOOOO----------..
|
||||
0x00, 0x7f, 0xf8, 0x00, // ---------OOOOOOOOOOOO---------..
|
||||
0x00, 0xff, 0xfc, 0x00, // --------OOOOOOOOOOOOOO--------..
|
||||
0x01, 0xff, 0xfe, 0x00, // -------OOOOOOOOOOOOOOOO-------..
|
||||
0x03, 0xff, 0xff, 0x00, // ------OOOOOOOOOOOOOOOOOO------..
|
||||
0x07, 0xfc, 0xff, 0x80, // -----OOOOOOOOO--OOOOOOOOO-----..
|
||||
0x0f, 0xf8, 0x7f, 0xc0, // ----OOOOOOOOO----OOOOOOOOO----..
|
||||
0x1f, 0xf0, 0x3f, 0xe0, // ---OOOOOOOOO------OOOOOOOOO---..
|
||||
0x3f, 0xe0, 0x1f, 0xf0, // --OOOOOOOOO--------OOOOOOOOO--..
|
||||
0x3f, 0xc0, 0x0f, 0xf0, // --OOOOOOOO----------OOOOOOOO--..
|
||||
0x7f, 0x80, 0x07, 0xf8, // -OOOOOOOO------------OOOOOOOO-..
|
||||
0x3f, 0x00, 0x03, 0xf0, // --OOOOOO--------------OOOOOO--..
|
||||
0x1e, 0x00, 0x01, 0xe0, // ---OOOO----------------OOOO---..
|
||||
0x0c, 0x00, 0x00, 0xc0, // ----OO------------------OO----..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
|
||||
// ASCII: 109, char width: 17
|
||||
0x01, 0x80, 0x00, 0x00, // -------OO--------...............
|
||||
0x01, 0xc0, 0x00, 0x00, // -------OOO-------...............
|
||||
0x01, 0xe0, 0x00, 0x00, // -------OOOO------...............
|
||||
0x01, 0xf0, 0x00, 0x00, // -------OOOOO-----...............
|
||||
0x01, 0xf8, 0x00, 0x00, // -------OOOOOO----...............
|
||||
0x01, 0xfc, 0x00, 0x00, // -------OOOOOOO---...............
|
||||
0x21, 0xde, 0x00, 0x00, // --O----OOO-OOOO--...............
|
||||
0x71, 0xcf, 0x00, 0x00, // -OOO---OOO--OOOO-...............
|
||||
0x79, 0xcf, 0x80, 0x00, // -OOOO--OOO--OOOOO...............
|
||||
0x3d, 0xde, 0x00, 0x00, // --OOOO-OOO-OOOO--...............
|
||||
0x1f, 0xfc, 0x00, 0x00, // ---OOOOOOOOOOO---...............
|
||||
0x0f, 0xf8, 0x00, 0x00, // ----OOOOOOOOO----...............
|
||||
0x07, 0xf0, 0x00, 0x00, // -----OOOOOOO-----...............
|
||||
0x03, 0xe0, 0x00, 0x00, // ------OOOOO------...............
|
||||
0x01, 0xe0, 0x00, 0x00, // -------OOOO------...............
|
||||
0x03, 0xf0, 0x00, 0x00, // ------OOOOOO-----...............
|
||||
0x07, 0xf8, 0x00, 0x00, // -----OOOOOOOO----...............
|
||||
0x0f, 0xfc, 0x00, 0x00, // ----OOOOOOOOOO---...............
|
||||
0x1d, 0xde, 0x00, 0x00, // ---OOO-OOO-OOOO--...............
|
||||
0x39, 0xcf, 0x00, 0x00, // --OOO--OOO--OOOO-...............
|
||||
0x71, 0xc7, 0x80, 0x00, // -OOO---OOO---OOOO...............
|
||||
0x71, 0xce, 0x00, 0x00, // -OOO---OOO--OOO--...............
|
||||
0x01, 0xfc, 0x00, 0x00, // -------OOOOOOO---...............
|
||||
0x01, 0xf8, 0x00, 0x00, // -------OOOOOO----...............
|
||||
0x01, 0xf8, 0x00, 0x00, // -------OOOOOO----...............
|
||||
0x01, 0xf0, 0x00, 0x00, // -------OOOOO-----...............
|
||||
0x01, 0xe0, 0x00, 0x00, // -------OOOO------...............
|
||||
0x01, 0xc0, 0x00, 0x00, // -------OOO-------...............
|
||||
0x01, 0x80, 0x00, 0x00, // -------OO--------...............
|
||||
0x00, 0x00, 0x00, 0x00, // -----------------...............
|
||||
|
||||
// ASCII: 110, char width: 17
|
||||
0x0f, 0xe0, 0x00, 0x00, // ----OOOOOOO------...............
|
||||
0x1c, 0x70, 0x00, 0x00, // ---OOO---OOO-----...............
|
||||
0x38, 0x38, 0x00, 0x00, // --OOO-----OOO----...............
|
||||
0x38, 0x18, 0x00, 0x00, // --OOO------OO----...............
|
||||
0x30, 0x1b, 0x80, 0x00, // --OO-------OO-OOO...............
|
||||
0x30, 0x1b, 0x80, 0x00, // --OO-------OO-OOO...............
|
||||
0x30, 0x18, 0x00, 0x00, // --OO-------OO----...............
|
||||
0x30, 0x18, 0x00, 0x00, // --OO-------OO----...............
|
||||
0x33, 0x9b, 0x80, 0x00, // --OO--OOO--OO-OOO...............
|
||||
0x33, 0x9b, 0x80, 0x00, // --OO--OOO--OO-OOO...............
|
||||
0x33, 0x98, 0x00, 0x00, // --OO--OOO--OO----...............
|
||||
0x33, 0x98, 0x00, 0x00, // --OO--OOO--OO----...............
|
||||
0x33, 0x98, 0x00, 0x00, // --OO--OOO--OO----...............
|
||||
0x33, 0x9b, 0x80, 0x00, // --OO--OOO--OO-OOO...............
|
||||
0x33, 0x9b, 0x80, 0x00, // --OO--OOO--OO-OOO...............
|
||||
0x33, 0x98, 0x00, 0x00, // --OO--OOO--OO----...............
|
||||
0x33, 0x98, 0x00, 0x00, // --OO--OOO--OO----...............
|
||||
0x33, 0x98, 0x00, 0x00, // --OO--OOO--OO----...............
|
||||
0x73, 0x9c, 0x00, 0x00, // -OOO--OOO--OOO---...............
|
||||
0x63, 0x8c, 0x00, 0x00, // -OO---OOO---OO---...............
|
||||
0xe7, 0xce, 0x00, 0x00, // OOO--OOOOO--OOO--...............
|
||||
0xcf, 0xe6, 0x00, 0x00, // OO--OOOOOOO--OO--...............
|
||||
0xcf, 0xe6, 0x00, 0x00, // OO--OOOOOOO--OO--...............
|
||||
0xcf, 0xe6, 0x00, 0x00, // OO--OOOOOOO--OO--...............
|
||||
0xe7, 0xce, 0x00, 0x00, // OOO--OOOOO--OOO--...............
|
||||
0xe3, 0x8c, 0x00, 0x00, // OOO---OOO---OO---...............
|
||||
0x70, 0x1c, 0x00, 0x00, // -OOO-------OOO---...............
|
||||
0x38, 0x38, 0x00, 0x00, // --OOO-----OOO----...............
|
||||
0x1f, 0xf0, 0x00, 0x00, // ---OOOOOOOOO-----...............
|
||||
0x07, 0xc0, 0x00, 0x00, // -----OOOOO-------...............
|
||||
|
||||
// ASCII: 111, char width: 24
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
0x00, 0x00, 0x06, 0x00, // ---------------------OO-........
|
||||
0x00, 0x00, 0x1f, 0x00, // -------------------OOOOO........
|
||||
0x00, 0x00, 0x7e, 0x00, // -----------------OOOOOO-........
|
||||
0x00, 0x01, 0xfe, 0x00, // ---------------OOOOOOOO-........
|
||||
0x00, 0x07, 0xfc, 0x00, // -------------OOOOOOOOO--........
|
||||
0x00, 0x1f, 0xfc, 0x00, // -----------OOOOOOOOOOO--........
|
||||
0x00, 0x7f, 0xf8, 0x00, // ---------OOOOOOOOOOOO---........
|
||||
0x01, 0xff, 0xf8, 0x00, // -------OOOOOOOOOOOOOO---........
|
||||
0x07, 0xff, 0xf0, 0x00, // -----OOOOOOOOOOOOOOO----........
|
||||
0x1f, 0xff, 0xf0, 0x00, // ---OOOOOOOOOOOOOOOOO----........
|
||||
0x7f, 0xff, 0xe0, 0x00, // -OOOOOOOOOOOOOOOOOO-----........
|
||||
0xff, 0xff, 0xe0, 0x00, // OOOOOOOOOOOOOOOOOOO-----........
|
||||
0xff, 0xff, 0xc0, 0x00, // OOOOOOOOOOOOOOOOOO------........
|
||||
0x00, 0x1f, 0xc0, 0x00, // -----------OOOOOOO------........
|
||||
0x00, 0x1f, 0x80, 0x00, // -----------OOOOOO-------........
|
||||
0x00, 0x1f, 0x80, 0x00, // -----------OOOOOO-------........
|
||||
0x00, 0x1f, 0x00, 0x00, // -----------OOOOO--------........
|
||||
0x00, 0x1f, 0x00, 0x00, // -----------OOOOO--------........
|
||||
0x00, 0x1e, 0x00, 0x00, // -----------OOOO---------........
|
||||
0x00, 0x1e, 0x00, 0x00, // -----------OOOO---------........
|
||||
0x00, 0x1c, 0x00, 0x00, // -----------OOO----------........
|
||||
0x00, 0x1c, 0x00, 0x00, // -----------OOO----------........
|
||||
0x00, 0x18, 0x00, 0x00, // -----------OO-----------........
|
||||
0x00, 0x18, 0x00, 0x00, // -----------OO-----------........
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
|
||||
// ASCII: 112, char width: 30
|
||||
0x00, 0x07, 0x80, 0x00, // -------------OOOO-------------..
|
||||
0x00, 0x0f, 0xc0, 0x00, // ------------OOOOOO------------..
|
||||
0x00, 0x0f, 0xc0, 0x00, // ------------OOOOOO------------..
|
||||
0x00, 0x1f, 0xe0, 0x00, // -----------OOOOOOOO-----------..
|
||||
0x00, 0x1f, 0xe0, 0x00, // -----------OOOOOOOO-----------..
|
||||
0x00, 0x3f, 0xf0, 0x00, // ----------OOOOOOOOOO----------..
|
||||
0x00, 0x3f, 0xf0, 0x00, // ----------OOOOOOOOOO----------..
|
||||
0x00, 0x7f, 0xf8, 0x00, // ---------OOOOOOOOOOOO---------..
|
||||
0x00, 0xf8, 0x7c, 0x00, // --------OOOOO----OOOOO--------..
|
||||
0x00, 0xf8, 0x7c, 0x00, // --------OOOOO----OOOOO--------..
|
||||
0x01, 0xf8, 0x7e, 0x00, // -------OOOOOO----OOOOOO-------..
|
||||
0x01, 0xf8, 0x7e, 0x00, // -------OOOOOO----OOOOOO-------..
|
||||
0x03, 0xf8, 0x7f, 0x00, // ------OOOOOOO----OOOOOOO------..
|
||||
0x03, 0xf8, 0x7f, 0x00, // ------OOOOOOO----OOOOOOO------..
|
||||
0x07, 0xf8, 0x7f, 0x80, // -----OOOOOOOO----OOOOOOOO-----..
|
||||
0x07, 0xf8, 0x7f, 0x80, // -----OOOOOOOO----OOOOOOOO-----..
|
||||
0x0f, 0xff, 0xff, 0xc0, // ----OOOOOOOOOOOOOOOOOOOOOO----..
|
||||
0x0f, 0xff, 0xff, 0xc0, // ----OOOOOOOOOOOOOOOOOOOOOO----..
|
||||
0x1f, 0xf8, 0x7f, 0xe0, // ---OOOOOOOOOO----OOOOOOOOOO---..
|
||||
0x1f, 0xf8, 0x7f, 0xe0, // ---OOOOOOOOOO----OOOOOOOOOO---..
|
||||
0x3f, 0xf8, 0x7f, 0xf0, // --OOOOOOOOOOO----OOOOOOOOOOO--..
|
||||
0x7f, 0xf8, 0x7f, 0xf8, // -OOOOOOOOOOOO----OOOOOOOOOOOO-..
|
||||
0x7f, 0xf8, 0x7f, 0xf8, // -OOOOOOOOOOOO----OOOOOOOOOOOO-..
|
||||
0xff, 0xff, 0xff, 0xfc, // OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO..
|
||||
0xff, 0xff, 0xff, 0xfc, // OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO..
|
||||
0xff, 0xff, 0xff, 0xfc, // OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO..
|
||||
0x7f, 0xff, 0xff, 0xf8, // -OOOOOOOOOOOOOOOOOOOOOOOOOOOO-..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
|
||||
// ASCII: 113, char width: 24
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
0x00, 0x7f, 0x00, 0x00, // ---------OOOOOOO--------........
|
||||
0x03, 0xff, 0xc0, 0x00, // ------OOOOOOOOOOOO------........
|
||||
0x07, 0xff, 0xf0, 0x00, // -----OOOOOOOOOOOOOOO----........
|
||||
0x0f, 0xff, 0xf8, 0x00, // ----OOOOOOOOOOOOOOOOO---........
|
||||
0x1f, 0xe3, 0xfc, 0x00, // ---OOOOOOOO---OOOOOOOO--........
|
||||
0x3f, 0xc3, 0xfc, 0x00, // --OOOOOOOO----OOOOOOOO--........
|
||||
0x7f, 0xc3, 0xfe, 0x00, // -OOOOOOOOO----OOOOOOOOO-........
|
||||
0x7f, 0xe3, 0xfe, 0x00, // -OOOOOOOOOO---OOOOOOOOO-........
|
||||
0x7f, 0xff, 0xff, 0x00, // -OOOOOOOOOOOOOOOOOOOOOOO........
|
||||
0xff, 0xff, 0xff, 0x00, // OOOOOOOOOOOOOOOOOOOOOOOO........
|
||||
0xff, 0xe3, 0xff, 0x00, // OOOOOOOOOOO---OOOOOOOOOO........
|
||||
0xff, 0xe3, 0xff, 0x00, // OOOOOOOOOOO---OOOOOOOOOO........
|
||||
0xff, 0xe3, 0xff, 0x00, // OOOOOOOOOOO---OOOOOOOOOO........
|
||||
0xff, 0xe3, 0xff, 0x00, // OOOOOOOOOOO---OOOOOOOOOO........
|
||||
0xff, 0xe3, 0xff, 0x00, // OOOOOOOOOOO---OOOOOOOOOO........
|
||||
0xff, 0xe3, 0xff, 0x00, // OOOOOOOOOOO---OOOOOOOOOO........
|
||||
0x7f, 0xe3, 0xff, 0x00, // -OOOOOOOOOO---OOOOOOOOOO........
|
||||
0x7f, 0xe3, 0xfe, 0x00, // -OOOOOOOOOO---OOOOOOOOO-........
|
||||
0x7f, 0xe3, 0xfe, 0x00, // -OOOOOOOOOO---OOOOOOOOO-........
|
||||
0x3f, 0xe3, 0xfc, 0x00, // --OOOOOOOOO---OOOOOOOO--........
|
||||
0x1f, 0xe3, 0xfc, 0x00, // ---OOOOOOOO---OOOOOOOO--........
|
||||
0x0f, 0xff, 0xf8, 0x00, // ----OOOOOOOOOOOOOOOOO---........
|
||||
0x07, 0xff, 0xf0, 0x00, // -----OOOOOOOOOOOOOOO----........
|
||||
0x03, 0xff, 0xc0, 0x00, // ------OOOOOOOOOOOO------........
|
||||
0x00, 0x7f, 0x00, 0x00, // ---------OOOOOOO--------........
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------........
|
||||
|
||||
// ASCII: 114, char width: 30
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x3f, 0xff, 0xff, 0x00, // --OOOOOOOOOOOOOOOOOOOOOO------..
|
||||
0x7f, 0xff, 0xff, 0xc0, // -OOOOOOOOOOOOOOOOOOOOOOOOO----..
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO----..
|
||||
0xf0, 0x00, 0x01, 0xe0, // OOOO-------------------OOOO---..
|
||||
0xe6, 0x00, 0x01, 0xf0, // OOO--OO----------------OOOOO--..
|
||||
0xe7, 0x00, 0x01, 0xf8, // OOO--OOO---------------OOOOOO-..
|
||||
0xe7, 0x00, 0x01, 0xfc, // OOO--OOO---------------OOOOOOO..
|
||||
0xe7, 0x00, 0x01, 0xfc, // OOO--OOO---------------OOOOOOO..
|
||||
0xe7, 0x00, 0x01, 0xfc, // OOO--OOO---------------OOOOOOO..
|
||||
0xe7, 0x00, 0x01, 0xfc, // OOO--OOO---------------OOOOOOO..
|
||||
0xe7, 0x00, 0x01, 0xfc, // OOO--OOO---------------OOOOOOO..
|
||||
0xe7, 0x00, 0x01, 0xfc, // OOO--OOO---------------OOOOOOO..
|
||||
0xe7, 0x00, 0x01, 0xf8, // OOO--OOO---------------OOOOOO-..
|
||||
0xe6, 0x00, 0x01, 0xf0, // OOO--OO----------------OOOOO--..
|
||||
0xe0, 0x00, 0x01, 0xe0, // OOO--------------------OOOO---..
|
||||
0xf0, 0x00, 0x01, 0xc0, // OOOO-------------------OOO----..
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO----..
|
||||
0x7f, 0xff, 0xff, 0x80, // -OOOOOOOOOOOOOOOOOOOOOOOO-----..
|
||||
0x3f, 0xff, 0xff, 0x00, // --OOOOOOOOOOOOOOOOOOOOOO------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
|
||||
// ASCII: 115, char width: 30
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x3f, 0xff, 0xff, 0x00, // --OOOOOOOOOOOOOOOOOOOOOO------..
|
||||
0x7f, 0xff, 0xff, 0xc0, // -OOOOOOOOOOOOOOOOOOOOOOOOO----..
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO----..
|
||||
0xf0, 0x00, 0x01, 0xe0, // OOOO-------------------OOOO---..
|
||||
0xe6, 0x30, 0x01, 0xf0, // OOO--OO---OO-----------OOOOO--..
|
||||
0xe7, 0x78, 0x01, 0xf8, // OOO--OOO-OOOO----------OOOOOO-..
|
||||
0xe7, 0x78, 0x01, 0xfc, // OOO--OOO-OOOO----------OOOOOOO..
|
||||
0xe7, 0x78, 0x01, 0xfc, // OOO--OOO-OOOO----------OOOOOOO..
|
||||
0xe7, 0x78, 0x01, 0xfc, // OOO--OOO-OOOO----------OOOOOOO..
|
||||
0xe7, 0x78, 0x01, 0xfc, // OOO--OOO-OOOO----------OOOOOOO..
|
||||
0xe7, 0x78, 0x01, 0xfc, // OOO--OOO-OOOO----------OOOOOOO..
|
||||
0xe7, 0x78, 0x01, 0xfc, // OOO--OOO-OOOO----------OOOOOOO..
|
||||
0xe7, 0x78, 0x01, 0xf8, // OOO--OOO-OOOO----------OOOOOO-..
|
||||
0xe6, 0x30, 0x01, 0xf0, // OOO--OO---OO-----------OOOOO--..
|
||||
0xe0, 0x00, 0x01, 0xe0, // OOO--------------------OOOO---..
|
||||
0xf0, 0x00, 0x01, 0xc0, // OOOO-------------------OOO----..
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO----..
|
||||
0x7f, 0xff, 0xff, 0x80, // -OOOOOOOOOOOOOOOOOOOOOOOO-----..
|
||||
0x3f, 0xff, 0xff, 0x00, // --OOOOOOOOOOOOOOOOOOOOOO------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
|
||||
// ASCII: 116, char width: 30
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x3f, 0xff, 0xff, 0x00, // --OOOOOOOOOOOOOOOOOOOOOO------..
|
||||
0x7f, 0xff, 0xff, 0xc0, // -OOOOOOOOOOOOOOOOOOOOOOOOO----..
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO----..
|
||||
0xf0, 0x00, 0x01, 0xe0, // OOOO-------------------OOOO---..
|
||||
0xe6, 0x33, 0x81, 0xf0, // OOO--OO---OO--OOO------OOOOO--..
|
||||
0xe7, 0x7b, 0x81, 0xf8, // OOO--OOO-OOOO-OOO------OOOOOO-..
|
||||
0xe7, 0x7b, 0x81, 0xfc, // OOO--OOO-OOOO-OOO------OOOOOOO..
|
||||
0xe7, 0x7b, 0x81, 0xfc, // OOO--OOO-OOOO-OOO------OOOOOOO..
|
||||
0xe7, 0x7b, 0x81, 0xfc, // OOO--OOO-OOOO-OOO------OOOOOOO..
|
||||
0xe7, 0x7b, 0x81, 0xfc, // OOO--OOO-OOOO-OOO------OOOOOOO..
|
||||
0xe7, 0x7b, 0x81, 0xfc, // OOO--OOO-OOOO-OOO------OOOOOOO..
|
||||
0xe7, 0x7b, 0x81, 0xfc, // OOO--OOO-OOOO-OOO------OOOOOOO..
|
||||
0xe7, 0x7b, 0x81, 0xf8, // OOO--OOO-OOOO-OOO------OOOOOO-..
|
||||
0xe6, 0x33, 0x81, 0xf0, // OOO--OO---OO--OOO------OOOOO--..
|
||||
0xe0, 0x00, 0x01, 0xe0, // OOO--------------------OOOO---..
|
||||
0xf0, 0x00, 0x01, 0xc0, // OOOO-------------------OOO----..
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO----..
|
||||
0x7f, 0xff, 0xff, 0x80, // -OOOOOOOOOOOOOOOOOOOOOOOO-----..
|
||||
0x3f, 0xff, 0xff, 0x00, // --OOOOOOOOOOOOOOOOOOOOOO------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
|
||||
// ASCII: 117, char width: 30
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x3f, 0xff, 0xff, 0x00, // --OOOOOOOOOOOOOOOOOOOOOO------..
|
||||
0x7f, 0xff, 0xff, 0xc0, // -OOOOOOOOOOOOOOOOOOOOOOOOO----..
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO----..
|
||||
0xf0, 0x00, 0x01, 0xe0, // OOOO-------------------OOOO---..
|
||||
0xe6, 0x33, 0x9d, 0xf0, // OOO--OO---OO--OOO--OOO-OOOOO--..
|
||||
0xe7, 0x7b, 0x9d, 0xf8, // OOO--OOO-OOOO-OOO--OOO-OOOOOO-..
|
||||
0xe7, 0x7b, 0x9d, 0xfc, // OOO--OOO-OOOO-OOO--OOO-OOOOOOO..
|
||||
0xe7, 0x7b, 0x9d, 0xfc, // OOO--OOO-OOOO-OOO--OOO-OOOOOOO..
|
||||
0xe7, 0x7b, 0x9d, 0xfc, // OOO--OOO-OOOO-OOO--OOO-OOOOOOO..
|
||||
0xe7, 0x7b, 0x9d, 0xfc, // OOO--OOO-OOOO-OOO--OOO-OOOOOOO..
|
||||
0xe7, 0x7b, 0x9d, 0xfc, // OOO--OOO-OOOO-OOO--OOO-OOOOOOO..
|
||||
0xe7, 0x7b, 0x9d, 0xfc, // OOO--OOO-OOOO-OOO--OOO-OOOOOOO..
|
||||
0xe7, 0x7b, 0x9d, 0xf8, // OOO--OOO-OOOO-OOO--OOO-OOOOOO-..
|
||||
0xe6, 0x33, 0x99, 0xf0, // OOO--OO---OO--OOO--OO--OOOOO--..
|
||||
0xe0, 0x00, 0x01, 0xe0, // OOO--------------------OOOO---..
|
||||
0xf0, 0x00, 0x01, 0xc0, // OOOO-------------------OOO----..
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO----..
|
||||
0x7f, 0xff, 0xff, 0x80, // -OOOOOOOOOOOOOOOOOOOOOOOO-----..
|
||||
0x3f, 0xff, 0xff, 0x00, // --OOOOOOOOOOOOOOOOOOOOOO------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
|
||||
// ASCII: 118, char width: 30
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x3f, 0xff, 0xff, 0x00, // --OOOOOOOOOOOOOOOOOOOOOO------..
|
||||
0x7f, 0xff, 0xff, 0xc0, // -OOOOOOOOOOOOOOOOOOOOOOOOO----..
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO----..
|
||||
0xf0, 0x00, 0x01, 0xe0, // OOOO-------------------OOOO---..
|
||||
0xe7, 0xff, 0xfd, 0xf0, // OOO--OOOOOOOOOOOOOOOOO-OOOOO--..
|
||||
0xe7, 0xff, 0xfd, 0xf8, // OOO--OOOOOOOOOOOOOOOOO-OOOOOO-..
|
||||
0xe7, 0xf7, 0xfd, 0xfc, // OOO--OOOOOOO-OOOOOOOOO-OOOOOOO..
|
||||
0xe7, 0xe3, 0xfd, 0xfc, // OOO--OOOOOO---OOOOOOOO-OOOOOOO..
|
||||
0xe7, 0xc3, 0xfd, 0xfc, // OOO--OOOOO----OOOOOOOO-OOOOOOO..
|
||||
0xe7, 0x70, 0x7d, 0xfc, // OOO--OOO-OOO-----OOOOO-OOOOOOO..
|
||||
0xe7, 0xf8, 0xfd, 0xfc, // OOO--OOOOOOOO---OOOOOO-OOOOOOO..
|
||||
0xe7, 0xff, 0xfd, 0xfc, // OOO--OOOOOOOOOOOOOOOOO-OOOOOOO..
|
||||
0xe7, 0xff, 0xfd, 0xf8, // OOO--OOOOOOOOOOOOOOOOO-OOOOOO-..
|
||||
0xe7, 0xff, 0xfd, 0xf0, // OOO--OOOOOOOOOOOOOOOOO-OOOOO--..
|
||||
0xe0, 0x00, 0x01, 0xe0, // OOO--------------------OOOO---..
|
||||
0xf0, 0x00, 0x01, 0xc0, // OOOO-------------------OOO----..
|
||||
0xff, 0xff, 0xff, 0xc0, // OOOOOOOOOOOOOOOOOOOOOOOOOO----..
|
||||
0x7f, 0xff, 0xff, 0x80, // -OOOOOOOOOOOOOOOOOOOOOOOO-----..
|
||||
0x3f, 0xff, 0xff, 0x00, // --OOOOOOOOOOOOOOOOOOOOOO------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
0x00, 0x00, 0x00, 0x00, // ------------------------------..
|
||||
|
||||
// ASCII: 119, char width: 30
|
||||
0x00, 0x7f, 0xf8, 0x00, // ---------OOOOOOOOOOOO---------..
|
||||
0x01, 0xf0, 0x3e, 0x00, // -------OOOOO------OOOOO-------..
|
||||
0x07, 0xc0, 0x0f, 0x80, // -----OOOOO----------OOOOO-----..
|
||||
0x0f, 0xc0, 0x0f, 0xc0, // ----OOOOOO----------OOOOOO----..
|
||||
0x1f, 0xe0, 0x1f, 0xe0, // ---OOOOOOOO--------OOOOOOOO---..
|
||||
0x1f, 0xe0, 0x1f, 0xe0, // ---OOOOOOOO--------OOOOOOOO---..
|
||||
0x3f, 0xff, 0xff, 0xf0, // --OOOOOOOOOOOOOOOOOOOOOOOOOO--..
|
||||
0x3f, 0xff, 0xff, 0xf0, // --OOOOOOOOOOOOOOOOOOOOOOOOOO--..
|
||||
0x7f, 0xf0, 0x7f, 0xf8, // -OOOOOOOOOOO-----OOOOOOOOOOOO-..
|
||||
0x67, 0xe0, 0x1f, 0x98, // -OO--OOOOOO--------OOOOOO--OO-..
|
||||
0xe3, 0xc0, 0x0f, 0x1c, // OOO---OOOO----------OOOO---OOO..
|
||||
0xe1, 0x80, 0x06, 0x1c, // OOO----OO------------OO----OOO..
|
||||
0xc1, 0x80, 0x06, 0x0c, // OO-----OO------------OO-----OO..
|
||||
0xc3, 0x80, 0x07, 0x0c, // OO----OOO------------OOO----OO..
|
||||
0xc3, 0x80, 0x07, 0x0c, // OO----OOO------------OOO----OO..
|
||||
0xc3, 0x80, 0x07, 0x0c, // OO----OOO------------OOO----OO..
|
||||
0xc1, 0x80, 0x06, 0x0c, // OO-----OO------------OO-----OO..
|
||||
0xe1, 0x80, 0x06, 0x1c, // OOO----OO------------OO----OOO..
|
||||
0xe3, 0xc0, 0x0f, 0x1c, // OOO---OOOO----------OOOO---OOO..
|
||||
0x67, 0xe0, 0x1f, 0x98, // -OO--OOOOOO--------OOOOOO--OO-..
|
||||
0x7f, 0xf8, 0x7f, 0xf8, // -OOOOOOOOOOOO----OOOOOOOOOOOO-..
|
||||
0x3f, 0xff, 0xff, 0xf0, // --OOOOOOOOOOOOOOOOOOOOOOOOOO--..
|
||||
0x3f, 0xff, 0xff, 0xf0, // --OOOOOOOOOOOOOOOOOOOOOOOOOO--..
|
||||
0x1f, 0xe0, 0x1f, 0xe0, // ---OOOOOOOO--------OOOOOOOO---..
|
||||
0x1f, 0xe0, 0x1f, 0xe0, // ---OOOOOOOO--------OOOOOOOO---..
|
||||
0x0f, 0xc0, 0x0f, 0xc0, // ----OOOOOO----------OOOOOO----..
|
||||
0x07, 0xc0, 0x07, 0x80, // -----OOOOO-----------OOOO-----..
|
||||
0x01, 0xf0, 0x3e, 0x00, // -------OOOOO------OOOOO-------..
|
||||
0x00, 0x7f, 0xf8, 0x00, // ---------OOOOOOOOOOOO---------..
|
||||
0x00, 0x1f, 0xe0, 0x00, // -----------OOOOOOOO-----------..
|
||||
|
||||
// ASCII: 120, char width: 26
|
||||
0x00, 0x1e, 0x00, 0x00, // -----------OOOO-----------......
|
||||
0x00, 0x1e, 0x00, 0x00, // -----------OOOO-----------......
|
||||
0x00, 0x1e, 0x00, 0x00, // -----------OOOO-----------......
|
||||
0x00, 0x1e, 0x00, 0x00, // -----------OOOO-----------......
|
||||
0x07, 0x1e, 0x38, 0x00, // -----OOO---OOOO---OOO-----......
|
||||
0x0f, 0x9e, 0x7c, 0x00, // ----OOOOO--OOOO--OOOOO----......
|
||||
0x1f, 0x9e, 0x7e, 0x00, // ---OOOOOO--OOOO--OOOOOO---......
|
||||
0x3f, 0x1e, 0x3f, 0x00, // --OOOOOO---OOOO---OOOOOO--......
|
||||
0x7e, 0x1e, 0x1f, 0x00, // -OOOOOO----OOOO----OOOOO--......
|
||||
0x7c, 0x1e, 0x0f, 0x80, // -OOOOO-----OOOO-----OOOOO-......
|
||||
0x78, 0x1e, 0x0f, 0x80, // -OOOO------OOOO-----OOOOO-......
|
||||
0xf8, 0x1e, 0x07, 0x80, // OOOOO------OOOO------OOOO-......
|
||||
0xf8, 0x1e, 0x07, 0xc0, // OOOOO------OOOO------OOOOO......
|
||||
0xf0, 0x1c, 0x07, 0xc0, // OOOO-------OOO-------OOOOO......
|
||||
0xf0, 0x00, 0x07, 0xc0, // OOOO-----------------OOOOO......
|
||||
0xf0, 0x00, 0x07, 0xc0, // OOOO-----------------OOOOO......
|
||||
0xf8, 0x00, 0x07, 0xc0, // OOOOO----------------OOOOO......
|
||||
0xf8, 0x00, 0x07, 0x80, // OOOOO----------------OOOO-......
|
||||
0x78, 0x00, 0x0f, 0x80, // -OOOO---------------OOOOO-......
|
||||
0x7c, 0x00, 0x0f, 0x80, // -OOOOO--------------OOOOO-......
|
||||
0x3e, 0x00, 0x1f, 0x00, // --OOOOO------------OOOOO--......
|
||||
0x3f, 0x00, 0x3f, 0x00, // --OOOOOO----------OOOOOO--......
|
||||
0x1f, 0xc0, 0xfe, 0x00, // ---OOOOOOO------OOOOOOO---......
|
||||
0x0f, 0xff, 0xfc, 0x00, // ----OOOOOOOOOOOOOOOOOO----......
|
||||
0x07, 0xff, 0xf8, 0x00, // -----OOOOOOOOOOOOOOOO-----......
|
||||
0x01, 0xff, 0xe0, 0x00, // -------OOOOOOOOOOOO-------......
|
||||
0x00, 0x7f, 0x80, 0x00, // ---------OOOOOOOO---------......
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------......
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------......
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------......
|
||||
|
||||
// ASCII: 121, char width: 26
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------......
|
||||
0x00, 0x3e, 0x00, 0x00, // ----------OOOOO-----------......
|
||||
0x00, 0x3f, 0x00, 0x00, // ----------OOOOOO----------......
|
||||
0x06, 0x3f, 0x18, 0x00, // -----OO---OOOOOO---OO-----......
|
||||
0x0f, 0x3f, 0x3c, 0x00, // ----OOOO--OOOOOO--OOOO----......
|
||||
0x1f, 0xff, 0xfe, 0x00, // ---OOOOOOOOOOOOOOOOOOOO---......
|
||||
0x3f, 0xff, 0xfe, 0x00, // --OOOOOOOOOOOOOOOOOOOOO---......
|
||||
0x1f, 0xff, 0xfe, 0x00, // ---OOOOOOOOOOOOOOOOOOOO---......
|
||||
0x1f, 0xff, 0xfc, 0x00, // ---OOOOOOOOOOOOOOOOOOO----......
|
||||
0x0f, 0xff, 0xfc, 0x00, // ----OOOOOOOOOOOOOOOOOO----......
|
||||
0x0f, 0xe1, 0xfc, 0x00, // ----OOOOOOO----OOOOOOO----......
|
||||
0x3f, 0xc0, 0xff, 0x00, // --OOOOOOOO------OOOOOOOO--......
|
||||
0xff, 0x80, 0x7f, 0xc0, // OOOOOOOOO--------OOOOOOOOO......
|
||||
0xff, 0x80, 0x7f, 0xc0, // OOOOOOOOO--------OOOOOOOOO......
|
||||
0xff, 0x80, 0x7f, 0xc0, // OOOOOOOOO--------OOOOOOOOO......
|
||||
0xff, 0x80, 0x7f, 0xc0, // OOOOOOOOO--------OOOOOOOOO......
|
||||
0x7f, 0xc0, 0xff, 0x00, // -OOOOOOOOO------OOOOOOOO--......
|
||||
0x0f, 0xe1, 0xfc, 0x00, // ----OOOOOOO----OOOOOOO----......
|
||||
0x0f, 0xff, 0xfc, 0x00, // ----OOOOOOOOOOOOOOOOOO----......
|
||||
0x1f, 0xff, 0xfc, 0x00, // ---OOOOOOOOOOOOOOOOOOO----......
|
||||
0x1f, 0xff, 0xfe, 0x00, // ---OOOOOOOOOOOOOOOOOOOO---......
|
||||
0x3f, 0xff, 0xff, 0x00, // --OOOOOOOOOOOOOOOOOOOOOO--......
|
||||
0x1f, 0xff, 0xfe, 0x00, // ---OOOOOOOOOOOOOOOOOOOO---......
|
||||
0x0f, 0x3f, 0x3c, 0x00, // ----OOOO--OOOOOO--OOOO----......
|
||||
0x06, 0x3f, 0x18, 0x00, // -----OO---OOOOOO---OO-----......
|
||||
0x00, 0x3f, 0x00, 0x00, // ----------OOOOOO----------......
|
||||
0x00, 0x3e, 0x00, 0x00, // ----------OOOOO-----------......
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------......
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------......
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------......
|
||||
|
||||
// ASCII: 122, char width: 34
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------------
|
||||
0x00, 0x0f, 0xfc, 0x00, // ------------OOOOOOOOOO----------
|
||||
0x00, 0xff, 0xff, 0xc0, // --------OOOOOOOOOOOOOOOOOO------
|
||||
0x03, 0xff, 0xff, 0xf0, // ------OOOOOOOOOOOOOOOOOOOOOO----
|
||||
0x0f, 0xff, 0xff, 0xfc, // ----OOOOOOOOOOOOOOOOOOOOOOOOOO--
|
||||
0x1f, 0xf8, 0x03, 0xff, // ---OOOOOOOOOO---------OOOOOOOOOO
|
||||
0x7f, 0xc0, 0x00, 0x7f, // -OOOOOOOOO---------------OOOOOOO
|
||||
0x7f, 0x07, 0xf8, 0x1f, // -OOOOOOO-----OOOOOOOO------OOOOO
|
||||
0x7c, 0x3f, 0xff, 0x0f, // -OOOOO----OOOOOOOOOOOOOO----OOOO
|
||||
0x18, 0xff, 0xff, 0xc3, // ---OO---OOOOOOOOOOOOOOOOOO----OO
|
||||
0x01, 0xff, 0xff, 0xe0, // -------OOOOOOOOOOOOOOOOOOOO-----
|
||||
0x03, 0xfc, 0x0f, 0xf8, // ------OOOOOOOO------OOOOOOOOO---
|
||||
0x07, 0xf0, 0x03, 0xf8, // -----OOOOOOO----------OOOOOOO---
|
||||
0x03, 0xc0, 0x00, 0xf0, // ------OOOO--------------OOOO----
|
||||
0x01, 0x83, 0xf0, 0x60, // -------OO-----OOOOOO-----OO-----
|
||||
0x00, 0x1f, 0xfe, 0x00, // -----------OOOOOOOOOOOO---------
|
||||
0x00, 0x3f, 0xff, 0x80, // ----------OOOOOOOOOOOOOOO-------
|
||||
0x00, 0x3f, 0xff, 0x00, // ----------OOOOOOOOOOOOOO--------
|
||||
0x00, 0x1e, 0x0e, 0x00, // -----------OOOO-----OOO---------
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------------
|
||||
0x00, 0x01, 0xe0, 0x00, // ---------------OOOO-------------
|
||||
0x00, 0x03, 0xf0, 0x00, // --------------OOOOOO------------
|
||||
0x00, 0x01, 0xe0, 0x00, // ---------------OOOO-------------
|
||||
0x00, 0x00, 0xc0, 0x00, // ----------------OO--------------
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------------
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------------
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------------
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------------
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------------
|
||||
0x00, 0x00, 0x00, 0x00, // --------------------------------
|
||||
};
|
||||
|
||||
static const uint8_t symbol_30_widths[26] =
|
||||
{
|
||||
30, 26, 32, 24, 26, 26, 30, 24,
|
||||
30, 21, 21, 30, 17, 17, 24, 30,
|
||||
24, 30, 30, 30, 30, 30, 30, 26,
|
||||
26, 34,
|
||||
};
|
||||
|
||||
static const font_t symbol_30_dsc =
|
||||
{
|
||||
26, // Letter count
|
||||
97, // First ascii code
|
||||
4, // Letters width (bytes)
|
||||
30, // Letters height (row)
|
||||
0, // Fixed width or 0 if variable
|
||||
symbol_30_widths,
|
||||
symbol_30_bitmaps
|
||||
};
|
||||
|
||||
const font_t * symbol_30_get_dsc(void)
|
||||
{
|
||||
return &symbol_30_dsc;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,16 +0,0 @@
|
||||
#ifndef SYMBOL_30_H
|
||||
#define SYMBOL_30_H
|
||||
|
||||
/*Use ISO8859-1 encoding in the IDE*/
|
||||
|
||||
#include "lv_conf.h"
|
||||
#if USE_FONT_SYMBOL_30 != 0
|
||||
|
||||
#include <stdint.h>
|
||||
#include "../font.h"
|
||||
|
||||
const font_t * symbol_30_get_dsc(void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,16 +0,0 @@
|
||||
#ifndef SYMBOL_60_H
|
||||
#define SYMBOL_60_H
|
||||
|
||||
/*Use ISO8859-1 encoding in the IDE*/
|
||||
|
||||
#include "lv_conf.h"
|
||||
#if USE_FONT_SYMBOL_60 != 0
|
||||
|
||||
#include <stdint.h>
|
||||
#include "../font.h"
|
||||
|
||||
const font_t * symbol_60_get_dsc(void);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,39 +0,0 @@
|
||||
#ifndef SYMBOL_DEF_H
|
||||
#define SYMBOL_DEF_H
|
||||
|
||||
/*Use ISO8859-1 encoding in the IDE*/
|
||||
|
||||
#include "lv_conf.h"
|
||||
#if USE_FONT_SYMBOL_30 != 0 || USE_FONT_SYMBOL_60 != 0
|
||||
|
||||
|
||||
#define SYMBOL_DRIVE "a"
|
||||
#define SYMBOL_FILE "b"
|
||||
#define SYMBOL_FOLDER "c"
|
||||
#define SYMBOL_DELETE "d"
|
||||
#define SYMBOL_SAVE "e"
|
||||
#define SYMBOL_EDIT "f"
|
||||
#define SYMBOL_OK "g"
|
||||
#define SYMBOL_CLOSE "h"
|
||||
#define SYMBOL_DOWN "i"
|
||||
#define SYMBOL_LEFT "j"
|
||||
#define SYMBOL_RIGHT "k"
|
||||
#define SYMBOL_UP "l"
|
||||
#define SYMBOL_BT "m"
|
||||
#define SYMBOL_THERM "n"
|
||||
#define SYMBOL_GPS "o"
|
||||
#define SYMBOL_WARN "p"
|
||||
#define SYMBOL_INFO "q"
|
||||
#define SYMBOL_BATT1 "r"
|
||||
#define SYMBOL_BATT2 "s"
|
||||
#define SYMBOL_BATT3 "t"
|
||||
#define SYMBOL_BATT4 "u"
|
||||
#define SYMBOL_BATTCH "v"
|
||||
#define SYMBOL_HELP "w"
|
||||
#define SYMBOL_POWER "x"
|
||||
#define SYMBOL_SETUP "y"
|
||||
#define SYMBOL_WIFI "z"
|
||||
|
||||
#endif
|
||||
|
||||
#endif /*SYMBOL_DEF_H*/
|
||||
265
lv_misc/text.c
265
lv_misc/text.c
@@ -1,265 +0,0 @@
|
||||
/**
|
||||
* @file font.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "text.h"
|
||||
#include "misc/math/math_base.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define TXT_NO_BREAK_FOUND UINT16_MAX
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool txt_is_break_char(char letter);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Get size of a text
|
||||
* @param size_res pointer to a 'point_t' variable to store the result
|
||||
* @param text pointer to a text
|
||||
* @param font pinter to font of the text
|
||||
* @param letter_space letter space of the text
|
||||
* @param line_space line space of the text
|
||||
* @param flags settings for the text from 'txt_flag_t' enum
|
||||
* @param max_width max with of the text (break the lines to fit this size) Set LV_CORD_MAX to avoid line breaks
|
||||
*/
|
||||
void txt_get_size(point_t * size_res, const char * text, const font_t * font,
|
||||
uint16_t letter_space, uint16_t line_space, cord_t max_width, txt_flag_t flag)
|
||||
{
|
||||
size_res->x = 0;
|
||||
size_res->y = 0;
|
||||
|
||||
if(text == NULL) return;
|
||||
if(font == NULL) return;
|
||||
|
||||
uint32_t line_start = 0;
|
||||
uint32_t new_line_start = 0;
|
||||
cord_t act_line_length;
|
||||
uint8_t letter_height = font_get_height(font);
|
||||
|
||||
/*Calc. the height and longest line*/
|
||||
while (text[line_start] != '\0')
|
||||
{
|
||||
new_line_start += txt_get_next_line(&text[line_start], font, letter_space, max_width, flag);
|
||||
size_res->y += letter_height;
|
||||
size_res->y += line_space;
|
||||
|
||||
/*Calculate the the longest line*/
|
||||
act_line_length = txt_get_width(&text[line_start], new_line_start - line_start,
|
||||
font, letter_space, flag);
|
||||
|
||||
size_res->x = MATH_MAX(act_line_length, size_res->x);
|
||||
line_start = new_line_start;
|
||||
}
|
||||
|
||||
if(line_start != 0 && (text[line_start - 1] == '\n' || text[line_start - 1] == '\r')) {
|
||||
size_res->y += letter_height + line_space;
|
||||
}
|
||||
|
||||
/*Correction with the last line space or set the height manually if the text is empty*/
|
||||
if(size_res->y == 0) size_res->y = letter_height;
|
||||
else size_res->y -= line_space;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the next line of text. Check line length and break chars too.
|
||||
* @param txt a '\0' terminated string
|
||||
* @param font pointer to a font
|
||||
* @param letter_space letter space
|
||||
* @param max_l max line length
|
||||
* @param flags settings for the text from 'txt_flag_type' enum
|
||||
* @return the index of the first char of the new line
|
||||
*/
|
||||
uint16_t txt_get_next_line(const char * txt, const font_t * font,
|
||||
uint16_t letter_space, cord_t max_l, txt_flag_t flag)
|
||||
{
|
||||
if(txt == NULL) return 0;
|
||||
if(font == NULL) return 0;
|
||||
|
||||
uint32_t i = 0;
|
||||
cord_t act_l = 0;
|
||||
uint16_t last_break = TXT_NO_BREAK_FOUND;
|
||||
txt_cmd_state_t cmd_state = TXT_CMD_STATE_WAIT;
|
||||
|
||||
while(txt[i] != '\0') {
|
||||
|
||||
/*Handle the recolor command*/
|
||||
if((flag & TXT_FLAG_RECOLOR) != 0) {
|
||||
if(txt_is_cmd(&cmd_state, txt[i]) != false) {
|
||||
i++; /*Skip the letter is it is part of a command*/
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/*Check for new line chars*/
|
||||
if(txt[i] == '\n' || txt[i] == '\r') {
|
||||
/*Handle \n\r and \r\n as well*/
|
||||
if(txt[i] == '\n' && txt[i + 1] == '\r') {
|
||||
i++;
|
||||
} else if(txt[i] == '\r' && txt[i + 1] == '\n') {
|
||||
i++;
|
||||
}
|
||||
return i+1; /*Return with the first letter of the next line*/
|
||||
|
||||
} else { /*Check the actual length*/
|
||||
act_l += font_get_width(font, txt[i]);
|
||||
|
||||
/*If the txt is too long then finish, this is the line end*/
|
||||
if(act_l > max_l) {
|
||||
/*If already a break character is found, then break there*/
|
||||
if(last_break != TXT_NO_BREAK_FOUND && txt_is_break_char(txt[i]) == false) {
|
||||
i = last_break;
|
||||
}
|
||||
|
||||
while(txt[i] == ' ') i++;
|
||||
|
||||
/* Do not let to return without doing nothing.
|
||||
* Find at least one character */
|
||||
if(i == 0) i++;
|
||||
|
||||
return i;
|
||||
}
|
||||
/*If this char still can fit to this line then check if
|
||||
* txt can be broken here later */
|
||||
else if(txt_is_break_char(txt[i])) {
|
||||
last_break = i;
|
||||
last_break++;/*Go to the next char, the break char stays in this line*/
|
||||
}
|
||||
}
|
||||
|
||||
act_l += letter_space;
|
||||
i++;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* Give the length of a text with a given font
|
||||
* @param txt a '\0' terminate string
|
||||
* @param char_num number of characters in 'txt'
|
||||
* @param font pointer to a font
|
||||
* @param letter_space letter space
|
||||
* @param flags settings for the text from 'txt_flag_t' enum
|
||||
* @return length of a char_num long text
|
||||
*/
|
||||
cord_t txt_get_width(const char * txt, uint16_t char_num,
|
||||
const font_t * font, uint16_t letter_space, txt_flag_t flag)
|
||||
{
|
||||
if(txt == NULL) return 0;
|
||||
if(font == NULL) return 0;
|
||||
|
||||
uint16_t i;
|
||||
cord_t len = 0;
|
||||
txt_cmd_state_t cmd_state = TXT_CMD_STATE_WAIT;
|
||||
|
||||
if(char_num != 0) {
|
||||
for(i = 0; i < char_num; i++) {
|
||||
if((flag & TXT_FLAG_RECOLOR) != 0) {
|
||||
if(txt_is_cmd(&cmd_state, txt[i]) != false) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
len += font_get_width(font, txt[i]);
|
||||
len += letter_space;
|
||||
}
|
||||
|
||||
/*Trim closing spaces */
|
||||
for(i = char_num - 1; i > 0; i--) {
|
||||
if(txt[i] == ' ') {
|
||||
len -= font_get_width(font, txt[i]);
|
||||
len -= letter_space;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*Correct the last letter space,
|
||||
* because thee is no letter space after the last char*/
|
||||
len -= letter_space;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check next character in a string and decide if te character is part of the command or not
|
||||
* @param state pointer to a txt_cmd_state_t variable which stores the current state of command processing
|
||||
* @param c the current character
|
||||
* @return true: the character is part of a command and should not be written,
|
||||
* false: the character should be written
|
||||
*/
|
||||
bool txt_is_cmd(txt_cmd_state_t * state, char c)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
if(c == TXT_RECOLOR_CMD) {
|
||||
if(*state == TXT_CMD_STATE_WAIT) { /*Start char*/
|
||||
*state = TXT_CMD_STATE_PAR;
|
||||
ret = true;
|
||||
} else if(*state == TXT_CMD_STATE_PAR) { /*Other start char in parameter is escaped cmd. char */
|
||||
*state = TXT_CMD_STATE_WAIT;
|
||||
}else if(*state == TXT_CMD_STATE_IN) { /*Command end */
|
||||
*state = TXT_CMD_STATE_WAIT;
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*Skip the color parameter and wait the space after it*/
|
||||
if(*state == TXT_CMD_STATE_PAR) {
|
||||
if(c == ' ') {
|
||||
*state = TXT_CMD_STATE_IN; /*After the parameter the text is in the command*/
|
||||
}
|
||||
ret = true;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Test if char is break char or not (a text can broken here or not)
|
||||
* @param letter a letter
|
||||
* @return false: 'letter' is not break char
|
||||
*/
|
||||
static bool txt_is_break_char(char letter)
|
||||
{
|
||||
uint8_t i;
|
||||
bool ret = false;
|
||||
|
||||
/*Compare the letter to TXT_BREAK_CHARS*/
|
||||
for(i = 0; LV_TXT_BREAK_CHARS[i] != '\0'; i++) {
|
||||
if(letter == LV_TXT_BREAK_CHARS[i]) {
|
||||
ret = true; /*If match then it is break char*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
/**
|
||||
* @file text.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TEXT_H
|
||||
#define TEXT_H
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include <lvgl/lv_misc/area.h>
|
||||
#include <stdbool.h>
|
||||
#include "font.h"
|
||||
#include "area.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define TXT_RECOLOR_CMD '#'
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef enum
|
||||
{
|
||||
TXT_FLAG_NONE = 0x00,
|
||||
TXT_FLAG_RECOLOR = 0x01,
|
||||
}txt_flag_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
TXT_CMD_STATE_WAIT,
|
||||
TXT_CMD_STATE_PAR,
|
||||
TXT_CMD_STATE_IN,
|
||||
}txt_cmd_state_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Get size of a text
|
||||
* @param size_res pointer to a 'point_t' variable to store the result
|
||||
* @param text pointer to a text
|
||||
* @param font pinter to font of the text
|
||||
* @param letter_space letter space of the text
|
||||
* @param line_space line space of the text
|
||||
* @param flags settings for the text from 'txt_flag_t' enum
|
||||
* @param max_width max with of the text (break the lines to fit this size) Set LV_CORD_MAX to avoid line breaks
|
||||
*/
|
||||
void txt_get_size(point_t * size_res, const char * text, const font_t * font,
|
||||
uint16_t letter_space, uint16_t line_space, cord_t max_width, txt_flag_t flag);
|
||||
|
||||
/**
|
||||
* Get the next line of text. Check line length and break chars too.
|
||||
* @param txt a '\0' terminated string
|
||||
* @param font_p pointer to a font
|
||||
* @param letter_space letter space
|
||||
* @param max_l max line length
|
||||
* @param flags settings for the text from 'txt_flag_t' enum
|
||||
* @return the index of the first char of the new line
|
||||
*/
|
||||
uint16_t txt_get_next_line(const char * txt, const font_t * font_p,
|
||||
uint16_t letter_space, cord_t max_l, txt_flag_t flag);
|
||||
|
||||
/**
|
||||
* Give the length of a text with a given font
|
||||
* @param txt a '\0' terminate string
|
||||
* @param char_num number of characters in 'txt'
|
||||
* @param font_p pointer to a font
|
||||
* @param letter_space letter space
|
||||
* @param flags settings for the text from 'txt_flag_t' enum
|
||||
* @return length of a char_num long text
|
||||
*/
|
||||
cord_t txt_get_width(const char * txt, uint16_t char_num,
|
||||
const font_t * font_p, uint16_t letter_space, txt_flag_t flag);
|
||||
|
||||
/**
|
||||
* Check next character in a string and decide if te character is part of the command or not
|
||||
* @param state pointer to a txt_cmd_state_t variable which stores the current state of command processing
|
||||
* @param c the current character
|
||||
* @return true: the character is part of a command and should not be written,
|
||||
* false: the character should be written
|
||||
*/
|
||||
bool txt_is_cmd(txt_cmd_state_t * state, char c);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif
|
||||
|
||||
@@ -177,6 +177,7 @@ static void dispi_proc_point(lv_dispi_t * dispi_p, cord_t x, cord_t y)
|
||||
if(lv_dispi_reset_now != false) {
|
||||
dispi_p->act_obj = NULL;
|
||||
dispi_p->last_obj = NULL;
|
||||
dispi_p->drag_range_out = 0;
|
||||
dispi_p->drag_in_prog = 0;
|
||||
dispi_p->long_press_sent = 0;
|
||||
dispi_p->press_time_stamp = 0;
|
||||
@@ -188,10 +189,10 @@ static void dispi_proc_point(lv_dispi_t * dispi_p, cord_t x, cord_t y)
|
||||
if(dispi_p->pressed != false){
|
||||
#if LV_DISPI_TP_MARKER != 0
|
||||
area_t area;
|
||||
area.x1 = x;
|
||||
area.y1 = y;
|
||||
area.x2 = x + 1;
|
||||
area.y2 = y + 1;
|
||||
area.x1 = x - (LV_DISPI_TP_MARKER >> 1);
|
||||
area.y1 = y - (LV_DISPI_TP_MARKER >> 1);
|
||||
area.x2 = x + ((LV_DISPI_TP_MARKER >> 1) | 0x1);
|
||||
area.y2 = y + ((LV_DISPI_TP_MARKER >> 1) | 0x1);
|
||||
lv_rfill(&area, NULL, COLOR_MAKE(0xFF, 0, 0), OPA_COVER);
|
||||
#endif
|
||||
dispi_proc_press(dispi_p);
|
||||
@@ -218,8 +219,8 @@ static void dispi_proc_press(lv_dispi_t * dispi_p)
|
||||
if(dispi_p->act_obj == NULL) {
|
||||
pr_obj = dispi_search_obj(dispi_p, lv_scr_act());
|
||||
}
|
||||
/*If there is last object but it can not be dragged also search*/
|
||||
else if(lv_obj_get_drag(dispi_p->act_obj) == false) {/*Now act_obj != NULL*/
|
||||
/*If there is last object but it is not dragged also search*/
|
||||
else if(dispi_p->drag_in_prog == 0) {/*Now act_obj != NULL*/
|
||||
pr_obj = dispi_search_obj(dispi_p, lv_scr_act());
|
||||
}
|
||||
/*If a dragable object was the last then keep it*/
|
||||
@@ -244,6 +245,7 @@ static void dispi_proc_press(lv_dispi_t * dispi_p)
|
||||
* It is necessary to count the long press time.*/
|
||||
dispi_p->press_time_stamp = systick_get();
|
||||
dispi_p->long_press_sent = 0;
|
||||
dispi_p->drag_range_out = 0;
|
||||
dispi_p->drag_in_prog = 0;
|
||||
dispi_p->vect_sum.x = 0;
|
||||
dispi_p->vect_sum.y = 0;
|
||||
@@ -402,7 +404,7 @@ static void dispi_drag(lv_dispi_t * dispi_p)
|
||||
if(lv_obj_get_drag(drag_obj) == false) return;
|
||||
|
||||
/*If still there is no drag then count the movement*/
|
||||
if(dispi_p->drag_in_prog == 0) {
|
||||
if(dispi_p->drag_range_out == 0) {
|
||||
dispi_p->vect_sum.x += dispi_p->vect.x;
|
||||
dispi_p->vect_sum.y += dispi_p->vect.y;
|
||||
|
||||
@@ -410,21 +412,29 @@ static void dispi_drag(lv_dispi_t * dispi_p)
|
||||
if(MATH_ABS(dispi_p->vect_sum.x) >= LV_DISPI_DRAG_LIMIT ||
|
||||
MATH_ABS(dispi_p->vect_sum.y) >= LV_DISPI_DRAG_LIMIT)
|
||||
{
|
||||
dispi_p->drag_in_prog = 1;
|
||||
drag_obj->signal_f(drag_obj,
|
||||
LV_SIGNAL_DRAG_BEGIN, dispi_p);
|
||||
dispi_p->drag_range_out = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*If the drag limit is stepped over then handle the dragging*/
|
||||
if(dispi_p->drag_in_prog != 0) {
|
||||
if(dispi_p->drag_range_out != 0) {
|
||||
/*Set new position if the vector is not zero*/
|
||||
if(dispi_p->vect.x != 0 ||
|
||||
dispi_p->vect.y != 0) {
|
||||
/*Get the coordinates of the object end modify them*/
|
||||
cord_t act_x = lv_obj_get_x(drag_obj) + dispi_p->vect.x;
|
||||
cord_t act_y = lv_obj_get_y(drag_obj) + dispi_p->vect.y;
|
||||
lv_obj_set_pos(drag_obj, act_x, act_y);
|
||||
cord_t act_x = lv_obj_get_x(drag_obj);
|
||||
cord_t act_y = lv_obj_get_y(drag_obj);
|
||||
|
||||
lv_obj_set_pos(drag_obj, act_x + dispi_p->vect.x, act_y + dispi_p->vect.y);
|
||||
|
||||
/*Set the drag in progress flag if the object is really moved*/
|
||||
if(lv_obj_get_x(drag_obj) != act_x || lv_obj_get_y(drag_obj) != act_y) {
|
||||
if(dispi_p->drag_range_out != 0) { /*Send the drag begin signal on first move*/
|
||||
drag_obj->signal_f(drag_obj, LV_SIGNAL_DRAG_BEGIN, dispi_p);
|
||||
}
|
||||
dispi_p->drag_in_prog = 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ typedef struct
|
||||
uint32_t lpr_rep_time_stamp;
|
||||
|
||||
/*Flags*/
|
||||
uint8_t drag_range_out :1;
|
||||
uint8_t drag_in_prog :1;
|
||||
uint8_t long_press_sent :1;
|
||||
uint8_t wait_release :1;
|
||||
@@ -39,8 +40,8 @@ typedef struct
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LV_ACTION_RES_INV = 0,
|
||||
LV_ACTION_RES_OK,
|
||||
LV_ACTION_RES_INV = 0, /*Typically indicates that the object is deleted (become invalid) in the action function*/
|
||||
LV_ACTION_RES_OK, /*The object is valid (no deleted) after the action*/
|
||||
}lv_action_res_t;
|
||||
|
||||
typedef lv_action_res_t ( * lv_action_t) (struct __LV_OBJ_T * obj, lv_dispi_t * dispi);
|
||||
|
||||
299
lv_obj/lv_obj.c
299
lv_obj/lv_obj.c
@@ -7,13 +7,14 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include <lv_conf.h>
|
||||
#include <lvgl/lv_draw/lv_draw_rbasic.h>
|
||||
#include <lvgl/lv_draw/lv_draw_vbasic.h>
|
||||
#include <lvgl/lv_misc/anim.h>
|
||||
#include <lvgl/lv_obj/lv_dispi.h>
|
||||
#include <lvgl/lv_obj/lv_obj.h>
|
||||
#include <lvgl/lv_obj/lv_refr.h>
|
||||
#include "lv_conf.h"
|
||||
#include "lvgl/lv_draw/lv_draw.h"
|
||||
#include "lvgl/lv_obj/lv_dispi.h"
|
||||
#include "lvgl/lv_obj/lv_obj.h"
|
||||
#include "lvgl/lv_obj/lv_refr.h"
|
||||
#include "lvgl/lv_app/lv_app.h"
|
||||
#include "lvgl/lv_draw/lv_draw_rbasic.h"
|
||||
#include "misc/gfx/anim.h"
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -34,6 +35,7 @@
|
||||
**********************/
|
||||
static void lv_obj_pos_child_refr(lv_obj_t * obj, cord_t x_diff, cord_t y_diff);
|
||||
static void lv_style_refr_core(void * style_p, lv_obj_t * obj);
|
||||
static void lv_child_refr_style(lv_obj_t * obj);
|
||||
static void lv_obj_del_child(lv_obj_t * obj);
|
||||
static bool lv_obj_design(lv_obj_t * obj, const area_t * mask_p, lv_design_mode_t mode);
|
||||
|
||||
@@ -44,11 +46,6 @@ static lv_obj_t * def_scr = NULL;
|
||||
static lv_obj_t * act_scr = NULL;
|
||||
static ll_dsc_t scr_ll;
|
||||
|
||||
static lv_objs_t lv_objs_def = {.color = COLOR_MAKE(0xa0, 0xc0, 0xe0), .transp = 0};
|
||||
static lv_objs_t lv_objs_scr = {.color = LV_OBJ_DEF_SCR_COLOR, .transp = 0};
|
||||
static lv_objs_t lv_objs_transp = {.transp = 1};
|
||||
|
||||
|
||||
#ifdef LV_IMG_DEF_WALLPAPER
|
||||
LV_IMG_DECLARE(LV_IMG_DEF_WALLPAPER);
|
||||
#endif
|
||||
@@ -70,12 +67,12 @@ void lv_init(void)
|
||||
area_t scr_area;
|
||||
area_set(&scr_area, 0, 0, LV_HOR_RES, LV_VER_RES);
|
||||
lv_rfill(&scr_area, NULL, COLOR_BLACK, OPA_COVER);
|
||||
|
||||
/*Init. the sstyles*/
|
||||
lv_style_init();
|
||||
|
||||
/*Init. the screen refresh system*/
|
||||
lv_refr_init();
|
||||
|
||||
/*Init. the animations*/
|
||||
anim_init();
|
||||
|
||||
/*Create the default screen*/
|
||||
ll_init(&scr_ll, sizeof(lv_obj_t));
|
||||
@@ -84,6 +81,7 @@ void lv_init(void)
|
||||
def_scr = lv_img_create(NULL, NULL);
|
||||
lv_img_set_auto_size(def_scr, false);
|
||||
lv_img_set_file(def_scr, "U:/def_wp");
|
||||
lv_img_set_upscale(def_scr, true);
|
||||
#else
|
||||
def_scr = lv_obj_create(NULL, NULL);
|
||||
#endif
|
||||
@@ -133,15 +131,16 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy)
|
||||
new_obj->ext_size = 0;
|
||||
|
||||
/*Set appearance*/
|
||||
new_obj->style_p = lv_objs_get(LV_OBJS_SCR, NULL);
|
||||
new_obj->opa = OPA_COVER;
|
||||
new_obj->style_p = lv_style_get(LV_STYLE_SCR, NULL);
|
||||
|
||||
/*Set virtual functions*/
|
||||
lv_obj_set_signal_f(new_obj, lv_obj_signal);
|
||||
lv_obj_set_design_f(new_obj, lv_obj_design);
|
||||
|
||||
/*Set free data*/
|
||||
#if LV_OBJ_FREE_NUM != 0
|
||||
new_obj->free_num = 0;
|
||||
#endif
|
||||
#if LV_OBJ_FREE_P != 0
|
||||
new_obj->free_p = NULL;
|
||||
#endif
|
||||
@@ -151,7 +150,6 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy)
|
||||
new_obj->drag_en = 0;
|
||||
new_obj->drag_throw_en = 0;
|
||||
new_obj->drag_parent = 0;
|
||||
new_obj->style_iso = 0;
|
||||
new_obj->hidden = 0;
|
||||
new_obj->top_en = 0;
|
||||
new_obj->protect = LV_PROTECT_NONE;
|
||||
@@ -176,15 +174,16 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy)
|
||||
new_obj->ext_size = 0;
|
||||
|
||||
/*Set appearance*/
|
||||
new_obj->style_p = lv_objs_get(LV_OBJS_DEF, NULL);
|
||||
new_obj->opa = OPA_COVER;
|
||||
new_obj->style_p = lv_style_get(LV_STYLE_PLAIN, NULL);
|
||||
|
||||
/*Set virtual functions*/
|
||||
lv_obj_set_signal_f(new_obj, lv_obj_signal);
|
||||
lv_obj_set_design_f(new_obj, lv_obj_design);
|
||||
|
||||
/*Set free data*/
|
||||
#if LV_OBJ_FREE_NUM != 0
|
||||
new_obj->free_num = 0;
|
||||
#endif
|
||||
#if LV_OBJ_FREE_P != 0
|
||||
new_obj->free_p = NULL;
|
||||
#endif
|
||||
@@ -194,7 +193,6 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy)
|
||||
new_obj->drag_en = 0;
|
||||
new_obj->drag_throw_en = 0;
|
||||
new_obj->drag_parent = 0;
|
||||
new_obj->style_iso = 0;
|
||||
new_obj->hidden = 0;
|
||||
new_obj->top_en = 0;
|
||||
new_obj->protect = LV_PROTECT_NONE;
|
||||
@@ -207,10 +205,10 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy)
|
||||
area_cpy(&new_obj->cords, ©->cords);
|
||||
new_obj->ext_size = copy->ext_size;
|
||||
|
||||
new_obj->opa = copy->opa;
|
||||
|
||||
/*Set free data*/
|
||||
#if LV_OBJ_FREE_NUM != 0
|
||||
new_obj->free_num = copy->free_num;
|
||||
#endif
|
||||
#if LV_OBJ_FREE_P != 0
|
||||
new_obj->free_p = copy->free_p;
|
||||
#endif
|
||||
@@ -225,10 +223,6 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy)
|
||||
|
||||
new_obj->style_p = copy->style_p;
|
||||
|
||||
if(copy->style_iso != 0) {
|
||||
lv_obj_iso_style(new_obj, dm_get_size(copy->style_p));
|
||||
}
|
||||
|
||||
lv_obj_set_pos(new_obj, lv_obj_get_x(copy), lv_obj_get_y(copy));
|
||||
}
|
||||
|
||||
@@ -246,7 +240,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy)
|
||||
|
||||
/**
|
||||
* Delete 'obj' and all of its children
|
||||
* @param obj
|
||||
* @param obj pointer to an object to delete
|
||||
*/
|
||||
void lv_obj_del(lv_obj_t * obj)
|
||||
{
|
||||
@@ -284,7 +278,6 @@ void lv_obj_del(lv_obj_t * obj)
|
||||
|
||||
/*Delete the base objects*/
|
||||
if(obj->ext != NULL) dm_free(obj->ext);
|
||||
if(obj->style_iso != 0) dm_free(obj->style_p);
|
||||
dm_free(obj); /*Free the object itself*/
|
||||
|
||||
/* Reset all display input (dispi) because
|
||||
@@ -308,50 +301,25 @@ bool lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
|
||||
{
|
||||
bool valid = true;
|
||||
|
||||
lv_style_t * style = lv_obj_get_style(obj);
|
||||
switch(sign) {
|
||||
case LV_SIGNAL_CHILD_CHG:
|
||||
/*Return 'invalid' if the child change signal is not enabled*/
|
||||
if(lv_obj_is_protected(obj, LV_PROTECT_CHILD_CHG) != false) valid = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case LV_SIGNAL_CHILD_CHG:
|
||||
/*Return 'invalid' if the child change signal is not enabled*/
|
||||
if(lv_obj_is_protected(obj, LV_PROTECT_CHILD_CHG) != false) valid = false;
|
||||
break;
|
||||
case LV_SIGNAL_REFR_EXT_SIZE:
|
||||
if(style->swidth > obj->ext_size) obj->ext_size = style->swidth;
|
||||
break;
|
||||
case LV_SIGNAL_STYLE_CHG:
|
||||
lv_obj_refr_ext_size(obj);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return with a pointer to built-in style and/or copy it to a variable
|
||||
* @param style a style name from lv_objs_builtin_t enum
|
||||
* @param copy_p copy the style to this variable. (NULL if unused)
|
||||
* @return pointer to an lv_objs_t style
|
||||
*/
|
||||
lv_objs_t * lv_objs_get(lv_objs_builtin_t style, lv_objs_t * copy_p)
|
||||
{
|
||||
lv_objs_t *style_p;
|
||||
|
||||
switch(style) {
|
||||
case LV_OBJS_DEF:
|
||||
style_p = &lv_objs_def;
|
||||
break;
|
||||
case LV_OBJS_SCR:
|
||||
style_p = &lv_objs_scr;
|
||||
break;
|
||||
case LV_OBJS_TRANSP:
|
||||
style_p = &lv_objs_transp;
|
||||
break;
|
||||
default:
|
||||
style_p = NULL;
|
||||
}
|
||||
|
||||
if(copy_p != NULL) {
|
||||
if(style_p != NULL) memcpy(copy_p, style_p, sizeof(lv_objs_t));
|
||||
else memcpy(copy_p, &lv_objs_def, sizeof(lv_objs_t));
|
||||
}
|
||||
|
||||
return style_p;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mark the object as invalid therefore its current position will be redrawn by 'lv_refr_task'
|
||||
@@ -489,7 +457,7 @@ void lv_obj_set_pos(lv_obj_t * obj, cord_t x, cord_t y)
|
||||
|
||||
/**
|
||||
* Set relative the position of an object (relative to the parent).
|
||||
* The coordinates will be upscaled to compensate LV_DOWNSCALE.
|
||||
* The coordinates will be upscaled with LV_DOWNSCALE.
|
||||
* @param obj pointer to an object
|
||||
* @param x new distance from the left side of the parent. (will be multiplied with LV_DOWNSCALE)
|
||||
* @param y new distance from the top of the parent. (will be multiplied with LV_DOWNSCALE)
|
||||
@@ -511,7 +479,7 @@ void lv_obj_set_x(lv_obj_t * obj, cord_t x)
|
||||
|
||||
/**
|
||||
* Set the x coordinate of a object.
|
||||
* The coordinate will be upscaled to compensate LV_DOWNSCALE.
|
||||
* The coordinate will be upscaled with LV_DOWNSCALE.
|
||||
* @param obj pointer to an object
|
||||
* @param x new distance from the left side from the parent. (will be multiplied with LV_DOWNSCALE)
|
||||
*/
|
||||
@@ -532,7 +500,7 @@ void lv_obj_set_y(lv_obj_t * obj, cord_t y)
|
||||
|
||||
/**
|
||||
* Set the y coordinate of a object.
|
||||
* The coordinate will be upscaled to compensate LV_DOWNSCALE.
|
||||
* The coordinate will be upscaled with LV_DOWNSCALE.
|
||||
* @param obj pointer to an object
|
||||
* @param y new distance from the top of the parent. (will be multiplied with LV_DOWNSCALE)
|
||||
*/
|
||||
@@ -581,7 +549,7 @@ void lv_obj_set_size(lv_obj_t * obj, cord_t w, cord_t h)
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the size of an object. The coordinates will be upscaled to compensate LV_DOWNSCALE.
|
||||
* Set the size of an object. The coordinates will be upscaled with LV_DOWNSCALE.
|
||||
* @param obj pointer to an object
|
||||
* @param w new width (will be multiplied with LV_DOWNSCALE)
|
||||
* @param h new height (will be multiplied with LV_DOWNSCALE)
|
||||
@@ -602,7 +570,7 @@ void lv_obj_set_width(lv_obj_t * obj, cord_t w)
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the width of an object. The width will be upscaled to compensate LV_DOWNSCALE
|
||||
* Set the width of an object. The width will be upscaled with LV_DOWNSCALE
|
||||
* @param obj pointer to an object
|
||||
* @param w new width (will be multiplied with LV_DOWNSCALE)
|
||||
*/
|
||||
@@ -622,7 +590,7 @@ void lv_obj_set_height(lv_obj_t * obj, cord_t h)
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the height of an object. The height will be upscaled to compensate LV_DOWNSCALE
|
||||
* Set the height of an object. The height will be upscaled with LV_DOWNSCALE
|
||||
* @param obj pointer to an object
|
||||
* @param h new height (will be multiplied with LV_DOWNSCALE)
|
||||
*/
|
||||
@@ -770,7 +738,7 @@ void lv_obj_align(lv_obj_t * obj,lv_obj_t * base, lv_align_t align, cord_t x_mod
|
||||
|
||||
|
||||
/**
|
||||
* Align an object to an other object. The coordinates will be upscaled to compensate LV_DOWNSCALE.
|
||||
* Align an object to an other object. The coordinates will be upscaled with LV_DOWNSCALE.
|
||||
* @param obj pointer to an object to align
|
||||
* @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it.
|
||||
* @param align type of alignment (see 'lv_align_t' enum)
|
||||
@@ -803,76 +771,15 @@ void lv_obj_set_ext_size(lv_obj_t * obj, cord_t ext_size)
|
||||
* @param obj pointer to an object
|
||||
* @param style_p pointer to the new style
|
||||
*/
|
||||
void lv_obj_set_style(lv_obj_t * obj, void * style)
|
||||
void lv_obj_set_style(lv_obj_t * obj, lv_style_t * style)
|
||||
{
|
||||
lv_obj_inv(obj);
|
||||
|
||||
if(obj->style_iso != 0) {
|
||||
dm_free(obj->style_p);
|
||||
obj->style_iso = 0;
|
||||
}
|
||||
obj->style_p = style;
|
||||
|
||||
/*Send a style change signal to the object*/
|
||||
lv_obj_refr_style(obj);
|
||||
/*Send a signal about style change to every children with NULL style*/
|
||||
lv_child_refr_style(obj);
|
||||
|
||||
lv_obj_inv(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Isolate the style of an object. In other words a unique style will be created
|
||||
* for this object which can be freely modified independently from the style of the
|
||||
* other objects.
|
||||
*/
|
||||
void * lv_obj_iso_style(lv_obj_t * obj, uint32_t style_size)
|
||||
{
|
||||
if(obj->style_iso != 0) return obj->style_p;
|
||||
|
||||
void * ori_style_p = lv_obj_get_style(obj);
|
||||
void * iso_style = dm_alloc(style_size);
|
||||
dm_assert(iso_style);
|
||||
memcpy(iso_style, ori_style_p, style_size);
|
||||
|
||||
obj->style_iso = 1;
|
||||
obj->style_p = iso_style;
|
||||
|
||||
lv_obj_refr_style(obj);
|
||||
|
||||
return obj->style_p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the opacity of an object
|
||||
* @param obj pointer to an object
|
||||
* @param opa 0 (transparent) .. 255(fully cover)
|
||||
*/
|
||||
void lv_obj_set_opa(lv_obj_t * obj, uint8_t opa)
|
||||
{
|
||||
obj->opa = opa;
|
||||
|
||||
lv_obj_inv(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the opacity of an object and all of its children
|
||||
* @param obj pointer to an object
|
||||
* @param opa 0 (transparent) .. 255(fully cover)
|
||||
*/
|
||||
void lv_obj_set_opar(lv_obj_t * obj, uint8_t opa)
|
||||
{
|
||||
lv_obj_t * i;
|
||||
|
||||
LL_READ(obj->child_ll, i) {
|
||||
lv_obj_set_opar(i, opa);
|
||||
}
|
||||
|
||||
/*Set the opacity is the object is not protected*/
|
||||
if(lv_obj_is_protected(obj, LV_PROTECT_OPA) == false) obj->opa = opa;
|
||||
|
||||
lv_obj_inv(obj);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Notify an object about its style is modified
|
||||
* @param obj pointer to an object
|
||||
@@ -887,10 +794,10 @@ void lv_obj_refr_style(lv_obj_t * obj)
|
||||
|
||||
/**
|
||||
* Notify all object if a style is modified
|
||||
* @param style pinter to a style. Only objects with this style will be notified
|
||||
* @param style pointer to a style. Only the objects with this style will be notified
|
||||
* (NULL to notify all objects)
|
||||
*/
|
||||
void lv_style_refr_all(void * style)
|
||||
void lv_style_refr_objs(void * style)
|
||||
{
|
||||
lv_obj_t * i;
|
||||
LL_READ(scr_ll, i) {
|
||||
@@ -1042,6 +949,7 @@ void lv_obj_refr_ext_size(lv_obj_t * obj)
|
||||
lv_obj_inv(obj);
|
||||
}
|
||||
|
||||
#if LV_OBJ_FREE_NUM != 0
|
||||
/**
|
||||
* Set an application specific number for an object.
|
||||
* It can help to identify objects in the application.
|
||||
@@ -1052,6 +960,7 @@ void lv_obj_set_free_num(lv_obj_t * obj, uint8_t free_num)
|
||||
{
|
||||
obj->free_num = free_num;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LV_OBJ_FREE_P != 0
|
||||
/**
|
||||
@@ -1115,11 +1024,6 @@ void lv_obj_anim(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint16_t
|
||||
a.start = lv_obj_get_height(par);
|
||||
a.end = lv_obj_get_y(obj);
|
||||
break;
|
||||
case LV_ANIM_FADE:
|
||||
a.fp = (void(*)(void * , int32_t))lv_obj_set_opar;
|
||||
a.start = OPA_TRANSP;
|
||||
a.end = OPA_COVER;
|
||||
break;
|
||||
case LV_ANIM_GROW_H:
|
||||
a.fp = (void(*)(void * , int32_t))lv_obj_set_width;
|
||||
a.start = 0;
|
||||
@@ -1300,7 +1204,7 @@ cord_t lv_obj_get_height(lv_obj_t * obj)
|
||||
* @param obj pointer to an object
|
||||
* @return the extended size attribute
|
||||
*/
|
||||
cord_t lv_obj_getext_size(lv_obj_t * obj)
|
||||
cord_t lv_obj_get_ext_size(lv_obj_t * obj)
|
||||
{
|
||||
return obj->ext_size;
|
||||
}
|
||||
@@ -1310,23 +1214,26 @@ cord_t lv_obj_getext_size(lv_obj_t * obj)
|
||||
*---------------*/
|
||||
|
||||
/**
|
||||
* Get the style pointer of an object
|
||||
* Get the style pointer of an object (if NULL get style of the parent)
|
||||
* @param obj pointer to an object
|
||||
* @return pointer to a style
|
||||
*/
|
||||
void * lv_obj_get_style(lv_obj_t * obj)
|
||||
lv_style_t * lv_obj_get_style(lv_obj_t * obj)
|
||||
{
|
||||
return obj->style_p;
|
||||
}
|
||||
if(obj->style_p != NULL) return obj->style_p;
|
||||
else {
|
||||
lv_obj_t * par = obj->par;
|
||||
|
||||
/**
|
||||
* Get the opacity of an object
|
||||
* @param obj pointer to an object
|
||||
* @return 0 (transparent) .. 255 (fully cover)
|
||||
*/
|
||||
opa_t lv_obj_get_opa(lv_obj_t * obj)
|
||||
{
|
||||
return obj->opa;
|
||||
while(par != NULL) {
|
||||
if(par->style_p != NULL) {
|
||||
if(par->style_p->glass == 0) return par->style_p;
|
||||
}
|
||||
par = par->par;
|
||||
}
|
||||
}
|
||||
|
||||
/*Never reach this, at least the screen has to be a style*/
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*-----------------
|
||||
@@ -1393,16 +1300,6 @@ bool lv_obj_get_drag_parent(lv_obj_t * obj)
|
||||
return obj->drag_parent == 0 ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the style isolation attribute of an object
|
||||
* @param obj pointer to an object
|
||||
* @return pointer to a style
|
||||
*/
|
||||
bool lv_obj_get_style_iso(lv_obj_t * obj)
|
||||
{
|
||||
return obj->style_iso == 0 ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the protect field of an object
|
||||
* @param obj pointer to an object
|
||||
@@ -1460,7 +1357,7 @@ void * lv_obj_get_ext(lv_obj_t * obj)
|
||||
return obj->ext;
|
||||
}
|
||||
|
||||
|
||||
#if LV_OBJ_FREE_NUM != 0
|
||||
/**
|
||||
* Get the free number
|
||||
* @param obj pointer to an object
|
||||
@@ -1470,6 +1367,7 @@ uint8_t lv_obj_get_free_num(lv_obj_t * obj)
|
||||
{
|
||||
return obj->free_num;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LV_OBJ_FREE_P != 0
|
||||
/**
|
||||
@@ -1499,21 +1397,33 @@ void * lv_obj_get_free_p(lv_obj_t * obj)
|
||||
static bool lv_obj_design(lv_obj_t * obj, const area_t * mask_p, lv_design_mode_t mode)
|
||||
{
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
bool cover;
|
||||
cover = area_is_in(mask_p, &obj->cords);
|
||||
return cover;
|
||||
|
||||
/* Because of the radius it is not sure the area is covered
|
||||
* Check the areas where there is no radius*/
|
||||
lv_style_t * style = lv_obj_get_style(obj);
|
||||
if(style->empty != 0) return false;
|
||||
|
||||
uint16_t r = style->radius;
|
||||
|
||||
if(r == LV_RADIUS_CIRCLE) return false;
|
||||
|
||||
area_t area_tmp;
|
||||
|
||||
/*Check horizontally without radius*/
|
||||
lv_obj_get_cords(obj, &area_tmp);
|
||||
area_tmp.x1 += r;
|
||||
area_tmp.x2 -= r;
|
||||
if(area_is_in(mask_p, &area_tmp) == false) return false;
|
||||
|
||||
/*Check vertically without radius*/
|
||||
lv_obj_get_cords(obj, &area_tmp);
|
||||
area_tmp.y1 += r;
|
||||
area_tmp.y2 -= r;
|
||||
if(area_is_in(mask_p, &area_tmp) == false) return false;
|
||||
|
||||
} else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
lv_objs_t * objs_p = lv_obj_get_style(obj);
|
||||
|
||||
opa_t opa = lv_obj_get_opa(obj);
|
||||
color_t color = objs_p->color;
|
||||
|
||||
/*Simply draw a rectangle*/
|
||||
#if LV_VDB_SIZE == 0
|
||||
lv_rfill(&obj->cords, mask_p, color, opa);
|
||||
#else
|
||||
lv_vfill(&obj->cords, mask_p, color, opa);
|
||||
#endif
|
||||
lv_style_t * style = lv_obj_get_style(obj);
|
||||
lv_draw_rect(&obj->cords, mask_p, style);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1555,6 +1465,26 @@ static void lv_style_refr_core(void * style_p, lv_obj_t * obj)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Recursively refresh the style of the children. Go deeper until a not NULL style is found
|
||||
* because the NULL styles are inherited from the parent
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
static void lv_child_refr_style(lv_obj_t * obj)
|
||||
{
|
||||
lv_obj_t * child = lv_obj_get_child(obj, NULL);
|
||||
while(child != NULL) {
|
||||
if(child->style_p == NULL) {
|
||||
lv_child_refr_style(child);
|
||||
}
|
||||
child = lv_obj_get_child(obj, child);
|
||||
}
|
||||
|
||||
/*Send a style change signal to the object*/
|
||||
lv_obj_refr_style(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by 'lv_obj_del' to delete the children objects
|
||||
* @param obj pointer to an object (all of its children will be deleted)
|
||||
@@ -1589,9 +1519,6 @@ static void lv_obj_del_child(lv_obj_t * obj)
|
||||
|
||||
/*Delete the base objects*/
|
||||
if(obj->ext != NULL) dm_free(obj->ext);
|
||||
if(obj->style_iso != 0) dm_free(obj->style_p);
|
||||
dm_free(obj); /*Free the object itself*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
191
lv_obj/lv_obj.h
191
lv_obj/lv_obj.h
@@ -9,16 +9,19 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <lvgl/lv_misc/area.h>
|
||||
#include "lv_conf.h"
|
||||
#include <misc/gfx/area.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include "misc/mem/dyn_mem.h"
|
||||
#include "misc/mem/linked_list.h"
|
||||
#include "misc/others/color.h"
|
||||
#include "misc/gfx/color.h"
|
||||
#include "lv_style.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/*Error check of lv_conf.h*/
|
||||
#if LV_HOR_RES == 0 || LV_VER_RES == 0
|
||||
#error "LV: LV_HOR_RES and LV_VER_RES must be greater then 0"
|
||||
@@ -76,39 +79,37 @@ typedef bool (* lv_signal_f_t) (struct __LV_OBJ_T * obj, lv_signal_t sign, void
|
||||
|
||||
typedef struct __LV_OBJ_T
|
||||
{
|
||||
struct __LV_OBJ_T * par;
|
||||
ll_dsc_t child_ll;
|
||||
struct __LV_OBJ_T * par; /*Pointer to the parent object*/
|
||||
ll_dsc_t child_ll; /*Linked list to store the children objects*/
|
||||
|
||||
area_t cords;
|
||||
area_t cords; /*Coordinates of the object (x1, y1, x2, y2)*/
|
||||
|
||||
lv_signal_f_t signal_f;
|
||||
lv_design_f_t design_f;
|
||||
lv_signal_f_t signal_f; /*Object type specific signal function*/
|
||||
lv_design_f_t design_f; /*Object type specific design function*/
|
||||
|
||||
void * ext; /*The object attributes can be extended here*/
|
||||
void * style_p; /*Object specific style*/
|
||||
void * ext; /*Object type specific extended data*/
|
||||
lv_style_t * style_p; /*Pointer to the object's style*/
|
||||
|
||||
#if LV_OBJ_FREE_P != 0
|
||||
void * free_p; /*Application specific pointer (set it freely)*/
|
||||
void * free_p; /*Application specific pointer (set it freely)*/
|
||||
#endif
|
||||
|
||||
/*Attributes and states*/
|
||||
uint8_t click_en :1; /*1: can be pressed by a display input device*/
|
||||
uint8_t drag_en :1; /*1: enable the dragging*/
|
||||
uint8_t click_en :1; /*1: Can be pressed by a display input device*/
|
||||
uint8_t drag_en :1; /*1: Enable the dragging*/
|
||||
uint8_t drag_throw_en:1; /*1: Enable throwing with drag*/
|
||||
uint8_t drag_parent :1; /*1. Parent will be dragged instead*/
|
||||
uint8_t style_iso :1; /*1: The object has got an own style*/
|
||||
uint8_t drag_parent :1; /*1: Parent will be dragged instead*/
|
||||
uint8_t hidden :1; /*1: Object is hidden*/
|
||||
uint8_t top_en :1; /*1: If the object or its children is clicked it goes to the foreground*/
|
||||
uint8_t top_en :1; /*1: If the object or its children is clicked it goes to the foreground*/
|
||||
uint8_t reserved :1;
|
||||
|
||||
uint8_t protect; /*Automatically happening actions can be prevented. 'OR'ed values from lv_obj_prot_t*/
|
||||
|
||||
cord_t ext_size; /*EXTtend the size of the object in every direction. Used to draw shadow, shine etc.*/
|
||||
cord_t ext_size; /*EXTtend the size of the object in every direction. E.g. for shadow drawing*/
|
||||
|
||||
#if LV_OBJ_FREE_NUM != 0
|
||||
uint8_t free_num; /*Application specific identifier (set it freely)*/
|
||||
opa_t opa;
|
||||
|
||||
|
||||
#endif
|
||||
}lv_obj_t;
|
||||
|
||||
/*Protect some attributes (max. 8 bit)*/
|
||||
@@ -116,54 +117,45 @@ typedef enum
|
||||
{
|
||||
LV_PROTECT_NONE = 0x00,
|
||||
LV_PROTECT_CHILD_CHG = 0x01, /*Disable the child change signal. Used by the library*/
|
||||
LV_PROTECT_OPA = 0x02, /*Prevent lv_obj_set_opar to modify the opacity*/
|
||||
LV_PROTECT_PARENT = 0x04, /*Prevent automatic parent change (e.g. in lv_page)*/
|
||||
LV_PROTECT_POS = 0x08, /*Prevent automatic positioning (e.g. in lv_rect layout)*/
|
||||
LV_PROTECT_PARENT = 0x02, /*Prevent automatic parent change (e.g. in lv_page)*/
|
||||
LV_PROTECT_POS = 0x04, /*Prevent automatic positioning (e.g. in lv_rect layout)*/
|
||||
}lv_protect_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LV_ALIGN_CENTER = 0,
|
||||
LV_ALIGN_IN_TOP_LEFT,
|
||||
LV_ALIGN_IN_TOP_MID,
|
||||
LV_ALIGN_IN_TOP_RIGHT,
|
||||
LV_ALIGN_IN_BOTTOM_LEFT,
|
||||
LV_ALIGN_IN_BOTTOM_MID,
|
||||
LV_ALIGN_IN_BOTTOM_RIGHT,
|
||||
LV_ALIGN_IN_LEFT_MID,
|
||||
LV_ALIGN_IN_RIGHT_MID,
|
||||
LV_ALIGN_OUT_TOP_LEFT,
|
||||
LV_ALIGN_OUT_TOP_MID,
|
||||
LV_ALIGN_OUT_TOP_RIGHT,
|
||||
LV_ALIGN_OUT_BOTTOM_LEFT,
|
||||
LV_ALIGN_OUT_BOTTOM_MID,
|
||||
LV_ALIGN_OUT_BOTTOM_RIGHT,
|
||||
LV_ALIGN_OUT_LEFT_TOP,
|
||||
LV_ALIGN_OUT_LEFT_MID,
|
||||
LV_ALIGN_OUT_LEFT_BOTTOM,
|
||||
LV_ALIGN_OUT_RIGHT_TOP,
|
||||
LV_ALIGN_OUT_RIGHT_MID,
|
||||
LV_ALIGN_OUT_RIGHT_BOTTOM,
|
||||
LV_ALIGN_IN_TOP_LEFT,
|
||||
LV_ALIGN_IN_TOP_MID,
|
||||
LV_ALIGN_IN_TOP_RIGHT,
|
||||
LV_ALIGN_IN_BOTTOM_LEFT,
|
||||
LV_ALIGN_IN_BOTTOM_MID,
|
||||
LV_ALIGN_IN_BOTTOM_RIGHT,
|
||||
LV_ALIGN_IN_LEFT_MID,
|
||||
LV_ALIGN_IN_RIGHT_MID,
|
||||
LV_ALIGN_OUT_TOP_LEFT,
|
||||
LV_ALIGN_OUT_TOP_MID,
|
||||
LV_ALIGN_OUT_TOP_RIGHT,
|
||||
LV_ALIGN_OUT_BOTTOM_LEFT,
|
||||
LV_ALIGN_OUT_BOTTOM_MID,
|
||||
LV_ALIGN_OUT_BOTTOM_RIGHT,
|
||||
LV_ALIGN_OUT_LEFT_TOP,
|
||||
LV_ALIGN_OUT_LEFT_MID,
|
||||
LV_ALIGN_OUT_LEFT_BOTTOM,
|
||||
LV_ALIGN_OUT_RIGHT_TOP,
|
||||
LV_ALIGN_OUT_RIGHT_MID,
|
||||
LV_ALIGN_OUT_RIGHT_BOTTOM,
|
||||
}lv_align_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
color_t color;
|
||||
uint8_t transp :1;
|
||||
opa_t opa;
|
||||
}lv_objs_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LV_OBJS_DEF,
|
||||
LV_OBJS_SCR,
|
||||
LV_OBJS_TRANSP,
|
||||
}lv_objs_builtin_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LV_ANIM_NONE = 0,
|
||||
LV_ANIM_FADE, /*Animate the opacity*/
|
||||
LV_ANIM_FLOAT_TOP, /*Float from/to the top*/
|
||||
LV_ANIM_FLOAT_LEFT, /*Float from/to the left*/
|
||||
LV_ANIM_FLOAT_BOTTOM, /*Float from/to the bottom*/
|
||||
@@ -181,25 +173,6 @@ typedef enum
|
||||
*/
|
||||
void lv_init(void);
|
||||
|
||||
/**
|
||||
* Mark the object as invalid therefore its current position will be redrawn by 'lv_refr_task'
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
void lv_obj_inv(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Notify an object about its style is modified
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
void lv_obj_refr_style(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Notify all object if a style is modified
|
||||
* @param style pinter to a style. Only objects with this style will be notified
|
||||
* (NULL to notify all objects)
|
||||
*/
|
||||
void lv_style_refr_all(void * style);
|
||||
|
||||
/**
|
||||
* Create a basic object
|
||||
* @param parent pointer to a parent object.
|
||||
@@ -211,7 +184,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy);
|
||||
|
||||
/**
|
||||
* Delete 'obj' and all of its children
|
||||
* @param obj
|
||||
* @param obj pointer to an object to delete
|
||||
*/
|
||||
void lv_obj_del(lv_obj_t * obj);
|
||||
|
||||
@@ -225,12 +198,10 @@ void lv_obj_del(lv_obj_t * obj);
|
||||
bool lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param);
|
||||
|
||||
/**
|
||||
* Return with a pointer to built-in style and/or copy it to a variable
|
||||
* @param style a style name from lv_objs_builtin_t enum
|
||||
* @param copy_p copy the style to this variable. (NULL if unused)
|
||||
* @return pointer to an lv_objs_t style
|
||||
* Mark the object as invalid therefore its current position will be redrawn by 'lv_refr_task'
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
lv_objs_t * lv_objs_get(lv_objs_builtin_t style, lv_objs_t * copy_p);
|
||||
void lv_obj_inv(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Load a new screen
|
||||
@@ -255,7 +226,7 @@ void lv_obj_set_pos(lv_obj_t * obj, cord_t x, cord_t y);
|
||||
|
||||
/**
|
||||
* Set relative the position of an object (relative to the parent).
|
||||
* The coordinates will be upscaled to compensate LV_DOWNSCALE.
|
||||
* The coordinates will be upscaled with LV_DOWNSCALE.
|
||||
* @param obj pointer to an object
|
||||
* @param x new distance from the left side of the parent. (will be multiplied with LV_DOWNSCALE)
|
||||
* @param y new distance from the top of the parent. (will be multiplied with LV_DOWNSCALE)
|
||||
@@ -271,7 +242,7 @@ void lv_obj_set_x(lv_obj_t * obj, cord_t x);
|
||||
|
||||
/**
|
||||
* Set the x coordinate of a object.
|
||||
* The coordinate will be upscaled to compensate LV_DOWNSCALE.
|
||||
* The coordinate will be upscaled with LV_DOWNSCALE.
|
||||
* @param obj pointer to an object
|
||||
* @param x new distance from the left side from the parent. (will be multiplied with LV_DOWNSCALE)
|
||||
*/
|
||||
@@ -286,7 +257,7 @@ void lv_obj_set_y(lv_obj_t * obj, cord_t y);
|
||||
|
||||
/**
|
||||
* Set the y coordinate of a object.
|
||||
* The coordinate will be upscaled to compensate LV_DOWNSCALE.
|
||||
* The coordinate will be upscaled with LV_DOWNSCALE.
|
||||
* @param obj pointer to an object
|
||||
* @param y new distance from the top of the parent. (will be multiplied with LV_DOWNSCALE)
|
||||
*/
|
||||
@@ -301,7 +272,7 @@ void lv_obj_set_y_us(lv_obj_t * obj, cord_t y);
|
||||
void lv_obj_set_size(lv_obj_t * obj, cord_t w, cord_t h);
|
||||
|
||||
/**
|
||||
* Set the size of an object. The coordinates will be upscaled to compensate LV_DOWNSCALE.
|
||||
* Set the size of an object. The coordinates will be upscaled with LV_DOWNSCALE.
|
||||
* @param obj pointer to an object
|
||||
* @param w new width (will be multiplied with LV_DOWNSCALE)
|
||||
* @param h new height (will be multiplied with LV_DOWNSCALE)
|
||||
@@ -316,7 +287,7 @@ void lv_obj_set_size_us(lv_obj_t * obj, cord_t w, cord_t h);
|
||||
void lv_obj_set_width(lv_obj_t * obj, cord_t w);
|
||||
|
||||
/**
|
||||
* Set the width of an object. The width will be upscaled to compensate LV_DOWNSCALE
|
||||
* Set the width of an object. The width will be upscaled with LV_DOWNSCALE
|
||||
* @param obj pointer to an object
|
||||
* @param w new width (will be multiplied with LV_DOWNSCALE)
|
||||
*/
|
||||
@@ -330,7 +301,7 @@ void lv_obj_set_width_us(lv_obj_t * obj, cord_t w);
|
||||
void lv_obj_set_height(lv_obj_t * obj, cord_t h);
|
||||
|
||||
/**
|
||||
* Set the height of an object. The height will be upscaled to compensate LV_DOWNSCALE
|
||||
* Set the height of an object. The height will be upscaled with LV_DOWNSCALE
|
||||
* @param obj pointer to an object
|
||||
* @param h new height (will be multiplied with LV_DOWNSCALE)
|
||||
*/
|
||||
@@ -347,7 +318,7 @@ void lv_obj_set_height_us(lv_obj_t * obj, cord_t h);
|
||||
void lv_obj_align(lv_obj_t * obj,lv_obj_t * base, lv_align_t align, cord_t x_mod, cord_t y_mod);
|
||||
|
||||
/**
|
||||
* Align an object to an other object. The coordinates will be upscaled to compensate LV_DOWNSCALE.
|
||||
* Align an object to an other object. The coordinates will be upscaled with LV_DOWNSCALE.
|
||||
* @param obj pointer to an object to align
|
||||
* @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it.
|
||||
* @param align type of alignment (see 'lv_align_t' enum)
|
||||
@@ -368,28 +339,20 @@ void lv_obj_set_ext_size(lv_obj_t * obj, cord_t ext_size);
|
||||
* @param obj pointer to an object
|
||||
* @param style_p pointer to the new style
|
||||
*/
|
||||
void lv_obj_set_style(lv_obj_t * obj, void * style);
|
||||
void lv_obj_set_style(lv_obj_t * obj, lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Isolate the style of an object. In other words a unique style will be created
|
||||
* for this object which can be freely modified independently from the style of the
|
||||
* other objects.
|
||||
*/
|
||||
void * lv_obj_iso_style(lv_obj_t * obj, uint32_t style_size);
|
||||
|
||||
/**
|
||||
* Set the opacity of an object
|
||||
* Notify an object about its style is modified
|
||||
* @param obj pointer to an object
|
||||
* @param opa 0 (transparent) .. 255(fully cover)
|
||||
*/
|
||||
void lv_obj_set_opa(lv_obj_t * obj, uint8_t opa);
|
||||
void lv_obj_refr_style(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Set the opacity of an object and all of its children
|
||||
* @param obj pointer to an object
|
||||
* @param opa 0 (transparent) .. 255(fully cover)
|
||||
* Notify all object if a style is modified
|
||||
* @param style pointer to a style. Only the objects with this style will be notified
|
||||
* (NULL to notify all objects)
|
||||
*/
|
||||
void lv_obj_set_opar(lv_obj_t * obj, uint8_t opa);
|
||||
void lv_style_refr_objs(void * style);
|
||||
|
||||
/**
|
||||
* Hide an object. It won't be visible and clickable.
|
||||
@@ -478,6 +441,7 @@ void * lv_obj_alloc_ext(lv_obj_t * obj, uint16_t ext_size);
|
||||
*/
|
||||
void lv_obj_refr_ext_size(lv_obj_t * obj);
|
||||
|
||||
#if LV_OBJ_FREE_NUM != 0
|
||||
/**
|
||||
* Set an application specific number for an object.
|
||||
* It can help to identify objects in the application.
|
||||
@@ -485,7 +449,9 @@ void lv_obj_refr_ext_size(lv_obj_t * obj);
|
||||
* @param free_num the new free number
|
||||
*/
|
||||
void lv_obj_set_free_num(lv_obj_t * obj, uint8_t free_num);
|
||||
#endif
|
||||
|
||||
#if LV_OBJ_FREE_P != 0
|
||||
/**
|
||||
* Set an application specific pointer for an object.
|
||||
* It can help to identify objects in the application.
|
||||
@@ -493,7 +459,7 @@ void lv_obj_set_free_num(lv_obj_t * obj, uint8_t free_num);
|
||||
* @param free_p the new free pinter
|
||||
*/
|
||||
void lv_obj_set_free_p(lv_obj_t * obj, void * free_p);
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Animate an object
|
||||
* @param obj pointer to an object to animate
|
||||
@@ -580,21 +546,14 @@ cord_t lv_obj_get_height(lv_obj_t * obj);
|
||||
* @param obj pointer to an object
|
||||
* @return the extended size attribute
|
||||
*/
|
||||
cord_t lv_obj_getext_size(lv_obj_t * obj);
|
||||
cord_t lv_obj_get_ext_size(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the style pointer of an object
|
||||
* Get the style pointer of an object (if NULL get style of the parent)
|
||||
* @param obj pointer to an object
|
||||
* @return pointer to a style
|
||||
*/
|
||||
void * lv_obj_get_style(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the opacity of an object
|
||||
* @param obj pointer to an object
|
||||
* @return 0 (transparent) .. 255 (fully cover)
|
||||
*/
|
||||
opa_t lv_obj_get_opa(lv_obj_t * obj);
|
||||
lv_style_t * lv_obj_get_style(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the hidden attribute of an object
|
||||
@@ -638,13 +597,6 @@ bool lv_obj_get_drag_throw(lv_obj_t * obj);
|
||||
*/
|
||||
bool lv_obj_get_drag_parent(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the style isolation attribute of an object
|
||||
* @param obj pointer to an object
|
||||
* @return pointer to a style
|
||||
*/
|
||||
bool lv_obj_get_style_iso(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the protect field of an object
|
||||
* @param obj pointer to an object
|
||||
@@ -682,25 +634,26 @@ lv_design_f_t lv_obj_get_design_f(lv_obj_t * obj);
|
||||
*/
|
||||
void * lv_obj_get_ext(lv_obj_t * obj);
|
||||
|
||||
#if LV_OBJ_FREE_NUM != 0
|
||||
/**
|
||||
* Get the free number
|
||||
* @param obj pointer to an object
|
||||
* @return the free number
|
||||
*/
|
||||
uint8_t lv_obj_get_free_num(lv_obj_t * obj);
|
||||
#endif
|
||||
|
||||
#if LV_OBJ_FREE_P != 0
|
||||
/**
|
||||
* Get the free pointer
|
||||
* @param obj pointer to an object
|
||||
* @return the free pointer
|
||||
*/
|
||||
void * lv_obj_get_free_p(lv_obj_t * obj);
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#define LV_SA(obj, style_type) ((style_type *) obj->style_p)
|
||||
#define LV_EA(obj, ext_type) ((ext_type *) obj->ext)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -45,8 +45,8 @@ static void lv_refr_obj(lv_obj_t * obj, const area_t * mask_ori_p);
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
lv_join_t inv_buf[LV_INV_FIFO_SIZE];
|
||||
uint16_t inv_buf_p;
|
||||
static lv_join_t inv_buf[LV_INV_FIFO_SIZE];
|
||||
static uint16_t inv_buf_p;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
@@ -76,6 +76,12 @@ void lv_refr_init(void)
|
||||
*/
|
||||
void lv_inv_area(const area_t * area_p)
|
||||
{
|
||||
/*Clear the invalidate buffer if the parameter is NULL*/
|
||||
if(area_p == NULL) {
|
||||
inv_buf_p = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
area_t scr_area;
|
||||
scr_area.x1 = 0;
|
||||
scr_area.y1 = 0;
|
||||
@@ -224,12 +230,12 @@ static void lv_refr_area_with_vdb(const area_t * area_p)
|
||||
lv_vdb_t * vdb_p = lv_vdb_get();
|
||||
|
||||
/*Always use the full row*/
|
||||
vdb_p->vdb_area.x1 = area_p->x1;
|
||||
vdb_p->vdb_area.y1 = area_p->y1;
|
||||
vdb_p->vdb_area.x2 = area_p->x2;
|
||||
vdb_p->area.x1 = area_p->x1;
|
||||
vdb_p->area.y1 = area_p->y1;
|
||||
vdb_p->area.x2 = area_p->x2;
|
||||
|
||||
/*Calculate the max row num*/
|
||||
uint32_t max_row = (uint32_t) LV_VDB_SIZE / (vdb_p->vdb_area.x2 - vdb_p->vdb_area.x1 + 1);
|
||||
uint32_t max_row = (uint32_t) LV_VDB_SIZE / (vdb_p->area.x2 - vdb_p->area.x1 + 1);
|
||||
if(max_row > area_get_height(area_p)) max_row = area_get_height(area_p);
|
||||
|
||||
/*Round the row number with downscale*/
|
||||
@@ -242,17 +248,17 @@ static void lv_refr_area_with_vdb(const area_t * area_p)
|
||||
|
||||
for(row = area_p->y1; row + max_row - 1 <= area_p->y2; row += max_row) {
|
||||
/*Calc. the next y coordinates of VDB*/
|
||||
vdb_p->vdb_area.y1 = row;
|
||||
vdb_p->vdb_area.y2 = row + max_row - 1;
|
||||
vdb_p->area.y1 = row;
|
||||
vdb_p->area.y2 = row + max_row - 1;
|
||||
|
||||
lv_refr_area_part_vdb(area_p);
|
||||
}
|
||||
|
||||
/*If the last y coordinates are not handled yet ...*/
|
||||
if(area_p->y2 != vdb_p->vdb_area.y2) {
|
||||
if(area_p->y2 != vdb_p->area.y2) {
|
||||
/*Calc. the next y coordinates of VDB*/
|
||||
vdb_p->vdb_area.y1 = row;
|
||||
vdb_p->vdb_area.y2 = area_p->y2;
|
||||
vdb_p->area.y1 = row;
|
||||
vdb_p->area.y2 = area_p->y2;
|
||||
|
||||
/*Refresh this part too*/
|
||||
lv_refr_area_part_vdb(area_p);
|
||||
@@ -271,7 +277,7 @@ static void lv_refr_area_part_vdb(const area_t * area_p)
|
||||
/*Get the new mask from the original area and the act. VDB
|
||||
It will be a part of 'area_p'*/
|
||||
area_t start_mask;
|
||||
area_union(&start_mask, area_p, &vdb_p->vdb_area);
|
||||
area_union(&start_mask, area_p, &vdb_p->area);
|
||||
|
||||
/*Get the most top object which is not covered by others*/
|
||||
top_p = lv_refr_get_top_obj(&start_mask, lv_scr_act());
|
||||
@@ -310,8 +316,8 @@ static lv_obj_t * lv_refr_get_top_obj(const area_t * area_p, lv_obj_t * obj)
|
||||
|
||||
/*If no better children check this object*/
|
||||
if(found_p == NULL) {
|
||||
if(obj->opa == OPA_COVER &&
|
||||
LV_SA(obj, lv_objs_t)->transp == 0 &&
|
||||
lv_style_t * style = lv_obj_get_style(obj);
|
||||
if(style->opa == OPA_COVER &&
|
||||
obj->design_f(obj, area_p, LV_DESIGN_COVER_CHK) != false) {
|
||||
found_p = obj;
|
||||
}
|
||||
@@ -396,10 +402,11 @@ static void lv_refr_obj(lv_obj_t * obj, const area_t * mask_ori_p)
|
||||
/*Draw the parent and its children only if they ore on 'mask_parent'*/
|
||||
if(union_ok != false) {
|
||||
|
||||
/* Redraw the object */
|
||||
if(obj->opa != OPA_TRANSP && LV_SA(obj, lv_objs_t)->transp == 0) {
|
||||
/* Redraw the object */
|
||||
lv_style_t * style = lv_obj_get_style(obj);
|
||||
if(style->opa != OPA_TRANSP) {
|
||||
obj->design_f(obj, &obj_ext_mask, LV_DESIGN_DRAW_MAIN);
|
||||
/* tick_wait_ms(100); */ /*DEBUG: Wait after every object draw to see the order of drawing*/
|
||||
//tick_wait_ms(100); /*DEBUG: Wait after every object draw to see the order of drawing*/
|
||||
}
|
||||
|
||||
/*Create a new 'obj_mask' without 'ext_size' because the children can't be visible there*/
|
||||
@@ -430,7 +437,7 @@ static void lv_refr_obj(lv_obj_t * obj, const area_t * mask_ori_p)
|
||||
}
|
||||
|
||||
/* If all the children are redrawn make 'post draw' design */
|
||||
if(obj->opa != OPA_TRANSP && LV_SA(obj, lv_objs_t)->transp == 0) {
|
||||
if(style->opa != OPA_TRANSP) {
|
||||
obj->design_f(obj, &obj_ext_mask, LV_DESIGN_DRAW_POST);
|
||||
}
|
||||
}
|
||||
|
||||
233
lv_obj/lv_style.c
Normal file
233
lv_obj/lv_style.c
Normal file
@@ -0,0 +1,233 @@
|
||||
/**
|
||||
* @file lv_style.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_conf.h"
|
||||
#include "lv_style.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
static lv_style_t lv_style_scr;
|
||||
static lv_style_t lv_style_transp;
|
||||
static lv_style_t lv_style_transp_tight;
|
||||
static lv_style_t lv_style_plain;
|
||||
static lv_style_t lv_style_plain_color;
|
||||
static lv_style_t lv_style_pretty;
|
||||
static lv_style_t lv_style_pretty_color;
|
||||
static lv_style_t lv_style_btn_rel;
|
||||
static lv_style_t lv_style_btn_pr;
|
||||
static lv_style_t lv_style_btn_trel;
|
||||
static lv_style_t lv_style_btn_tpr;
|
||||
static lv_style_t lv_style_btn_ina;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Init the basic styles
|
||||
*/
|
||||
void lv_style_init (void)
|
||||
{
|
||||
/* Not White/Black/Gray colors are created by HSV model with
|
||||
* HUE = 210*/
|
||||
|
||||
/*Screen style*/
|
||||
lv_style_scr.ccolor = COLOR_MAKE(0x20, 0x20, 0x20);
|
||||
lv_style_scr.opa = OPA_COVER;
|
||||
|
||||
lv_style_scr.mcolor = COLOR_MAKE(0xc9, 0xdb, 0xee);
|
||||
lv_style_scr.gcolor = COLOR_MAKE(0x4d, 0x91, 0xd5);
|
||||
lv_style_scr.bcolor = COLOR_BLACK;
|
||||
lv_style_scr.scolor = COLOR_GRAY;
|
||||
lv_style_scr.radius = 0;
|
||||
lv_style_scr.bwidth = 0;
|
||||
lv_style_scr.swidth = 0;
|
||||
lv_style_scr.stype = LV_STYPE_FULL;
|
||||
lv_style_scr.vpad = LV_DPI / 12;
|
||||
lv_style_scr.hpad = LV_DPI / 12;
|
||||
lv_style_scr.opad = LV_DPI / 12;
|
||||
lv_style_scr.bopa = OPA_COVER;
|
||||
lv_style_scr.empty = 0;
|
||||
lv_style_scr.glass = 0;
|
||||
|
||||
lv_style_scr.font = font_get(FONT_DEFAULT);
|
||||
lv_style_scr.letter_space = 1 * LV_DOWNSCALE;
|
||||
lv_style_scr.line_space = 3 * LV_DOWNSCALE;
|
||||
lv_style_scr.txt_align = LV_TXT_ALIGN_LEFT;
|
||||
lv_style_scr.img_recolor = OPA_TRANSP;
|
||||
lv_style_scr.line_width = 1 * LV_DOWNSCALE;
|
||||
|
||||
/*Plain style (by default near the same as the screen style)*/
|
||||
memcpy(&lv_style_plain, &lv_style_scr, sizeof(lv_style_t));
|
||||
lv_style_plain.mcolor = COLOR_WHITE;
|
||||
lv_style_plain.gcolor = COLOR_WHITE;
|
||||
lv_style_plain.bcolor = COLOR_WHITE;
|
||||
|
||||
/*Plain color style*/
|
||||
memcpy(&lv_style_plain_color, &lv_style_plain, sizeof(lv_style_t));
|
||||
lv_style_plain_color.ccolor = COLOR_MAKE(0xf0, 0xf0, 0xf0);
|
||||
lv_style_plain_color.mcolor = COLOR_MAKE(0x55, 0x96, 0xd8);
|
||||
lv_style_plain_color.gcolor = lv_style_plain_color.mcolor;
|
||||
|
||||
/*Pretty style */
|
||||
memcpy(&lv_style_pretty, &lv_style_plain, sizeof(lv_style_t));
|
||||
lv_style_pretty.ccolor = COLOR_MAKE(0x20, 0x20, 0x20);
|
||||
lv_style_pretty.mcolor = COLOR_WHITE;
|
||||
lv_style_pretty.gcolor = COLOR_SILVER;
|
||||
lv_style_pretty.bcolor = COLOR_MAKE(0x40, 0x40, 0x40);
|
||||
lv_style_pretty.radius = LV_DPI / 15;
|
||||
lv_style_pretty.bwidth = LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1;
|
||||
lv_style_pretty.bopa = OPA_50;
|
||||
|
||||
/*Pretty color style*/
|
||||
memcpy(&lv_style_pretty_color, &lv_style_pretty, sizeof(lv_style_t));
|
||||
lv_style_pretty_color.ccolor = COLOR_MAKE(0xe0, 0xe0, 0xe0);
|
||||
lv_style_pretty_color.mcolor = COLOR_MAKE(0x6b, 0x9a, 0xc7);
|
||||
lv_style_pretty_color.gcolor = COLOR_MAKE(0x2b, 0x59, 0x8b);
|
||||
lv_style_pretty_color.bcolor = COLOR_MAKE(0x15, 0x2c, 0x42);
|
||||
|
||||
/*Transparent style*/
|
||||
memcpy(&lv_style_transp, &lv_style_plain, sizeof(lv_style_t));
|
||||
lv_style_transp.empty = 1;
|
||||
lv_style_transp.bwidth = 0;
|
||||
lv_style_transp.glass = 1;
|
||||
|
||||
/*Transparent tight style*/
|
||||
memcpy(&lv_style_transp_tight, &lv_style_transp, sizeof(lv_style_t));
|
||||
lv_style_transp_tight.hpad = 0;
|
||||
lv_style_transp_tight.vpad = 0;
|
||||
|
||||
/*Button released style*/
|
||||
memcpy(&lv_style_btn_rel, &lv_style_plain, sizeof(lv_style_t));
|
||||
lv_style_btn_rel.mcolor = COLOR_MAKE(0x76, 0xa2, 0xd0);
|
||||
lv_style_btn_rel.gcolor = COLOR_MAKE(0x19, 0x3a, 0x5d);
|
||||
lv_style_btn_rel.bcolor = COLOR_MAKE(0x0b, 0x19, 0x28);
|
||||
lv_style_btn_rel.ccolor = COLOR_MAKE(0xff, 0xff, 0xff);
|
||||
lv_style_btn_rel.bwidth = LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1;
|
||||
lv_style_btn_rel.radius = LV_DPI / 15;
|
||||
lv_style_btn_rel.bopa = OPA_70;
|
||||
lv_style_btn_rel.scolor = COLOR_GRAY;
|
||||
lv_style_btn_rel.swidth = 0;
|
||||
lv_style_btn_rel.hpad = LV_DPI / 4;
|
||||
lv_style_btn_rel.vpad = LV_DPI / 6;
|
||||
lv_style_btn_rel.opad = LV_DPI / 10;
|
||||
|
||||
/*Button pressed style*/
|
||||
memcpy(&lv_style_btn_pr, &lv_style_btn_rel, sizeof(lv_style_t));
|
||||
lv_style_btn_pr.mcolor = COLOR_MAKE(0x33, 0x62, 0x94);
|
||||
lv_style_btn_pr.gcolor = COLOR_MAKE(0x10, 0x26, 0x3c);
|
||||
lv_style_btn_pr.ccolor = COLOR_MAKE(0xa4, 0xb5, 0xc6);
|
||||
|
||||
/*Button toggle released style*/
|
||||
memcpy(&lv_style_btn_trel, &lv_style_btn_rel, sizeof(lv_style_t));
|
||||
lv_style_btn_trel.mcolor = COLOR_MAKE(0x0a, 0x11, 0x22);
|
||||
lv_style_btn_trel.gcolor = COLOR_MAKE(0x37, 0x62, 0x90);
|
||||
lv_style_btn_trel.bcolor = COLOR_MAKE(0x01, 0x07, 0x0d);
|
||||
lv_style_btn_trel.ccolor = COLOR_MAKE(0xc8, 0xdd, 0xf4);
|
||||
|
||||
/*Button toggle pressed style*/
|
||||
memcpy(&lv_style_btn_tpr, &lv_style_btn_rel, sizeof(lv_style_t));
|
||||
lv_style_btn_tpr.mcolor = COLOR_MAKE(0x02, 0x14, 0x27);
|
||||
lv_style_btn_tpr.gcolor = COLOR_MAKE(0x2b, 0x4c, 0x70);
|
||||
lv_style_btn_tpr.ccolor = COLOR_MAKE(0xa4, 0xb5, 0xc6);
|
||||
|
||||
/*Button inactive style*/
|
||||
memcpy(&lv_style_btn_ina, &lv_style_btn_rel, sizeof(lv_style_t));
|
||||
lv_style_btn_ina.mcolor = COLOR_MAKE(0xd8, 0xd8, 0xd8);
|
||||
lv_style_btn_ina.gcolor = COLOR_MAKE(0xd8, 0xd8, 0xd8);
|
||||
lv_style_btn_ina.bcolor = COLOR_MAKE(0x90, 0x90, 0x90);
|
||||
lv_style_btn_ina.ccolor = COLOR_MAKE(0x70, 0x70, 0x70);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get style from its name
|
||||
* @param style_name an element of the 'lv_style_name_t' enum
|
||||
* @return pointer to the requested style (lv_style_def by default)
|
||||
*/
|
||||
lv_style_t * lv_style_get(lv_style_name_t style_name, lv_style_t * copy)
|
||||
{
|
||||
lv_style_t * style = &lv_style_plain;
|
||||
|
||||
switch(style_name) {
|
||||
case LV_STYLE_SCR:
|
||||
style = &lv_style_scr;
|
||||
break;
|
||||
case LV_STYLE_PLAIN:
|
||||
style = &lv_style_plain;
|
||||
break;
|
||||
case LV_STYLE_PLAIN_COLOR:
|
||||
style = &lv_style_plain_color;
|
||||
break;
|
||||
case LV_STYLE_PRETTY:
|
||||
style = &lv_style_pretty;
|
||||
break;
|
||||
case LV_STYLE_PRETTY_COLOR:
|
||||
style = &lv_style_pretty_color;
|
||||
break;
|
||||
case LV_STYLE_TRANSP:
|
||||
style = &lv_style_transp;
|
||||
break;
|
||||
case LV_STYLE_TRANSP_TIGHT:
|
||||
style = &lv_style_transp_tight;
|
||||
break;
|
||||
case LV_STYLE_BTN_REL:
|
||||
style = &lv_style_btn_rel;
|
||||
break;
|
||||
case LV_STYLE_BTN_PR:
|
||||
style = &lv_style_btn_pr;
|
||||
break;
|
||||
case LV_STYLE_BTN_TREL:
|
||||
style = &lv_style_btn_trel;
|
||||
break;
|
||||
case LV_STYLE_BTN_TPR:
|
||||
style = &lv_style_btn_tpr;
|
||||
break;
|
||||
case LV_STYLE_BTN_INA:
|
||||
style = &lv_style_btn_ina;
|
||||
break;
|
||||
default:
|
||||
style = &lv_style_plain;
|
||||
}
|
||||
|
||||
if(copy != NULL) memcpy(copy, style, sizeof(lv_style_t));
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy a style to an other
|
||||
* @param dest pointer to the destination style
|
||||
* @param src pointer to the source style
|
||||
*/
|
||||
void lv_style_cpy(lv_style_t * dest, const lv_style_t * src)
|
||||
{
|
||||
memcpy(dest, src, sizeof(lv_style_t));
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
105
lv_obj/lv_style.h
Normal file
105
lv_obj/lv_style.h
Normal file
@@ -0,0 +1,105 @@
|
||||
/**
|
||||
* @file lv_style.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_STYLE_H
|
||||
#define LV_STYLE_H
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <stdbool.h>
|
||||
#include "misc/gfx/color.h"
|
||||
#include "misc/gfx/area.h"
|
||||
#include "misc/gfx/font.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_RADIUS_CIRCLE (CORD_MAX) /*A very big radius to always draw as circle*/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef enum {
|
||||
LV_TXT_ALIGN_LEFT = 0,
|
||||
LV_TXT_ALIGN_MID,
|
||||
}lv_txt_align_t;
|
||||
|
||||
|
||||
/*Shadow types*/
|
||||
typedef enum
|
||||
{
|
||||
LV_STYPE_BOTTOM = 0,
|
||||
LV_STYPE_FULL,
|
||||
}lv_stype_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/*Object level styles*/
|
||||
color_t ccolor; /*Content color (e.g. text or image re-color )*/
|
||||
opa_t opa; /*Opacity of the object*/
|
||||
uint8_t glass :1; /*1: Do not inherit this style*/
|
||||
uint8_t empty :1; /*Transparent background (border drawn)*/
|
||||
uint8_t stype :2; /*Shadow type from 'lv_shadow_type_t'*/
|
||||
uint8_t txt_align:2;
|
||||
color_t mcolor; /*Main color of background*/
|
||||
color_t gcolor; /*Gradient color of background*/
|
||||
color_t bcolor; /*Border color of background*/
|
||||
color_t scolor; /*Shadow color of background*/
|
||||
cord_t radius; /*Corner radius of background*/
|
||||
cord_t bwidth; /*Width of the background border*/
|
||||
cord_t swidth; /*Width of the background shadow effect*/
|
||||
cord_t vpad; /*Vertical padding*/
|
||||
cord_t hpad; /*Horizontal padding*/
|
||||
cord_t opad; /*Object padding on the background*/
|
||||
opa_t bopa; /*Opacity of background border*/
|
||||
const font_t * font;
|
||||
cord_t letter_space;
|
||||
cord_t line_space;
|
||||
opa_t img_recolor;
|
||||
cord_t line_width;
|
||||
}lv_style_t;
|
||||
|
||||
typedef enum {
|
||||
LV_STYLE_SCR,
|
||||
LV_STYLE_TRANSP,
|
||||
LV_STYLE_TRANSP_TIGHT,
|
||||
LV_STYLE_PLAIN,
|
||||
LV_STYLE_PLAIN_COLOR,
|
||||
LV_STYLE_PRETTY,
|
||||
LV_STYLE_PRETTY_COLOR,
|
||||
LV_STYLE_BTN_REL,
|
||||
LV_STYLE_BTN_PR,
|
||||
LV_STYLE_BTN_TREL,
|
||||
LV_STYLE_BTN_TPR,
|
||||
LV_STYLE_BTN_INA,
|
||||
}lv_style_name_t;
|
||||
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Init the basic styles
|
||||
*/
|
||||
void lv_style_init (void);
|
||||
|
||||
/**
|
||||
* Get style from its name
|
||||
* @param style_name an element of the 'lv_style_name_t' enum
|
||||
* @return pointer to the requested style (lv_style_def by default)
|
||||
*/
|
||||
lv_style_t * lv_style_get(lv_style_name_t style_name, lv_style_t * copy);
|
||||
|
||||
void lv_style_cpy(lv_style_t * dest, const lv_style_t * src);
|
||||
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif
|
||||
@@ -53,8 +53,7 @@ lv_vdb_t * lv_vdb_get(void)
|
||||
void lv_vdb_flush(void)
|
||||
{
|
||||
#if LV_ANTIALIAS == 0
|
||||
disp_area(DISP_ID_ALL, vdb.vdb_area.x1 , vdb.vdb_area.y1, vdb.vdb_area.x2, vdb.vdb_area.y2);
|
||||
disp_map(DISP_ID_ALL, vdb.buf);
|
||||
disp_map(vdb.area.x1, vdb.area.y1, vdb.area.x2, vdb.area.y2, vdb.buf);
|
||||
#else
|
||||
/* Get the average of 2x2 pixels and put the result back to the VDB
|
||||
* The reading goes much faster then the write back
|
||||
@@ -69,25 +68,33 @@ void lv_vdb_flush(void)
|
||||
* */
|
||||
cord_t x;
|
||||
cord_t y;
|
||||
cord_t w = area_get_width(&vdb.vdb_area);
|
||||
cord_t w = area_get_width(&vdb.area);
|
||||
color_t * in1_buf = vdb.buf; /*Pointer to the first row*/
|
||||
color_t * in2_buf = vdb.buf + w; /*Pointer to the second row*/
|
||||
color_t * out_buf = vdb.buf; /*Store the result here*/
|
||||
for(y = vdb.vdb_area.y1; y < vdb.vdb_area.y2; y += 2) {
|
||||
for(x = vdb.vdb_area.x1; x < vdb.vdb_area.x2; x += 2) {
|
||||
/*Get the average of 2x2 red*/
|
||||
out_buf->red = (in1_buf->red + (in1_buf + 1)->red +
|
||||
in2_buf->red + (in2_buf+ 1)->red) >> 2;
|
||||
/*Get the average of 2x2 green*/
|
||||
out_buf->green = (in1_buf->green + (in1_buf + 1)->green +
|
||||
in2_buf->green + (in2_buf + 1)->green) >> 2;
|
||||
/*Get the average of 2x2 blue*/
|
||||
out_buf->blue = (in1_buf->blue + (in1_buf + 1)->blue +
|
||||
in2_buf->blue + (in2_buf + 1)->blue) >> 2;
|
||||
|
||||
in1_buf+=2; /*Skip the next pixel because it is already used above*/
|
||||
in2_buf+=2;
|
||||
out_buf++;
|
||||
for(y = vdb.area.y1; y < vdb.area.y2; y += 2) {
|
||||
for(x = vdb.area.x1; x < vdb.area.x2; x += 2) {
|
||||
|
||||
/*If the pixels are the same do not calculate the average */
|
||||
if(in1_buf->full == (in1_buf + 1)->full &&
|
||||
in1_buf->full == in2_buf->full &&
|
||||
in1_buf->full == (in2_buf + 1)->full) {
|
||||
out_buf->full = in1_buf->full;
|
||||
} else {
|
||||
/*Get the average of 2x2 red*/
|
||||
out_buf->red = (in1_buf->red + (in1_buf + 1)->red +
|
||||
in2_buf->red + (in2_buf+ 1)->red) >> 2;
|
||||
/*Get the average of 2x2 green*/
|
||||
out_buf->green = (in1_buf->green + (in1_buf + 1)->green +
|
||||
in2_buf->green + (in2_buf + 1)->green) >> 2;
|
||||
/*Get the average of 2x2 blue*/
|
||||
out_buf->blue = (in1_buf->blue + (in1_buf + 1)->blue +
|
||||
in2_buf->blue + (in2_buf + 1)->blue) >> 2;
|
||||
}
|
||||
|
||||
in1_buf += 2; /*Skip the next pixel because it is already used above*/
|
||||
in2_buf += 2;
|
||||
out_buf ++;
|
||||
}
|
||||
/*2 row is ready so go the next 2*/
|
||||
in1_buf += w; /*Skip the next row because it is processed from in2_buf*/
|
||||
@@ -96,8 +103,7 @@ void lv_vdb_flush(void)
|
||||
|
||||
/* Now the full the VDB is filtered and the result is stored in the first quarter of it
|
||||
* Write out the filtered map to the display*/
|
||||
disp_area(DISP_ID_ALL, vdb.vdb_area.x1 >> 1, vdb.vdb_area.y1 >> 1, vdb.vdb_area.x2 >> 1, vdb.vdb_area.y2 >> 1);
|
||||
disp_map(DISP_ID_ALL, vdb.buf);
|
||||
disp_map(vdb.area.x1 >> 1, vdb.area.y1 >> 1, vdb.area.x2 >> 1, vdb.area.y2 >> 1, vdb.buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -105,6 +111,4 @@ void lv_vdb_flush(void)
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,9 +13,8 @@
|
||||
|
||||
#if LV_VDB_SIZE != 0
|
||||
|
||||
#include "misc/others/color.h"
|
||||
#include <lvgl/lv_misc/area.h>
|
||||
#include "../lv_misc/font.h"
|
||||
#include "misc/gfx/color.h"
|
||||
#include "misc/gfx/area.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -27,7 +26,7 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
area_t vdb_area;
|
||||
area_t area;
|
||||
color_t buf[LV_VDB_SIZE];
|
||||
}lv_vdb_t;
|
||||
|
||||
|
||||
306
lv_objx/lv_bar.c
Normal file
306
lv_objx/lv_bar.c
Normal file
@@ -0,0 +1,306 @@
|
||||
|
||||
|
||||
/**
|
||||
* @file lv_bar.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_conf.h"
|
||||
#if USE_LV_BAR != 0
|
||||
|
||||
#include <lvgl/lv_objx/lv_bar.h>
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "misc/gfx/anim.h"
|
||||
#include <stdio.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_bar_design(lv_obj_t * bar, const area_t * mask, lv_design_mode_t mode);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_design_f_t ancestor_design_f;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/*-----------------
|
||||
* Create function
|
||||
*-----------------*/
|
||||
|
||||
/**
|
||||
* Create a bar objects
|
||||
* @param par pointer to an object, it will be the parent of the new bar
|
||||
* @param copy pointer to a bar object, if not NULL then the new object will be copied from it
|
||||
* @return pointer to the created bar
|
||||
*/
|
||||
lv_obj_t * lv_bar_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
{
|
||||
/*Create the ancestor basic object*/
|
||||
lv_obj_t * new_bar = lv_obj_create(par, copy);
|
||||
dm_assert(new_bar);
|
||||
|
||||
/*Allocate the object type specific extended data*/
|
||||
lv_bar_ext_t * ext = lv_obj_alloc_ext(new_bar, sizeof(lv_bar_ext_t));
|
||||
dm_assert(ext);
|
||||
ext->min_value = 0;
|
||||
ext->max_value = 100;
|
||||
ext->act_value = 0;
|
||||
ext->style_indic = lv_style_get(LV_STYLE_PRETTY_COLOR, NULL);
|
||||
|
||||
/* Save the ancient design function.
|
||||
* It will be used in the bar design function*/
|
||||
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_f(new_bar);
|
||||
|
||||
lv_obj_set_signal_f(new_bar, lv_bar_signal);
|
||||
lv_obj_set_design_f(new_bar, lv_bar_design);
|
||||
|
||||
/*Init the new bar object*/
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_click(new_bar, false);
|
||||
lv_obj_set_size(new_bar, LV_DPI * 2, LV_DPI / 3);
|
||||
lv_obj_set_style(new_bar, lv_style_get(LV_STYLE_PRETTY, NULL));
|
||||
lv_bar_set_value(new_bar, ext->act_value);
|
||||
} else {
|
||||
lv_bar_ext_t * ext_copy = lv_obj_get_ext(copy);
|
||||
ext->min_value = ext_copy->min_value;
|
||||
ext->max_value = ext_copy->max_value;
|
||||
ext->act_value = ext_copy->act_value;
|
||||
ext->style_indic = ext_copy->style_indic;
|
||||
/*Refresh the style with new signal function*/
|
||||
lv_obj_refr_style(new_bar);
|
||||
|
||||
lv_bar_set_value(new_bar, ext->act_value);
|
||||
}
|
||||
return new_bar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Signal function of the bar
|
||||
* @param bar pointer to a bar object
|
||||
* @param sign a signal type from lv_signal_t enum
|
||||
* @param param pointer to a signal specific variable
|
||||
*/
|
||||
bool lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param)
|
||||
{
|
||||
bool valid;
|
||||
|
||||
/* Include the ancient signal function */
|
||||
valid = lv_obj_signal(bar, sign, param);
|
||||
|
||||
/* The object can be deleted so check its validity and then
|
||||
* make the object specific signal handling */
|
||||
if(valid != false) {
|
||||
if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
|
||||
lv_style_t * style_indic = lv_bar_get_style_indic(bar);
|
||||
if(style_indic->swidth > bar->ext_size) bar->ext_size = style_indic->swidth;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Setter functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Set a new value on the bar
|
||||
* @param bar pointer to a bar object
|
||||
* @param value new value
|
||||
*/
|
||||
void lv_bar_set_value(lv_obj_t * bar, int16_t value)
|
||||
{
|
||||
lv_bar_ext_t * ext = lv_obj_get_ext(bar);
|
||||
ext->act_value = value > ext->max_value ? ext->max_value : value;
|
||||
ext->act_value = ext->act_value < ext->min_value ? ext->min_value : ext->act_value;
|
||||
lv_obj_inv(bar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a new value with animation on the bar
|
||||
* @param bar pointer to a bar object
|
||||
* @param value new value
|
||||
* @param anim_time animation time in milliseconds
|
||||
*/
|
||||
void lv_bar_set_value_anim(lv_obj_t * bar, int16_t value, uint16_t anim_time)
|
||||
{
|
||||
|
||||
lv_bar_ext_t * ext = lv_obj_get_ext(bar);
|
||||
int16_t new_value;
|
||||
new_value = value > ext->max_value ? ext->max_value : value;
|
||||
new_value = new_value < ext->min_value ? ext->min_value : new_value;
|
||||
|
||||
anim_t a;
|
||||
a.var = bar;
|
||||
a.start = ext->act_value;
|
||||
a.end = new_value;
|
||||
a.fp = (anim_fp_t)lv_bar_set_value;
|
||||
a.path = anim_get_path(ANIM_PATH_LIN);
|
||||
a.end_cb = NULL;
|
||||
a.act_time = 0;
|
||||
a.time = anim_time;
|
||||
a.playback = 0;
|
||||
a.playback_pause = 0;
|
||||
a.repeat = 0;
|
||||
a.repeat_pause = 0;
|
||||
|
||||
anim_create(&a);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set minimum and the maximum values of a bar
|
||||
* @param bar pointer to he bar object
|
||||
* @param min minimum value
|
||||
* @param max maximum value
|
||||
*/
|
||||
void lv_bar_set_range(lv_obj_t * bar, int16_t min, int16_t max)
|
||||
{
|
||||
lv_bar_ext_t * ext = lv_obj_get_ext(bar);
|
||||
ext->max_value = max;
|
||||
ext->max_value = max;
|
||||
if(ext->act_value > max) {
|
||||
ext->act_value = max;
|
||||
lv_bar_set_value(bar, ext->act_value);
|
||||
}
|
||||
lv_obj_inv(bar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the style of bar indicator
|
||||
* @param bar pointer to a bar object
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_bar_set_style_indic(lv_obj_t * bar, lv_style_t * style)
|
||||
{
|
||||
lv_bar_ext_t * ext = lv_obj_get_ext(bar);
|
||||
|
||||
ext->style_indic = style;
|
||||
|
||||
bar->signal_f(bar, LV_SIGNAL_REFR_EXT_SIZE, NULL);
|
||||
|
||||
lv_obj_inv(bar);
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Get the value of a bar
|
||||
* @param bar pointer to a bar object
|
||||
* @return the value of the bar
|
||||
*/
|
||||
int16_t lv_bar_get_value(lv_obj_t * bar)
|
||||
{
|
||||
lv_bar_ext_t * ext = lv_obj_get_ext(bar);
|
||||
return ext->act_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the minimum value of a bar
|
||||
* @param bar pointer to a bar object
|
||||
* @return the minimum value of the bar
|
||||
*/
|
||||
int16_t lv_bar_get_min_value(lv_obj_t * bar)
|
||||
{
|
||||
lv_bar_ext_t * ext = lv_obj_get_ext(bar);
|
||||
return ext->min_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum value of a bar
|
||||
* @param bar pointer to a bar object
|
||||
* @return the maximum value of the bar
|
||||
*/
|
||||
int16_t lv_bar_get_max_value(lv_obj_t * bar)
|
||||
{
|
||||
lv_bar_ext_t * ext = lv_obj_get_ext(bar);
|
||||
return ext->max_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the style of bar indicator
|
||||
* @param bar pointer to a bar object
|
||||
* @return pointer to the bar indicator style
|
||||
*/
|
||||
lv_style_t * lv_bar_get_style_indic(lv_obj_t * bar)
|
||||
{
|
||||
lv_bar_ext_t * ext = lv_obj_get_ext(bar);
|
||||
|
||||
if(ext->style_indic == NULL) return lv_obj_get_style(bar);
|
||||
|
||||
return ext->style_indic;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Handle the drawing related tasks of the bars
|
||||
* @param bar pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
*/
|
||||
static bool lv_bar_design(lv_obj_t * bar, const area_t * mask, lv_design_mode_t mode)
|
||||
{
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
/*Return false if the object is not covers the mask area*/
|
||||
return ancestor_design_f(bar, mask, mode);;
|
||||
} else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
ancestor_design_f(bar, mask, mode);
|
||||
|
||||
lv_bar_ext_t * ext = lv_obj_get_ext(bar);
|
||||
|
||||
lv_style_t * style_indic = lv_bar_get_style_indic(bar);
|
||||
area_t indic_area;
|
||||
area_cpy(&indic_area, &bar->cords);
|
||||
indic_area.x1 += style_indic->hpad;
|
||||
indic_area.x2 -= style_indic->hpad;
|
||||
indic_area.y1 += style_indic->vpad;
|
||||
indic_area.y2 -= style_indic->vpad;
|
||||
|
||||
cord_t w = area_get_width(&indic_area);
|
||||
cord_t h = area_get_height(&indic_area);
|
||||
|
||||
if(w >= h) {
|
||||
indic_area.x2 = (int32_t) ((int32_t)w * ext->act_value) / (ext->max_value - ext->min_value);
|
||||
indic_area.x2 += indic_area.x1;
|
||||
} else {
|
||||
indic_area.y1 = (int32_t) ((int32_t)h * ext->act_value) / (ext->max_value - ext->min_value);
|
||||
indic_area.y1 = indic_area.y2 - indic_area.y1;
|
||||
}
|
||||
|
||||
/*Draw the indicator*/
|
||||
lv_draw_rect(&indic_area, mask, style_indic);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
123
lv_objx/lv_bar.h
Normal file
123
lv_objx/lv_bar.h
Normal file
@@ -0,0 +1,123 @@
|
||||
/**
|
||||
* @file lv_bar.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_BAR_H
|
||||
#define LV_BAR_H
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_conf.h"
|
||||
#if USE_LV_BAR != 0
|
||||
|
||||
#include "../lv_obj/lv_obj.h"
|
||||
#include <lvgl/lv_objx/lv_cont.h>
|
||||
#include "lv_btn.h"
|
||||
#include "lv_label.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/*Data of bar*/
|
||||
typedef struct
|
||||
{
|
||||
/*No inherited ext*/ /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
int16_t act_value; /*Current value of the bar*/
|
||||
int16_t min_value; /*Minimum value of the bar*/
|
||||
int16_t max_value; /*Maximum value of the bar*/
|
||||
lv_style_t * style_indic; /*Style of the indicator*/
|
||||
}lv_bar_ext_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Create a bar objects
|
||||
* @param par pointer to an object, it will be the parent of the new bar
|
||||
* @param copy pointer to a bar object, if not NULL then the new object will be copied from it
|
||||
* @return pointer to the created bar
|
||||
*/
|
||||
lv_obj_t * lv_bar_create(lv_obj_t * par, lv_obj_t * copy);
|
||||
|
||||
/**
|
||||
* Signal function of the bar
|
||||
* @param bar pointer to a bar object
|
||||
* @param sign a signal type from lv_signal_t enum
|
||||
* @param param pointer to a signal specific variable
|
||||
*/
|
||||
bool lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param);
|
||||
|
||||
/**
|
||||
* Set a new value on the bar
|
||||
* @param bar pointer to a bar object
|
||||
* @param value new value
|
||||
*/
|
||||
void lv_bar_set_value(lv_obj_t * bar, int16_t value);
|
||||
|
||||
/**
|
||||
* Set a new value with animation on the bar
|
||||
* @param bar pointer to a bar object
|
||||
* @param value new value
|
||||
* @param anim_time animation time in milliseconds
|
||||
*/
|
||||
void lv_bar_set_value_anim(lv_obj_t * bar, int16_t value, uint16_t anim_time);
|
||||
|
||||
/**
|
||||
* Set minimum and the maximum values of a bar
|
||||
* @param bar pointer to he bar object
|
||||
* @param min minimum value
|
||||
* @param max maximum value
|
||||
*/
|
||||
void lv_bar_set_range(lv_obj_t * bar, int16_t min, int16_t max);
|
||||
|
||||
/**
|
||||
* Set the style of bar indicator
|
||||
* @param bar pointer to a bar object
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
void lv_bar_set_style_indic(lv_obj_t * bar, lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Get the value of a bar
|
||||
* @param bar pointer to a bar object
|
||||
* @return the value of the bar
|
||||
*/
|
||||
int16_t lv_bar_get_value(lv_obj_t * bar);
|
||||
|
||||
/**
|
||||
* Get the minimum value of a bar
|
||||
* @param bar pointer to a bar object
|
||||
* @return the minimum value of the bar
|
||||
*/
|
||||
int16_t lv_bar_get_min_value(lv_obj_t * bar);
|
||||
|
||||
/**
|
||||
* Get the maximum value of a bar
|
||||
* @param bar pointer to a bar object
|
||||
* @return the maximum value of the bar
|
||||
*/
|
||||
int16_t lv_bar_get_max_value(lv_obj_t * bar);
|
||||
|
||||
/**
|
||||
* Get the style of bar indicator
|
||||
* @param bar pointer to a bar object
|
||||
* @return pointer to the bar indicator style
|
||||
*/
|
||||
lv_style_t * lv_bar_get_style_indic(lv_obj_t * bar);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
397
lv_objx/lv_btn.c
397
lv_objx/lv_btn.c
@@ -7,16 +7,16 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include <lvgl/lv_misc/area.h>
|
||||
#include <lvgl/lv_obj/lv_obj.h>
|
||||
#include <misc/others/color.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "lv_conf.h"
|
||||
#if USE_LV_BTN != 0
|
||||
|
||||
#include <string.h>
|
||||
#include "lv_btn.h"
|
||||
#include "lvgl/lv_obj/lv_obj.h"
|
||||
#include "misc/gfx/area.h"
|
||||
#include "misc/gfx/color.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "lv_btn.h"
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -29,18 +29,13 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
#if 0
|
||||
static bool lv_btn_design(lv_obj_t * btn, const area_t * mask, lv_design_mode_t mode);
|
||||
static void lv_btn_style_load(lv_obj_t * btn, lv_rects_t * new_rects);
|
||||
static void lv_btns_init(void);
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_btns_t lv_btns_def;
|
||||
static lv_btns_t lv_btns_transp;
|
||||
static lv_btns_t lv_btns_border;
|
||||
|
||||
static lv_design_f_t ancestor_design_f;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
@@ -60,7 +55,7 @@ lv_obj_t * lv_btn_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
{
|
||||
lv_obj_t * new_btn;
|
||||
|
||||
new_btn = lv_rect_create(par, copy);
|
||||
new_btn = lv_cont_create(par, copy);
|
||||
dm_assert(new_btn);
|
||||
/*Allocate the extended data*/
|
||||
lv_btn_ext_t * ext = lv_obj_alloc_ext(new_btn, sizeof(lv_btn_ext_t));
|
||||
@@ -70,18 +65,20 @@ lv_obj_t * lv_btn_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->rel_action = NULL;
|
||||
ext->lpr_action = NULL;
|
||||
ext->lpr_rep_action = NULL;
|
||||
ext->styles[LV_BTN_STATE_REL] = lv_style_get(LV_STYLE_BTN_REL, NULL);
|
||||
ext->styles[LV_BTN_STATE_PR] = lv_style_get(LV_STYLE_BTN_PR, NULL);
|
||||
ext->styles[LV_BTN_STATE_TREL] = lv_style_get(LV_STYLE_BTN_TREL, NULL);
|
||||
ext->styles[LV_BTN_STATE_TPR] = lv_style_get(LV_STYLE_BTN_TPR, NULL);
|
||||
ext->styles[LV_BTN_STATE_INA] = lv_style_get(LV_STYLE_BTN_INA, NULL);
|
||||
ext->lpr_exec = 0;
|
||||
ext->tgl = 0;
|
||||
|
||||
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_f(new_btn);
|
||||
|
||||
lv_obj_set_signal_f(new_btn, lv_btn_signal);
|
||||
lv_obj_set_design_f(new_btn, lv_btn_design);
|
||||
|
||||
/*If no copy do the basic initialization*/
|
||||
if(copy == NULL) {
|
||||
lv_rect_set_layout(new_btn, LV_RECT_LAYOUT_CENTER);
|
||||
lv_obj_set_style(new_btn, lv_btns_get(LV_BTNS_DEF, NULL));
|
||||
lv_cont_set_layout(new_btn, LV_CONT_LAYOUT_CENTER);
|
||||
lv_obj_set_style(new_btn, ext->styles[LV_BTN_STATE_REL]);
|
||||
}
|
||||
/*Copy 'copy'*/
|
||||
else {
|
||||
@@ -91,6 +88,11 @@ lv_obj_t * lv_btn_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->rel_action = copy_ext->rel_action;
|
||||
ext->lpr_action = copy_ext->lpr_action;
|
||||
ext->lpr_rep_action = copy_ext->lpr_action;
|
||||
ext->styles[LV_BTN_STATE_REL] = copy_ext->styles[LV_BTN_STATE_REL];
|
||||
ext->styles[LV_BTN_STATE_PR] = copy_ext->styles[LV_BTN_STATE_PR];
|
||||
ext->styles[LV_BTN_STATE_TREL] = copy_ext->styles[LV_BTN_STATE_TREL];
|
||||
ext->styles[LV_BTN_STATE_TPR] = copy_ext->styles[LV_BTN_STATE_TPR];
|
||||
ext->styles[LV_BTN_STATE_INA] = copy_ext->styles[LV_BTN_STATE_INA];
|
||||
ext->tgl = copy_ext->tgl;
|
||||
|
||||
/*Refresh the style with new signal function*/
|
||||
@@ -111,90 +113,78 @@ bool lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
|
||||
bool valid;
|
||||
|
||||
/* Include the ancient signal function */
|
||||
valid = lv_rect_signal(btn, sign, param);
|
||||
valid = lv_cont_signal(btn, sign, param);
|
||||
|
||||
/* The object can be deleted so check its validity and then
|
||||
* make the object specific signal handling */
|
||||
if(valid != false) {
|
||||
lv_btn_ext_t * ext = lv_obj_get_ext(btn);
|
||||
lv_btn_state_t state = lv_btn_get_state(btn);
|
||||
lv_btn_ext_t * ext = lv_obj_get_ext(btn);
|
||||
bool tgl = lv_btn_get_tgl(btn);
|
||||
|
||||
switch (sign) {
|
||||
case LV_SIGNAL_PRESSED:
|
||||
/*Refresh the state*/
|
||||
if(ext->state == LV_BTN_STATE_REL) {
|
||||
lv_btn_set_state(btn, LV_BTN_STATE_PR);
|
||||
} else if(ext->state == LV_BTN_STATE_TGL_REL) {
|
||||
lv_btn_set_state(btn, LV_BTN_STATE_TGL_PR);
|
||||
}
|
||||
if(sign == LV_SIGNAL_PRESSED) {
|
||||
/*Refresh the state*/
|
||||
if(ext->state == LV_BTN_STATE_REL) {
|
||||
lv_btn_set_state(btn, LV_BTN_STATE_PR);
|
||||
} else if(ext->state == LV_BTN_STATE_TREL) {
|
||||
lv_btn_set_state(btn, LV_BTN_STATE_TPR);
|
||||
}
|
||||
|
||||
ext->lpr_exec = 0;
|
||||
/*Call the press action, here 'param' is the caller dispi*/
|
||||
if(ext->pr_action != NULL && state != LV_BTN_STATE_INA) {
|
||||
valid = ext->pr_action(btn, param);
|
||||
}
|
||||
break;
|
||||
|
||||
case LV_SIGNAL_PRESS_LOST:
|
||||
/*Refresh the state*/
|
||||
ext->lpr_exec = 0;
|
||||
/*Call the press action, 'param' is the caller dispi*/
|
||||
if(ext->pr_action != NULL && state != LV_BTN_STATE_INA) {
|
||||
valid = ext->pr_action(btn, param);
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_PRESS_LOST) {
|
||||
/*Refresh the state*/
|
||||
if(ext->state == LV_BTN_STATE_PR) lv_btn_set_state(btn, LV_BTN_STATE_REL);
|
||||
else if(ext->state == LV_BTN_STATE_TPR) lv_btn_set_state(btn, LV_BTN_STATE_TREL);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_PRESSING) {
|
||||
/*When the button begins to drag revert pressed states to released*/
|
||||
if(lv_dispi_is_dragging(param) != false) {
|
||||
if(ext->state == LV_BTN_STATE_PR) lv_btn_set_state(btn, LV_BTN_STATE_REL);
|
||||
else if(ext->state == LV_BTN_STATE_TGL_PR) lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL);
|
||||
|
||||
lv_obj_inv(btn);
|
||||
break;
|
||||
case LV_SIGNAL_PRESSING:
|
||||
/*When the button begins to drag revert pressed states to released*/
|
||||
if(lv_dispi_is_dragging(param) != false) {
|
||||
if(ext->state == LV_BTN_STATE_PR) lv_btn_set_state(btn, LV_BTN_STATE_REL);
|
||||
else if(ext->state == LV_BTN_STATE_TGL_PR) lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL);
|
||||
}
|
||||
lv_obj_inv(btn);
|
||||
break;
|
||||
|
||||
case LV_SIGNAL_RELEASED:
|
||||
/*If not dragged and it was not long press action then
|
||||
*change state and run the action*/
|
||||
if(lv_dispi_is_dragging(param) == false && ext->lpr_exec == 0) {
|
||||
if(ext->state == LV_BTN_STATE_PR && tgl == false) {
|
||||
lv_btn_set_state(btn, LV_BTN_STATE_REL);
|
||||
} else if(ext->state == LV_BTN_STATE_TGL_PR && tgl == false) {
|
||||
lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL);
|
||||
} else if(ext->state == LV_BTN_STATE_PR && tgl == true) {
|
||||
lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL);
|
||||
} else if(ext->state == LV_BTN_STATE_TGL_PR && tgl == true) {
|
||||
lv_btn_set_state(btn, LV_BTN_STATE_REL);
|
||||
}
|
||||
|
||||
if(ext->rel_action != NULL && state != LV_BTN_STATE_INA) {
|
||||
valid = ext->rel_action(btn, param);
|
||||
}
|
||||
} else { /*If dragged change back the state*/
|
||||
if(ext->state == LV_BTN_STATE_PR) {
|
||||
lv_btn_set_state(btn, LV_BTN_STATE_REL);
|
||||
} else if(ext->state == LV_BTN_STATE_TGL_PR) {
|
||||
lv_btn_set_state(btn, LV_BTN_STATE_TGL_REL);
|
||||
}
|
||||
lv_obj_inv(btn);
|
||||
else if(ext->state == LV_BTN_STATE_TPR) lv_btn_set_state(btn, LV_BTN_STATE_TREL);
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_RELEASED) {
|
||||
/*If not dragged and it was not long press action then
|
||||
*change state and run the action*/
|
||||
if(lv_dispi_is_dragging(param) == false && ext->lpr_exec == 0) {
|
||||
if(ext->state == LV_BTN_STATE_PR && tgl == false) {
|
||||
lv_btn_set_state(btn, LV_BTN_STATE_REL);
|
||||
} else if(ext->state == LV_BTN_STATE_TPR && tgl == false) {
|
||||
lv_btn_set_state(btn, LV_BTN_STATE_TREL);
|
||||
} else if(ext->state == LV_BTN_STATE_PR && tgl == true) {
|
||||
lv_btn_set_state(btn, LV_BTN_STATE_TREL);
|
||||
} else if(ext->state == LV_BTN_STATE_TPR && tgl == true) {
|
||||
lv_btn_set_state(btn, LV_BTN_STATE_REL);
|
||||
}
|
||||
|
||||
break;
|
||||
case LV_SIGNAL_LONG_PRESS:
|
||||
/*Call the long press action, here 'param' is the caller dispi*/
|
||||
if(ext->rel_action != NULL && state != LV_BTN_STATE_INA) {
|
||||
valid = ext->rel_action(btn, param);
|
||||
}
|
||||
} else { /*If dragged change back the state*/
|
||||
if(ext->state == LV_BTN_STATE_PR) {
|
||||
lv_btn_set_state(btn, LV_BTN_STATE_REL);
|
||||
} else if(ext->state == LV_BTN_STATE_TPR) {
|
||||
lv_btn_set_state(btn, LV_BTN_STATE_TREL);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_LONG_PRESS) {
|
||||
/*Call the long press action, 'param' is the caller dispi*/
|
||||
if(ext->lpr_action != NULL && state != LV_BTN_STATE_INA) {
|
||||
ext->lpr_exec = 1;
|
||||
ext->lpr_exec = 1;
|
||||
valid = ext->lpr_action(btn, param);
|
||||
}
|
||||
break;
|
||||
case LV_SIGNAL_LONG_PRESS_REP:
|
||||
/*Call the release action, here 'param' is the caller dispi*/
|
||||
if(ext->lpr_rep_action != NULL && state != LV_BTN_STATE_INA) {
|
||||
valid = ext->lpr_rep_action(btn, param);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/*Do nothing*/
|
||||
break;
|
||||
}
|
||||
else if(sign == LV_SIGNAL_LONG_PRESS_REP) {
|
||||
/*Call the release action, 'param' is the caller dispi*/
|
||||
if(ext->lpr_rep_action != NULL && state != LV_BTN_STATE_INA) {
|
||||
valid = ext->lpr_rep_action(btn, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,7 +217,7 @@ void lv_btn_set_state(lv_obj_t * btn, lv_btn_state_t state)
|
||||
lv_btn_ext_t * ext = lv_obj_get_ext(btn);
|
||||
if(ext->state != state) {
|
||||
ext->state = state;
|
||||
lv_obj_inv(btn);
|
||||
lv_obj_set_style(btn, ext->styles[state]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,6 +268,31 @@ void lv_btn_set_lpr_rep_action(lv_obj_t * btn, lv_action_t lpr_rep_action)
|
||||
|
||||
ext->lpr_rep_action = lpr_rep_action;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set styles of a button is each state
|
||||
* @param btn pointer to button object
|
||||
* @param rel pointer to a style for releases state
|
||||
* @param pr pointer to a style for pressed state
|
||||
* @param trel pointer to a style for toggled releases state
|
||||
* @param tpr pointer to a style for toggled pressed state
|
||||
* @param ina pointer to a style for inactive state
|
||||
*/
|
||||
void lv_btn_set_styles(lv_obj_t * btn, lv_style_t * rel, lv_style_t * pr,
|
||||
lv_style_t * trel, lv_style_t * tpr,
|
||||
lv_style_t * ina)
|
||||
{
|
||||
lv_btn_ext_t * ext = lv_obj_get_ext(btn);
|
||||
ext->styles[LV_BTN_STATE_REL] = rel;
|
||||
ext->styles[LV_BTN_STATE_PR] = pr;
|
||||
ext->styles[LV_BTN_STATE_TREL] = trel;
|
||||
ext->styles[LV_BTN_STATE_TPR] = tpr;
|
||||
ext->styles[LV_BTN_STATE_INA] = ina;
|
||||
|
||||
lv_obj_set_style(btn, ext->styles[ext->state]);
|
||||
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
@@ -307,49 +322,26 @@ bool lv_btn_get_tgl(lv_obj_t * btn)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return with a pointer to a built-in style and/or copy it to a variable
|
||||
* @param style a style name from lv_btns_builtin_t enum
|
||||
* @param copy copy the style to this variable. (NULL if unused)
|
||||
* @return pointer to an lv_btns_t style
|
||||
* Get the style of a button in a given state
|
||||
* @param btn pointer to a button object
|
||||
* @param state a state from 'lv_btn_state_t' in which style should be get
|
||||
* @return pointer to the style in the given state
|
||||
*/
|
||||
lv_btns_t * lv_btns_get(lv_btns_builtin_t style, lv_btns_t * copy)
|
||||
lv_style_t * lv_btn_get_style(lv_obj_t * btn, lv_btn_state_t state)
|
||||
{
|
||||
static bool style_inited = false;
|
||||
lv_btn_ext_t * ext = lv_obj_get_ext(btn);
|
||||
|
||||
/*Make the style initialization if it is not done yet*/
|
||||
if(style_inited == false) {
|
||||
lv_btns_init();
|
||||
style_inited = true;
|
||||
}
|
||||
if(ext->styles[state] == NULL) return lv_obj_get_style(btn->par);
|
||||
|
||||
lv_btns_t * style_p;
|
||||
|
||||
switch(style) {
|
||||
case LV_BTNS_DEF:
|
||||
style_p = &lv_btns_def;
|
||||
break;
|
||||
case LV_BTNS_TRANSP:
|
||||
style_p = &lv_btns_transp;
|
||||
break;
|
||||
case LV_BTNS_BORDER:
|
||||
style_p = &lv_btns_border;
|
||||
break;
|
||||
default:
|
||||
style_p = &lv_btns_def;
|
||||
}
|
||||
|
||||
if(copy != NULL) {
|
||||
if(style_p != NULL) memcpy(copy, style_p, sizeof(lv_btns_t));
|
||||
else memcpy(copy, &lv_btns_def, sizeof(lv_btns_t));
|
||||
}
|
||||
|
||||
return style_p;
|
||||
return ext->styles[state];
|
||||
}
|
||||
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* Handle the drawing related tasks of the buttons
|
||||
* @param btn pointer to a button object
|
||||
@@ -365,161 +357,12 @@ static bool lv_btn_design(lv_obj_t * btn, const area_t * mask, lv_design_mode_t
|
||||
|
||||
/* Because of the radius it is not sure the area is covered*/
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
/*Temporally set a rectangle style for the button to look like as rectangle*/
|
||||
lv_rects_t rects_tmp;
|
||||
lv_btns_t * btns_tmp = lv_obj_get_style(btn);
|
||||
bool ret = false;
|
||||
lv_btn_style_load(btn, &rects_tmp);
|
||||
if(rects_tmp.objs.transp == 0) {
|
||||
btn->style_p = &rects_tmp;
|
||||
ret = ancestor_design_f(btn, mask, mode); /*Draw the rectangle*/
|
||||
btn->style_p = btns_tmp; /*Reload the original button style*/
|
||||
}
|
||||
return ret;
|
||||
} else if(mode == LV_DESIGN_DRAW_MAIN || mode == LV_DESIGN_DRAW_POST) {
|
||||
area_t area;
|
||||
lv_obj_get_cords(btn, &area);
|
||||
return false;
|
||||
|
||||
} else if(mode == LV_DESIGN_DRAW_MAIN || mode == LV_DESIGN_DRAW_POST) {
|
||||
|
||||
/*Temporally set a rectangle style for the button to draw it as rectangle*/
|
||||
lv_rects_t rects_tmp;
|
||||
lv_btns_t * btns_tmp = lv_obj_get_style(btn);
|
||||
lv_btn_style_load(btn, &rects_tmp);
|
||||
if(rects_tmp.objs.transp == 0) {
|
||||
btn->style_p = &rects_tmp;
|
||||
ancestor_design_f(btn, mask, mode); /*Draw the rectangle*/
|
||||
btn->style_p = btns_tmp; /*Reload the original button style*/
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Crate a rectangle style according to the state of the button
|
||||
* @param btn pointer to a button object
|
||||
* @param new_rects load the style here (pointer to a rectangle style)
|
||||
*/
|
||||
static void lv_btn_style_load(lv_obj_t * btn, lv_rects_t * new_rects)
|
||||
{
|
||||
lv_btn_state_t state = lv_btn_get_state(btn);
|
||||
lv_btns_t * style = lv_obj_get_style(btn);
|
||||
|
||||
/*Load the style*/
|
||||
memcpy(new_rects, &style->rects, sizeof(lv_rects_t));
|
||||
new_rects->objs.color = style->mcolor[state];
|
||||
new_rects->gcolor = style->gcolor[state];
|
||||
new_rects->bcolor = style->bcolor[state];
|
||||
new_rects->lcolor = style->lcolor[state];
|
||||
new_rects->empty = style->flags[state].empty;
|
||||
new_rects->objs.transp = style->flags[state].transp;
|
||||
|
||||
if(style->flags[state].light_en != 0) new_rects->light = style->rects.light;
|
||||
else new_rects->light = 0;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the button styles
|
||||
*/
|
||||
static void lv_btns_init(void)
|
||||
{
|
||||
/*Default style*/
|
||||
lv_btns_def.mcolor[LV_BTN_STATE_REL] = COLOR_MAKE(0x60, 0x88, 0xb0);
|
||||
lv_btns_def.gcolor[LV_BTN_STATE_REL] = COLOR_MAKE(0x20, 0x30, 0x40);
|
||||
lv_btns_def.bcolor[LV_BTN_STATE_REL] = COLOR_MAKE(0xff, 0xff, 0xff);
|
||||
lv_btns_def.lcolor[LV_BTN_STATE_REL] = COLOR_MAKE(0x30, 0x40, 0x50);
|
||||
lv_btns_def.flags[LV_BTN_STATE_REL].light_en = 0;
|
||||
lv_btns_def.flags[LV_BTN_STATE_REL].transp = 0;
|
||||
lv_btns_def.flags[LV_BTN_STATE_REL].empty = 0;
|
||||
|
||||
lv_btns_def.mcolor[LV_BTN_STATE_PR] =COLOR_MAKE(0x50, 0x68, 0x80);
|
||||
lv_btns_def.gcolor[LV_BTN_STATE_PR] = COLOR_MAKE(0x18, 0x20, 0x28);
|
||||
lv_btns_def.bcolor[LV_BTN_STATE_PR] = COLOR_MAKE(0x60, 0x80, 0xa0);
|
||||
lv_btns_def.lcolor[LV_BTN_STATE_PR] = COLOR_MAKE(0x30, 0x40, 0x50);
|
||||
lv_btns_def.flags[LV_BTN_STATE_PR].light_en = 0;
|
||||
lv_btns_def.flags[LV_BTN_STATE_PR].transp = 0;
|
||||
lv_btns_def.flags[LV_BTN_STATE_PR].empty = 0;
|
||||
|
||||
lv_btns_def.mcolor[LV_BTN_STATE_TGL_REL] = COLOR_MAKE(0x40, 0x60, 0x80);
|
||||
lv_btns_def.gcolor[LV_BTN_STATE_TGL_REL] = COLOR_MAKE(0x10, 0x18, 0x20);
|
||||
lv_btns_def.bcolor[LV_BTN_STATE_TGL_REL] = COLOR_MAKE(0x20, 0x30, 0x40);
|
||||
lv_btns_def.lcolor[LV_BTN_STATE_TGL_REL] = COLOR_MAKE(0x30, 0x40, 0x50);
|
||||
lv_btns_def.flags[LV_BTN_STATE_TGL_REL].light_en = 1;
|
||||
lv_btns_def.flags[LV_BTN_STATE_TGL_REL].transp = 0;
|
||||
lv_btns_def.flags[LV_BTN_STATE_TGL_REL].empty = 0;
|
||||
|
||||
lv_btns_def.mcolor[LV_BTN_STATE_TGL_PR] = COLOR_MAKE(0x60, 0x80, 0xa0);
|
||||
lv_btns_def.gcolor[LV_BTN_STATE_TGL_PR] = COLOR_MAKE(0x20, 0x30, 0x40);
|
||||
lv_btns_def.bcolor[LV_BTN_STATE_TGL_PR] = COLOR_MAKE(0x20, 0x30, 0x40);
|
||||
lv_btns_def.lcolor[LV_BTN_STATE_TGL_PR] = COLOR_MAKE(0x30, 0x40, 0x50);
|
||||
lv_btns_def.flags[LV_BTN_STATE_TGL_PR].light_en = 1;
|
||||
lv_btns_def.flags[LV_BTN_STATE_TGL_PR].transp = 0;
|
||||
lv_btns_def.flags[LV_BTN_STATE_TGL_PR].empty = 0;
|
||||
|
||||
lv_btns_def.mcolor[LV_BTN_STATE_INA] = COLOR_SILVER;
|
||||
lv_btns_def.gcolor[LV_BTN_STATE_INA] = COLOR_GRAY;
|
||||
lv_btns_def.bcolor[LV_BTN_STATE_INA] = COLOR_WHITE;
|
||||
lv_btns_def.lcolor[LV_BTN_STATE_INA] = COLOR_MAKE(0x30, 0x40, 0x50);
|
||||
lv_btns_def.flags[LV_BTN_STATE_INA].light_en = 0;
|
||||
lv_btns_def.flags[LV_BTN_STATE_INA].transp= 0;
|
||||
lv_btns_def.flags[LV_BTN_STATE_INA].empty = 0;
|
||||
|
||||
lv_btns_def.rects.objs.color = lv_btns_def.mcolor[LV_BTN_STATE_REL];
|
||||
lv_btns_def.rects.gcolor = lv_btns_def.gcolor[LV_BTN_STATE_REL];
|
||||
lv_btns_def.rects.bcolor = lv_btns_def.bcolor[LV_BTN_STATE_REL];
|
||||
lv_btns_def.rects.objs.transp = 0;
|
||||
lv_btns_def.rects.empty = 0;
|
||||
lv_btns_def.rects.light = 6 * LV_DOWNSCALE;
|
||||
lv_btns_def.rects.bwidth = 2 * LV_DOWNSCALE;
|
||||
lv_btns_def.rects.bopa = 70;
|
||||
lv_btns_def.rects.empty = 0;
|
||||
lv_btns_def.rects.round = 4 * LV_DOWNSCALE;
|
||||
lv_btns_def.rects.hpad = 10 * LV_DOWNSCALE;
|
||||
lv_btns_def.rects.vpad = 15 * LV_DOWNSCALE;
|
||||
lv_btns_def.rects.opad = 10 * LV_DOWNSCALE;
|
||||
|
||||
/*Transparent style*/
|
||||
memcpy(&lv_btns_transp, &lv_btns_def, sizeof(lv_btns_t));
|
||||
lv_btns_transp.rects.bwidth = 0;
|
||||
lv_btns_transp.flags[LV_BTN_STATE_REL].transp = 1;
|
||||
lv_btns_transp.flags[LV_BTN_STATE_REL].empty = 1;
|
||||
lv_btns_transp.flags[LV_BTN_STATE_REL].light_en = 0;
|
||||
|
||||
lv_btns_transp.flags[LV_BTN_STATE_PR].transp = 1;
|
||||
lv_btns_transp.flags[LV_BTN_STATE_PR].empty = 1;
|
||||
lv_btns_transp.flags[LV_BTN_STATE_PR].light_en = 0;
|
||||
lv_btns_transp.flags[LV_BTN_STATE_TGL_REL].transp = 1;
|
||||
lv_btns_transp.flags[LV_BTN_STATE_TGL_REL].empty = 1;
|
||||
lv_btns_transp.flags[LV_BTN_STATE_TGL_REL].light_en = 0;
|
||||
lv_btns_transp.flags[LV_BTN_STATE_TGL_PR].transp = 1;
|
||||
lv_btns_transp.flags[LV_BTN_STATE_TGL_PR].empty = 1;
|
||||
lv_btns_transp.flags[LV_BTN_STATE_TGL_PR].light_en = 0;
|
||||
lv_btns_transp.flags[LV_BTN_STATE_INA].transp = 1;
|
||||
lv_btns_transp.flags[LV_BTN_STATE_INA].empty = 1;
|
||||
lv_btns_transp.flags[LV_BTN_STATE_INA].light_en = 0;
|
||||
|
||||
|
||||
/*Border style*/
|
||||
memcpy(&lv_btns_border, &lv_btns_def, sizeof(lv_btns_t));
|
||||
lv_btns_border.bcolor[LV_BTN_STATE_REL] = COLOR_BLACK;
|
||||
lv_btns_border.bcolor[LV_BTN_STATE_PR] = COLOR_BLACK;
|
||||
lv_btns_border.bcolor[LV_BTN_STATE_TGL_REL] = COLOR_BLACK;
|
||||
lv_btns_border.bcolor[LV_BTN_STATE_TGL_PR] = COLOR_BLACK;
|
||||
lv_btns_border.bcolor[LV_BTN_STATE_INA] = COLOR_GRAY;
|
||||
lv_btns_border.flags[LV_BTN_STATE_REL].empty = 1;
|
||||
lv_btns_border.flags[LV_BTN_STATE_PR].empty = 0;
|
||||
lv_btns_border.flags[LV_BTN_STATE_TGL_REL].empty = 0;
|
||||
lv_btns_border.flags[LV_BTN_STATE_TGL_PR].empty = 0;
|
||||
lv_btns_border.flags[LV_BTN_STATE_INA].empty = 1;
|
||||
lv_btns_border.flags[LV_BTN_STATE_REL].light_en = 0;
|
||||
lv_btns_border.flags[LV_BTN_STATE_PR].light_en = 0;
|
||||
lv_btns_border.flags[LV_BTN_STATE_TGL_REL].light_en = 0;
|
||||
lv_btns_border.flags[LV_BTN_STATE_TGL_PR].light_en = 0;
|
||||
lv_btns_border.flags[LV_BTN_STATE_INA].light_en = 0;
|
||||
lv_btns_border.rects.bwidth = 1 * LV_DOWNSCALE;
|
||||
lv_btns_border.rects.bopa = 50;
|
||||
lv_btns_border.rects.round = 4 * LV_DOWNSCALE;
|
||||
lv_btns_border.rects.hpad = 10 * LV_DOWNSCALE;
|
||||
lv_btns_border.rects.vpad = 10 * LV_DOWNSCALE;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
#if USE_LV_BTN != 0
|
||||
|
||||
/*Testing of dependencies*/
|
||||
#if USE_LV_RECT == 0
|
||||
#error "lv_btn: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) "
|
||||
#if USE_LV_CONT == 0
|
||||
#error "lv_btn: lv_cont is required. Enable it in lv_conf.h (USE_LV_CONT 1) "
|
||||
#endif
|
||||
|
||||
#include "lv_rect.h"
|
||||
#include <lvgl/lv_objx/lv_cont.h>
|
||||
#include "../lv_obj/lv_dispi.h"
|
||||
|
||||
/*********************
|
||||
@@ -28,12 +28,13 @@
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/*Button states*/
|
||||
typedef enum
|
||||
{
|
||||
LV_BTN_STATE_PR,
|
||||
LV_BTN_STATE_REL,
|
||||
LV_BTN_STATE_TGL_PR,
|
||||
LV_BTN_STATE_TGL_REL,
|
||||
LV_BTN_STATE_PR,
|
||||
LV_BTN_STATE_TREL,
|
||||
LV_BTN_STATE_TPR,
|
||||
LV_BTN_STATE_INA,
|
||||
LV_BTN_STATE_NUM,
|
||||
}lv_btn_state_t;
|
||||
@@ -41,46 +42,20 @@ typedef enum
|
||||
/*Data of button*/
|
||||
typedef struct
|
||||
{
|
||||
lv_rect_ext_t rect_ext; /*Ext. of ancestor*/
|
||||
lv_cont_ext_t cont; /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
lv_action_t pr_action;
|
||||
lv_action_t rel_action;
|
||||
lv_action_t lpr_action;
|
||||
lv_action_t lpr_rep_action;
|
||||
lv_action_t pr_action; /*A function to call when the button is pressed (NULL if unused)*/
|
||||
lv_action_t rel_action; /*A function to call when the button is released (NULL if unused)*/
|
||||
lv_action_t lpr_action; /*A function to call when the button is long pressed (NULL if unused)*/
|
||||
lv_action_t lpr_rep_action; /*A function to call periodically after long press (NULL if unused)*/
|
||||
|
||||
lv_btn_state_t state;
|
||||
uint8_t tgl :1; /*1: Toggle enabled*/
|
||||
uint8_t lpr_exec :1; /*1: long press action executed (Not for user)*/
|
||||
lv_style_t * styles[LV_BTN_STATE_NUM]; /*Styles in each state*/
|
||||
|
||||
lv_btn_state_t state; /*Current state of the button from 'lv_btn_state_t' enum*/
|
||||
uint8_t tgl :1; /*1: Toggle enabled*/
|
||||
uint8_t lpr_exec :1; /*1: Long press action executed (Handled by the library)*/
|
||||
}lv_btn_ext_t;
|
||||
|
||||
/*Bits of 'flag' in 'lv_btns_t'*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t light_en :1;
|
||||
uint8_t transp :1;
|
||||
uint8_t empty :1;
|
||||
}lv_btns_bits_t;
|
||||
|
||||
/*Style of button*/
|
||||
typedef struct
|
||||
{
|
||||
lv_rects_t rects; /*Style of ancestor*/
|
||||
/*New style element for this type */
|
||||
color_t mcolor[LV_BTN_STATE_NUM];
|
||||
color_t gcolor[LV_BTN_STATE_NUM];
|
||||
color_t bcolor[LV_BTN_STATE_NUM];
|
||||
color_t lcolor[LV_BTN_STATE_NUM];
|
||||
lv_btns_bits_t flags[LV_BTN_STATE_NUM];
|
||||
}lv_btns_t;
|
||||
|
||||
/*Built-in styles of button*/
|
||||
typedef enum
|
||||
{
|
||||
LV_BTNS_DEF,
|
||||
LV_BTNS_TRANSP,
|
||||
LV_BTNS_BORDER,
|
||||
}lv_btns_builtin_t;
|
||||
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
@@ -144,6 +119,17 @@ void lv_btn_set_lpr_action(lv_obj_t * btn, lv_action_t lpr_action);
|
||||
*/
|
||||
void lv_btn_set_lpr_rep_action(lv_obj_t * btn, lv_action_t lpr_rep_action);
|
||||
|
||||
/**
|
||||
* Set styles of a button is each state
|
||||
* @param btn pointer to button object
|
||||
* @param rel pointer to a style for releases state
|
||||
* @param pr pointer to a style for pressed state
|
||||
* @param trel pointer to a style for toggled releases state
|
||||
* @param tpr pointer to a style for toggled pressed state
|
||||
* @param ina pointer to a style for inactive state
|
||||
*/
|
||||
void lv_btn_set_styles(lv_obj_t * btn, lv_style_t * rel, lv_style_t * pr, lv_style_t * trel, lv_style_t * tpr, lv_style_t * ina);
|
||||
|
||||
/**
|
||||
* Get the current state of the button
|
||||
* @param btn pointer to a button object
|
||||
@@ -159,12 +145,12 @@ lv_btn_state_t lv_btn_get_state(lv_obj_t * btn);
|
||||
bool lv_btn_get_tgl(lv_obj_t * btn);
|
||||
|
||||
/**
|
||||
* Return with a pointer to a built-in style and/or copy it to a variable
|
||||
* @param style a style name from lv_btns_builtin_t enum
|
||||
* @param copy copy the style to this variable. (NULL if unused)
|
||||
* @return pointer to an lv_btns_t style
|
||||
* Get the style of a button in a given state
|
||||
* @param btn pointer to a button object
|
||||
* @param state a state from 'lv_btn_state_t' in which style should be get
|
||||
* @return pointer to the style in the given state
|
||||
*/
|
||||
lv_btns_t * lv_btns_get(lv_btns_builtin_t style, lv_btns_t * copy);
|
||||
lv_style_t * lv_btn_get_style(lv_obj_t * btn, lv_btn_state_t state);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
#if USE_LV_BTNM != 0
|
||||
|
||||
#include "lv_btnm.h"
|
||||
#include "misc/gfx/text.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_misc/text.h"
|
||||
#include "../lv_obj/lv_refr.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_BTNM_BTN_PR_INVALID 0xFFFF
|
||||
#define LV_BTNM_PR_NONE 0xFFFF
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@@ -26,18 +26,14 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
static bool lv_btnm_design(lv_obj_t * btnm, const area_t * mask, lv_design_mode_t mode);
|
||||
static uint8_t lv_btnm_get_width_unit(const char * btn_str);
|
||||
static uint16_t lv_btnm_get_btn_from_point(lv_obj_t * btnm, point_t * p);
|
||||
static void lv_btnm_create_btns(lv_obj_t * btnm, const char ** map);
|
||||
static void lv_btnms_init(void);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_btnms_t lv_btnms_def;
|
||||
|
||||
static const char * lv_btnm_def_map[] = {"Btn1","Btn2", "Btn3","\n",
|
||||
"\002Btn4","Btn5", ""};
|
||||
|
||||
@@ -64,33 +60,38 @@ static lv_design_f_t ancestor_design_f;
|
||||
lv_obj_t * lv_btnm_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
{
|
||||
/*Create the ancestor object*/
|
||||
lv_obj_t * new_btnm = lv_rect_create(par, copy);
|
||||
lv_obj_t * new_btnm = lv_cont_create(par, copy);
|
||||
dm_assert(new_btnm);
|
||||
|
||||
/*Allocate the object type specific extended data*/
|
||||
lv_btnm_ext_t * ext = lv_obj_alloc_ext(new_btnm, sizeof(lv_btnm_ext_t));
|
||||
dm_assert(ext);
|
||||
ext->btn_cnt = 0;
|
||||
ext->btn_pr = LV_BTNM_BTN_PR_INVALID;
|
||||
ext->btn_pr = LV_BTNM_PR_NONE;
|
||||
ext->btn_areas = NULL;
|
||||
ext->cb = NULL;
|
||||
ext->map_p = NULL;
|
||||
ext->style_btn_rel = lv_style_get(LV_STYLE_BTN_REL, NULL);
|
||||
ext->style_btn_pr = lv_style_get(LV_STYLE_BTN_PR, NULL);
|
||||
|
||||
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_f(new_btnm);
|
||||
|
||||
lv_obj_set_signal_f(new_btnm, lv_btnm_signal);
|
||||
lv_obj_set_design_f(new_btnm, lv_btnm_design);
|
||||
|
||||
|
||||
/*Init the new button matrix object*/
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_size(new_btnm, LV_HOR_RES / 2, LV_VER_RES / 2);
|
||||
lv_obj_set_style(new_btnm, lv_btnms_get(LV_BTNMS_DEF, NULL));
|
||||
lv_obj_set_size(new_btnm, LV_HOR_RES, LV_VER_RES / 2);
|
||||
lv_obj_set_style(new_btnm, lv_style_get(LV_STYLE_PLAIN, NULL));
|
||||
lv_btnm_set_map(new_btnm, lv_btnm_def_map);
|
||||
}
|
||||
/*Copy an existing object*/
|
||||
else {
|
||||
lv_btnm_ext_t * copy_ext = lv_obj_get_ext(copy);
|
||||
ext->style_btn_rel = copy_ext->style_btn_rel;
|
||||
ext->style_btn_pr = copy_ext->style_btn_pr;
|
||||
lv_btnm_set_map(new_btnm, lv_btnm_get_map(copy));
|
||||
ext->cb = copy_ext->cb;
|
||||
}
|
||||
|
||||
return new_btnm;
|
||||
@@ -108,83 +109,84 @@ bool lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
|
||||
bool valid;
|
||||
|
||||
/* Include the ancient signal function */
|
||||
valid = lv_rect_signal(btnm, sign, param);
|
||||
valid = lv_cont_signal(btnm, sign, param);
|
||||
|
||||
/* The object can be deleted so check its validity and then
|
||||
* make the object specific signal handling */
|
||||
if(valid != false) {
|
||||
lv_btnm_ext_t * ext = lv_obj_get_ext(btnm);
|
||||
uint16_t new_btn;
|
||||
area_t btnm_area;
|
||||
area_t btn_area;
|
||||
point_t p;
|
||||
switch(sign) {
|
||||
case LV_SIGNAL_CLEANUP:
|
||||
dm_free(ext->btn_areas);
|
||||
break;
|
||||
case LV_SIGNAL_STYLE_CHG:
|
||||
case LV_SIGNAL_CORD_CHG:
|
||||
lv_btnm_set_map(btnm, LV_EA(btnm, lv_btnm_ext_t)->map_p);
|
||||
break;
|
||||
case LV_SIGNAL_PRESSING:
|
||||
/*Search the pressed area*/
|
||||
lv_dispi_get_point(param, &p);
|
||||
new_btn = lv_btnm_get_btn_from_point(btnm, &p);
|
||||
/*Invalidate to old and the new areas*/;
|
||||
lv_obj_get_cords(btnm, &btnm_area);
|
||||
if(new_btn != ext->btn_pr) {
|
||||
lv_dispi_reset_lpr(param);
|
||||
if(ext->btn_pr != LV_BTNM_BTN_PR_INVALID) {
|
||||
area_cpy(&btn_area, &ext->btn_areas[ext->btn_pr]);
|
||||
btn_area.x1 += btnm_area.x1;
|
||||
btn_area.y1 += btnm_area.y1;
|
||||
btn_area.x2 += btnm_area.x1;
|
||||
btn_area.y2 += btnm_area.y1;
|
||||
lv_inv_area(&btn_area);
|
||||
}
|
||||
if(new_btn != LV_BTNM_BTN_PR_INVALID) {
|
||||
area_cpy(&btn_area, &ext->btn_areas[new_btn]);
|
||||
btn_area.x1 += btnm_area.x1;
|
||||
btn_area.y1 += btnm_area.y1;
|
||||
btn_area.x2 += btnm_area.x1;
|
||||
btn_area.y2 += btnm_area.y1;
|
||||
lv_inv_area(&btn_area);
|
||||
}
|
||||
}
|
||||
|
||||
ext->btn_pr = new_btn;
|
||||
break;
|
||||
case LV_SIGNAL_RELEASED:
|
||||
case LV_SIGNAL_LONG_PRESS_REP:
|
||||
if(ext->cb != NULL &&
|
||||
ext->btn_pr != LV_BTNM_BTN_PR_INVALID) {
|
||||
uint16_t txt_i = 0;
|
||||
uint16_t btn_i = 0;
|
||||
/*Search the next valid text in the map*/
|
||||
while(btn_i != ext->btn_pr) {
|
||||
btn_i ++;
|
||||
txt_i ++;
|
||||
if(strcmp(ext->map_p[txt_i], "\n") == 0) txt_i ++;
|
||||
}
|
||||
|
||||
ext->cb(btnm, txt_i);
|
||||
}
|
||||
if(sign == LV_SIGNAL_RELEASED && ext->btn_pr != LV_BTNM_BTN_PR_INVALID) {
|
||||
/*Invalidate to old area*/;
|
||||
lv_obj_get_cords(btnm, &btnm_area);
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
dm_free(ext->btn_areas);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_STYLE_CHG || sign == LV_SIGNAL_CORD_CHG) {
|
||||
lv_btnm_set_map(btnm, ext->map_p);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_PRESSING) {
|
||||
uint16_t btn_pr;
|
||||
/*Search the pressed area*/
|
||||
lv_dispi_get_point(param, &p);
|
||||
btn_pr = lv_btnm_get_btn_from_point(btnm, &p);
|
||||
/*Invalidate to old and the new areas*/;
|
||||
lv_obj_get_cords(btnm, &btnm_area);
|
||||
if(btn_pr != ext->btn_pr) {
|
||||
lv_dispi_reset_lpr(param);
|
||||
if(ext->btn_pr != LV_BTNM_PR_NONE) {
|
||||
area_cpy(&btn_area, &ext->btn_areas[ext->btn_pr]);
|
||||
btn_area.x1 += btnm_area.x1;
|
||||
btn_area.y1 += btnm_area.y1;
|
||||
btn_area.x2 += btnm_area.x1;
|
||||
btn_area.y2 += btnm_area.y1;
|
||||
lv_inv_area(&btn_area);
|
||||
}
|
||||
if(btn_pr != LV_BTNM_PR_NONE) {
|
||||
area_cpy(&btn_area, &ext->btn_areas[btn_pr]);
|
||||
btn_area.x1 += btnm_area.x1;
|
||||
btn_area.y1 += btnm_area.y1;
|
||||
btn_area.x2 += btnm_area.x1;
|
||||
btn_area.y2 += btnm_area.y1;
|
||||
lv_inv_area(&btn_area);
|
||||
}
|
||||
}
|
||||
|
||||
ext->btn_pr = LV_BTNM_BTN_PR_INVALID;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
ext->btn_pr = btn_pr;
|
||||
}
|
||||
else if(sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_LONG_PRESS_REP) {
|
||||
if(ext->cb != NULL && ext->btn_pr != LV_BTNM_PR_NONE) {
|
||||
uint16_t txt_i = 0;
|
||||
uint16_t btn_i = 0;
|
||||
|
||||
/* Search the text of ext->btn_pr the buttons text in the map
|
||||
* Skip "\n"-s*/
|
||||
while(btn_i != ext->btn_pr) {
|
||||
btn_i ++;
|
||||
txt_i ++;
|
||||
if(strcmp(ext->map_p[txt_i], "\n") == 0) txt_i ++;
|
||||
}
|
||||
|
||||
ext->cb(btnm, txt_i);
|
||||
}
|
||||
|
||||
if(sign == LV_SIGNAL_RELEASED && ext->btn_pr != LV_BTNM_PR_NONE) {
|
||||
/*Invalidate to old area*/;
|
||||
lv_obj_get_cords(btnm, &btnm_area);
|
||||
area_cpy(&btn_area, &ext->btn_areas[ext->btn_pr]);
|
||||
btn_area.x1 += btnm_area.x1;
|
||||
btn_area.y1 += btnm_area.y1;
|
||||
btn_area.x2 += btnm_area.x1;
|
||||
btn_area.y2 += btnm_area.y1;
|
||||
lv_inv_area(&btn_area);
|
||||
|
||||
ext->btn_pr = LV_BTNM_PR_NONE;
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_PRESS_LOST) {
|
||||
ext->btn_pr = LV_BTNM_PR_NONE;
|
||||
lv_obj_inv(btnm);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return valid;
|
||||
@@ -208,16 +210,17 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
|
||||
{
|
||||
if(map == NULL) return;
|
||||
|
||||
LV_EA(btnm, lv_btnm_ext_t)->map_p = map;
|
||||
lv_btnm_ext_t * ext = lv_obj_get_ext(btnm);
|
||||
ext->map_p = map;
|
||||
|
||||
/*Analyze the map and create the required number of buttons*/
|
||||
lv_btnm_create_btns(btnm, map);
|
||||
|
||||
/*Set size and positions of the buttons*/
|
||||
lv_btnms_t * btnms = lv_obj_get_style(btnm);
|
||||
cord_t max_w = lv_obj_get_width(btnm) - 2 * btnms->rects.hpad;
|
||||
cord_t max_h = lv_obj_get_height(btnm) - 2 * btnms->rects.vpad;
|
||||
cord_t act_y = btnms->rects.vpad;
|
||||
lv_style_t * btnms = lv_obj_get_style(btnm);
|
||||
cord_t max_w = lv_obj_get_width(btnm) - 2 * btnms->hpad;
|
||||
cord_t max_h = lv_obj_get_height(btnm) - 2 * btnms->vpad;
|
||||
cord_t act_y = btnms->vpad;
|
||||
|
||||
/*Count the lines to calculate button height*/
|
||||
uint8_t line_cnt = 1;
|
||||
@@ -226,7 +229,7 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
|
||||
if(strcmp(map[li], "\n") == 0) line_cnt ++;
|
||||
}
|
||||
|
||||
cord_t btn_h = max_h - ((line_cnt - 1) * btnms->rects.opad);
|
||||
cord_t btn_h = max_h - ((line_cnt - 1) * btnms->opad);
|
||||
btn_h = btn_h / line_cnt;
|
||||
|
||||
/* Count the units and the buttons in a line
|
||||
@@ -237,7 +240,6 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
|
||||
uint16_t i_tot = 0; /*Act. index in the str map*/
|
||||
uint16_t btn_i = 0; /*Act. index of button areas*/
|
||||
const char ** map_p_tmp = map;
|
||||
lv_btnm_ext_t * ext = lv_obj_get_ext(btnm);
|
||||
|
||||
/*Count the units and the buttons in a line*/
|
||||
while(1) {
|
||||
@@ -253,11 +255,11 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
|
||||
/*Only deal with the non empty lines*/
|
||||
if(btn_cnt != 0) {
|
||||
/*Calculate the width of all units*/
|
||||
cord_t all_unit_w = max_w - ((btn_cnt-1) * btnms->rects.opad);
|
||||
cord_t all_unit_w = max_w - ((btn_cnt-1) * btnms->opad);
|
||||
|
||||
/*Set the button size and positions and set the texts*/
|
||||
uint16_t i;
|
||||
cord_t act_x = btnms->rects.hpad;
|
||||
cord_t act_x = btnms->hpad;
|
||||
cord_t act_unit_w;
|
||||
unit_act_cnt = 0;
|
||||
for(i = 0; i < btn_cnt; i++) {
|
||||
@@ -267,7 +269,7 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
|
||||
act_unit_w = (all_unit_w * lv_btnm_get_width_unit(map_p_tmp[i])) / unit_cnt;
|
||||
|
||||
/*Always recalculate act_x because of rounding errors */
|
||||
act_x = (unit_act_cnt * all_unit_w) / unit_cnt + i * btnms->rects.opad + btnms->rects.hpad;
|
||||
act_x = (unit_act_cnt * all_unit_w) / unit_cnt + i * btnms->opad + btnms->hpad;
|
||||
|
||||
area_set(&ext->btn_areas[btn_i], act_x,
|
||||
act_y,
|
||||
@@ -280,7 +282,7 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
|
||||
btn_i ++;
|
||||
}
|
||||
}
|
||||
act_y += btn_h + btnms->rects.opad;
|
||||
act_y += btn_h + btnms->opad;
|
||||
if(strlen(map_p_tmp[btn_cnt]) == 0) break; /*Break on end of map*/
|
||||
map_p_tmp = &map_p_tmp[btn_cnt + 1]; /*Set the map to the next line*/
|
||||
i_tot ++; /*Skip the '\n'*/
|
||||
@@ -294,9 +296,26 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
|
||||
* @param btnm: pointer to button matrix object
|
||||
* @param cb pointer to a callback function
|
||||
*/
|
||||
void lv_btnm_set_cb(lv_obj_t * btnm, lv_btnm_callback_t cb)
|
||||
void lv_btnm_set_action(lv_obj_t * btnm, lv_btnm_callback_t cb)
|
||||
{
|
||||
LV_EA(btnm, lv_btnm_ext_t)->cb = cb;
|
||||
lv_btnm_ext_t * ext = lv_obj_get_ext(btnm);
|
||||
ext->cb = cb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the styles of the buttons of the button matrox
|
||||
* @param btnm pointer to a button matrix object
|
||||
* @param state style in this state (LV_BTN_STATE_PR or LV_BTN_STATE_REL)
|
||||
* @param style pointer to style
|
||||
*/
|
||||
void lv_btnm_set_styles_btn(lv_obj_t * btnm, lv_style_t * rel, lv_style_t * pr)
|
||||
{
|
||||
lv_btnm_ext_t * ext = lv_obj_get_ext(btnm);
|
||||
ext->style_btn_rel = rel;
|
||||
ext->style_btn_pr = pr;
|
||||
|
||||
lv_obj_inv(btnm);
|
||||
|
||||
}
|
||||
|
||||
/*=====================
|
||||
@@ -310,7 +329,8 @@ void lv_btnm_set_cb(lv_obj_t * btnm, lv_btnm_callback_t cb)
|
||||
*/
|
||||
const char ** lv_btnm_get_map(lv_obj_t * btnm)
|
||||
{
|
||||
return LV_EA(btnm, lv_btnm_ext_t)->map_p;
|
||||
lv_btnm_ext_t * ext = lv_obj_get_ext(btnm);
|
||||
return ext->map_p;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -318,44 +338,37 @@ const char ** lv_btnm_get_map(lv_obj_t * btnm)
|
||||
* @param btnm: pointer to button matrix object
|
||||
* @return pointer to the callback function
|
||||
*/
|
||||
lv_btnm_callback_t lv_btnm_get_cb(lv_obj_t * btnm)
|
||||
lv_btnm_callback_t lv_btnm_get_action(lv_obj_t * btnm)
|
||||
{
|
||||
return LV_EA(btnm, lv_btnm_ext_t)->cb;
|
||||
lv_btnm_ext_t * ext = lv_obj_get_ext(btnm);
|
||||
return ext->cb;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return with a pointer to a built-in style and/or copy it to a variable
|
||||
* @param style a style name from lv_btnms_builtin_t enum
|
||||
* @param copy copy the style to this variable. (NULL if unused)
|
||||
* @return pointer to an lv_btnms_t style
|
||||
* Get the style of buttons in button matrix
|
||||
* @param btnm pointer to a button matrix object
|
||||
* @param state style in this state (LV_BTN_STATE_PR or LV_BTN_STATE_REL)
|
||||
* @return pointer the button style in the given state
|
||||
*/
|
||||
lv_btnms_t * lv_btnms_get(lv_btnms_builtin_t style, lv_btnms_t * copy)
|
||||
lv_style_t * lv_btnm_get_style_btn(lv_obj_t * btnm, lv_btn_state_t state)
|
||||
{
|
||||
static bool style_inited = false;
|
||||
lv_style_t * style;
|
||||
lv_btnm_ext_t * ext = lv_obj_get_ext(btnm);
|
||||
|
||||
/*Make the style initialization if it is not done yet*/
|
||||
if(style_inited == false) {
|
||||
lv_btnms_init();
|
||||
style_inited = true;
|
||||
}
|
||||
switch(state) {
|
||||
case LV_BTN_STATE_PR:
|
||||
style = ext->style_btn_pr;
|
||||
break;
|
||||
case LV_BTN_STATE_REL:
|
||||
style = ext->style_btn_rel;
|
||||
break;
|
||||
default:
|
||||
style = NULL;
|
||||
}
|
||||
|
||||
lv_btnms_t *style_p;
|
||||
if(style == NULL) style = lv_obj_get_style(btnm);
|
||||
|
||||
switch(style) {
|
||||
case LV_BTNMS_DEF:
|
||||
style_p = &lv_btnms_def;
|
||||
break;
|
||||
default:
|
||||
style_p = &lv_btnms_def;
|
||||
}
|
||||
|
||||
if(copy != NULL) {
|
||||
if(style_p != NULL) memcpy(copy, style_p, sizeof(lv_btnms_t));
|
||||
else memcpy(copy, &lv_btnms_def, sizeof(lv_btnms_t));
|
||||
}
|
||||
|
||||
return style_p;
|
||||
return style;
|
||||
}
|
||||
|
||||
/**********************
|
||||
@@ -383,7 +396,7 @@ static bool lv_btnm_design(lv_obj_t * btnm, const area_t * mask, lv_design_mode_
|
||||
ancestor_design_f(btnm, mask, mode);
|
||||
|
||||
lv_btnm_ext_t * ext = lv_obj_get_ext(btnm);
|
||||
lv_btnms_t * style = lv_obj_get_style(btnm);
|
||||
lv_style_t * btn_style;
|
||||
|
||||
area_t area_btnm;
|
||||
area_t area_tmp;
|
||||
@@ -405,30 +418,18 @@ static bool lv_btnm_design(lv_obj_t * btnm, const area_t * mask, lv_design_mode_
|
||||
btn_h = area_get_height(&area_tmp);
|
||||
|
||||
/*Load the style*/
|
||||
lv_rects_t new_rects;
|
||||
lv_btn_state_t state;
|
||||
state = ext->btn_pr == btn_i ? LV_BTN_STATE_PR : LV_BTN_STATE_REL;
|
||||
memcpy(&new_rects, &style->btns, sizeof(lv_rects_t));
|
||||
new_rects.objs.color = style->btns.mcolor[state];
|
||||
new_rects.gcolor = style->btns.gcolor[state];
|
||||
new_rects.bcolor = style->btns.bcolor[state];
|
||||
new_rects.lcolor = style->btns.lcolor[state];
|
||||
new_rects.empty = style->btns.flags[state].empty;
|
||||
new_rects.objs.transp = style->btns.flags[state].transp;
|
||||
btn_style = lv_btnm_get_style_btn(btnm, ext->btn_pr == btn_i ? LV_BTN_STATE_PR : LV_BTN_STATE_REL);
|
||||
|
||||
if(style->btns.flags[state].light_en != 0) new_rects.light = style->rects.light;
|
||||
else new_rects.light = 0;
|
||||
|
||||
lv_draw_rect(&area_tmp, mask, &new_rects, OPA_COVER);
|
||||
lv_draw_rect(&area_tmp, mask, btn_style);
|
||||
|
||||
/*Search the next valid text in the map*/
|
||||
while(strcmp(ext->map_p[txt_i], "\n") == 0) txt_i ++;
|
||||
|
||||
/*Calculate the size of the text*/
|
||||
const font_t * font = font_get(style->labels.font);
|
||||
const font_t * font = btn_style->font;
|
||||
point_t txt_size;
|
||||
txt_get_size(&txt_size, ext->map_p[txt_i], font,
|
||||
style->labels.letter_space, style->labels.line_space,
|
||||
btn_style->letter_space, btn_style->line_space,
|
||||
area_get_width(&area_btnm), TXT_FLAG_NONE);
|
||||
|
||||
area_tmp.x1 += (btn_w - txt_size.x) / 2;
|
||||
@@ -436,7 +437,7 @@ static bool lv_btnm_design(lv_obj_t * btnm, const area_t * mask, lv_design_mode_
|
||||
area_tmp.x2 = area_tmp.x1 + txt_size.x;
|
||||
area_tmp.y2 = area_tmp.y1 + txt_size.y;
|
||||
|
||||
lv_draw_label(&area_tmp, mask, &style->labels, OPA_COVER, ext->map_p[txt_i], TXT_FLAG_NONE);
|
||||
lv_draw_label(&area_tmp, mask, btn_style, ext->map_p[txt_i], TXT_FLAG_NONE);
|
||||
txt_i ++;
|
||||
}
|
||||
}
|
||||
@@ -445,18 +446,6 @@ static bool lv_btnm_design(lv_obj_t * btnm, const area_t * mask, lv_design_mode_
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the button matrix styles
|
||||
*/
|
||||
static void lv_btnms_init(void)
|
||||
{
|
||||
/*Default style*/
|
||||
lv_rects_get(LV_RECTS_DEF, &lv_btnms_def.rects); /*Background rectangle style*/
|
||||
lv_btns_get(LV_BTNS_DEF, &lv_btnms_def.btns); /*Button style*/
|
||||
lv_labels_get(LV_LABELS_BTN, &lv_btnms_def.labels); /*BUtton label style*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the required number of buttons according to a map
|
||||
* @param btnm pointer to button matrix object
|
||||
@@ -478,6 +467,7 @@ static void lv_btnm_create_btns(lv_obj_t * btnm, const char ** map)
|
||||
|
||||
if(ext->btn_areas != NULL) {
|
||||
dm_free(ext->btn_areas);
|
||||
ext->btn_areas = NULL;
|
||||
}
|
||||
|
||||
ext->btn_areas = dm_alloc(sizeof(area_t) * btn_cnt);
|
||||
@@ -494,7 +484,6 @@ static uint8_t lv_btnm_get_width_unit(const char * btn_str)
|
||||
if(btn_str[0] <= '\011') return btn_str[0];
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
static uint16_t lv_btnm_get_btn_from_point(lv_obj_t * btnm, point_t * p)
|
||||
@@ -516,7 +505,7 @@ static uint16_t lv_btnm_get_btn_from_point(lv_obj_t * btnm, point_t * p)
|
||||
}
|
||||
}
|
||||
|
||||
if(i == ext->btn_cnt) i = LV_BTNM_BTN_PR_INVALID;
|
||||
if(i == ext->btn_cnt) i = LV_BTNM_PR_NONE;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -13,17 +13,7 @@
|
||||
#include "lv_conf.h"
|
||||
#if USE_LV_BTNM != 0
|
||||
|
||||
/*Testing of dependencies*/
|
||||
#if USE_LV_RECT == 0
|
||||
#error "lv_btnm: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) "
|
||||
#endif
|
||||
|
||||
#if USE_LV_BTN == 0
|
||||
#error "lv_btnm: lv_btn is required. Enable it in lv_conf.h (USE_LV_BTN 1) "
|
||||
#endif
|
||||
|
||||
#include "../lv_obj/lv_obj.h"
|
||||
#include "lv_rect.h"
|
||||
#include "lv_label.h"
|
||||
#include "lv_btn.h"
|
||||
|
||||
@@ -35,7 +25,7 @@
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/* Type of callback function which is called when a button is released
|
||||
/* Type of callback function which is called when a button is released on the button matrix
|
||||
* Parameters: button matrix, released button index in the map string
|
||||
* return LV_ACTION_RES_INV: the button matrix is deleted else LV_ACTION_RES_OK*/
|
||||
typedef lv_action_res_t (*lv_btnm_callback_t) (lv_obj_t *, uint16_t);
|
||||
@@ -43,31 +33,17 @@ typedef lv_action_res_t (*lv_btnm_callback_t) (lv_obj_t *, uint16_t);
|
||||
/*Data of button matrix*/
|
||||
typedef struct
|
||||
{
|
||||
lv_rect_ext_t rect; /*Ext. of ancestor*/
|
||||
lv_cont_ext_t bg; /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
const char ** map_p; /*Pointer to the current map*/
|
||||
area_t * btn_areas;
|
||||
uint16_t btn_cnt;
|
||||
uint16_t btn_pr;
|
||||
lv_btnm_callback_t cb;
|
||||
area_t * btn_areas; /*Array of areas for the buttons (Handled by the library)*/
|
||||
uint16_t btn_cnt; /*Number of button in 'map_p'(Handled by the library)*/
|
||||
uint16_t btn_pr; /*Index of the currently pressed button or LV_BTNM_PR_NONE (Handled by the library)*/
|
||||
lv_btnm_callback_t cb; /*A function to call when a button is releases*/
|
||||
lv_style_t * style_btn_rel; /*Style of the released buttons*/
|
||||
lv_style_t * style_btn_pr; /*Style of the pressed buttons*/
|
||||
}lv_btnm_ext_t;
|
||||
|
||||
/*Style of button matrix*/
|
||||
typedef struct
|
||||
{
|
||||
lv_rects_t rects; /*Style of ancestor*/
|
||||
/*New style element for this type */
|
||||
lv_btns_t btns; /*Style of the buttons*/
|
||||
lv_labels_t labels; /*Style of the labels on the buttons*/
|
||||
}lv_btnms_t;
|
||||
|
||||
/*Built-in styles of button matrix*/
|
||||
typedef enum
|
||||
{
|
||||
LV_BTNMS_DEF,
|
||||
}lv_btnms_builtin_t;
|
||||
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
@@ -106,7 +82,15 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map);
|
||||
* @param btnm: pointer to button matrix object
|
||||
* @param cb pointer to a callback function
|
||||
*/
|
||||
void lv_btnm_set_cb(lv_obj_t * btnm, lv_btnm_callback_t cb);
|
||||
void lv_btnm_set_action(lv_obj_t * btnm, lv_btnm_callback_t cb);
|
||||
|
||||
/**
|
||||
* Set the styles of the buttons of the button matrox
|
||||
* @param btnm pointer to a button matrix object
|
||||
* @param state style in this state (LV_BTN_STATE_PR or LV_BTN_STATE_REL)
|
||||
* @param style pointer to style
|
||||
*/
|
||||
void lv_btnm_set_styles_btn(lv_obj_t * btnm, lv_style_t * rel, lv_style_t * pr);
|
||||
|
||||
/**
|
||||
* Get the current map of a button matrix
|
||||
@@ -120,15 +104,15 @@ const char ** lv_btnm_get_map(lv_obj_t * btnm);
|
||||
* @param btnm: pointer to button matrix object
|
||||
* @return pointer to the callback function
|
||||
*/
|
||||
lv_btnm_callback_t lv_btnm_get_cb(lv_obj_t * btnm);
|
||||
lv_btnm_callback_t lv_btnm_get_action(lv_obj_t * btnm);
|
||||
|
||||
/**
|
||||
* Return with a pointer to a built-in style and/or copy it to a variable
|
||||
* @param style a style name from lv_btnms_builtin_t enum
|
||||
* @param copy copy the style to this variable. (NULL if unused)
|
||||
* @return pointer to an lv_btnms_t style
|
||||
* Get the style of buttons in button matrix
|
||||
* @param btnm pointer to a button matrix object
|
||||
* @param state style in this state (LV_BTN_STATE_PR or LV_BTN_STATE_REL)
|
||||
* @return pointer the button style in the given state
|
||||
*/
|
||||
lv_btnms_t * lv_btnms_get(lv_btnms_builtin_t style, lv_btnms_t * copy);
|
||||
lv_style_t * lv_btnm_get_style_btn(lv_obj_t * btnm, lv_btn_state_t state);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
138
lv_objx/lv_cb.c
138
lv_objx/lv_cb.c
@@ -23,12 +23,10 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_cb_design(lv_obj_t * cb, const area_t * mask, lv_design_mode_t mode);
|
||||
static void lv_cbs_init(void);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_cbs_t lv_cbs_def;
|
||||
static lv_design_f_t ancestor_design_f;
|
||||
/**********************
|
||||
* MACROS
|
||||
@@ -66,17 +64,22 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
|
||||
/*Init the new checkbox object*/
|
||||
if(copy == NULL) {
|
||||
lv_rect_set_layout(new_cb, LV_RECT_LAYOUT_ROW_M);
|
||||
lv_rect_set_fit(new_cb, true, true);
|
||||
ext->bullet = lv_btn_create(new_cb, NULL);
|
||||
lv_btn_set_styles(new_cb, lv_style_get(LV_STYLE_TRANSP, NULL), lv_style_get(LV_STYLE_TRANSP, NULL),
|
||||
lv_style_get(LV_STYLE_TRANSP, NULL), lv_style_get(LV_STYLE_TRANSP, NULL),
|
||||
lv_style_get(LV_STYLE_TRANSP, NULL));
|
||||
lv_cont_set_layout(new_cb, LV_CONT_LAYOUT_ROW_M);
|
||||
lv_cont_set_fit(new_cb, true, true);
|
||||
lv_btn_set_tgl(new_cb, true);
|
||||
|
||||
ext->bullet = lv_btn_create(new_cb, NULL);
|
||||
lv_obj_set_click(ext->bullet, false);
|
||||
lv_btn_set_styles(ext->bullet, lv_style_get(LV_STYLE_PRETTY, NULL), lv_style_get(LV_STYLE_PRETTY_COLOR, NULL),
|
||||
lv_style_get(LV_STYLE_BTN_TREL, NULL), lv_style_get(LV_STYLE_BTN_TPR, NULL),
|
||||
lv_style_get(LV_STYLE_BTN_INA, NULL));
|
||||
|
||||
ext->label = lv_label_create(new_cb, NULL);
|
||||
lv_obj_set_style(ext->label, NULL); /*Inherit the style of the parent*/
|
||||
lv_label_set_text(ext->label, "Check box");
|
||||
|
||||
lv_obj_set_style(new_cb, lv_cbs_get(LV_CBS_DEF, NULL));
|
||||
} else {
|
||||
lv_cb_ext_t * copy_ext = lv_obj_get_ext(copy);
|
||||
ext->bullet = lv_btn_create(new_cb, copy_ext->bullet);
|
||||
@@ -85,8 +88,6 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
/*Refresh the style with new signal function*/
|
||||
lv_obj_refr_style(new_cb);
|
||||
}
|
||||
|
||||
lv_obj_align_us(new_cb, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
return new_cb;
|
||||
}
|
||||
@@ -106,29 +107,19 @@ bool lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param)
|
||||
valid = lv_btn_signal(cb, sign, param);
|
||||
|
||||
lv_cb_ext_t * ext = lv_obj_get_ext(cb);
|
||||
lv_cbs_t * cbs = lv_obj_get_style(cb);
|
||||
lv_style_t * style = lv_obj_get_style(cb);
|
||||
|
||||
/* The object can be deleted so check its validity and then
|
||||
* make the object specific signal handling */
|
||||
if(valid != false) {
|
||||
switch(sign) {
|
||||
case LV_SIGNAL_PRESSED:
|
||||
case LV_SIGNAL_RELEASED:
|
||||
case LV_SIGNAL_LONG_PRESS:
|
||||
case LV_SIGNAL_PRESS_LOST:
|
||||
lv_btn_set_state(ext->bullet, lv_btn_get_state(cb));
|
||||
break;
|
||||
case LV_SIGNAL_STYLE_CHG:
|
||||
lv_obj_set_size(ext->bullet, cbs->bullet_size, cbs->bullet_size);
|
||||
lv_obj_set_style(ext->bullet, &cbs->bullet);
|
||||
lv_obj_set_style(ext->label, &cbs->label);
|
||||
break;
|
||||
case LV_SIGNAL_CLEANUP:
|
||||
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||
lv_obj_set_size(ext->bullet, font_get_height(style->font), font_get_height(style->font));
|
||||
}
|
||||
if(sign == LV_SIGNAL_PRESSED ||
|
||||
sign == LV_SIGNAL_RELEASED ||
|
||||
sign == LV_SIGNAL_PRESS_LOST) {
|
||||
lv_btn_set_state(lv_cb_get_bullet(cb), lv_btn_get_state(cb));
|
||||
}
|
||||
}
|
||||
|
||||
return valid;
|
||||
@@ -167,38 +158,16 @@ const char * lv_cb_get_text(lv_obj_t * cb)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return with a pointer to a built-in style and/or copy it to a variable
|
||||
* @param style a style name from lv_cbs_builtin_t enum
|
||||
* @param copy copy the style to this variable. (NULL if unused)
|
||||
* @return pointer to an lv_cbs_t style
|
||||
* Get the bullet (lv_btn) of a check box
|
||||
* @param cb pointer to check box object
|
||||
* @return pointer to the bullet of the check box (lv_btn)
|
||||
*/
|
||||
lv_cbs_t * lv_cbs_get(lv_cbs_builtin_t style, lv_cbs_t * copy)
|
||||
lv_obj_t * lv_cb_get_bullet(lv_obj_t * cb)
|
||||
{
|
||||
static bool style_inited = false;
|
||||
|
||||
/*Make the style initialization if it is not done yet*/
|
||||
if(style_inited == false) {
|
||||
lv_cbs_init();
|
||||
style_inited = true;
|
||||
}
|
||||
|
||||
lv_cbs_t *style_p;
|
||||
|
||||
switch(style) {
|
||||
case LV_CBS_DEF:
|
||||
style_p = &lv_cbs_def;
|
||||
break;
|
||||
default:
|
||||
style_p = &lv_cbs_def;
|
||||
}
|
||||
|
||||
if(copy != NULL) {
|
||||
if(style_p != NULL) memcpy(copy, style_p, sizeof(lv_cbs_t));
|
||||
else memcpy(copy, &lv_cbs_def, sizeof(lv_cbs_t));
|
||||
}
|
||||
|
||||
return style_p;
|
||||
lv_cb_ext_t * ext = lv_obj_get_ext(cb);
|
||||
return ext->bullet;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
@@ -234,61 +203,4 @@ static bool lv_cb_design(lv_obj_t * cb, const area_t * mask, lv_design_mode_t mo
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the rectangle styles
|
||||
*/
|
||||
static void lv_cbs_init(void)
|
||||
{
|
||||
/*Default style*/
|
||||
|
||||
/*Bg style*/
|
||||
lv_btns_get(LV_RECTS_TRANSP, &lv_cbs_def.bg);
|
||||
lv_cbs_def.bg.rects.hpad = 6 * LV_DOWNSCALE;
|
||||
lv_cbs_def.bg.rects.vpad = 6 * LV_DOWNSCALE;
|
||||
lv_cbs_def.bg.rects.opad = 5 * LV_DOWNSCALE;
|
||||
|
||||
/*Bullet style*/
|
||||
lv_btns_get(LV_BTNS_DEF, &lv_cbs_def.bullet);
|
||||
|
||||
lv_cbs_def.bullet.mcolor[LV_BTN_STATE_REL] = COLOR_WHITE;
|
||||
lv_cbs_def.bullet.gcolor[LV_BTN_STATE_REL] = COLOR_SILVER;
|
||||
lv_cbs_def.bullet.bcolor[LV_BTN_STATE_REL] = COLOR_BLACK;
|
||||
lv_cbs_def.bullet.flags[LV_BTN_STATE_REL].light_en = 0;
|
||||
|
||||
lv_cbs_def.bullet.mcolor[LV_BTN_STATE_PR] = COLOR_SILVER;
|
||||
lv_cbs_def.bullet.gcolor[LV_BTN_STATE_PR] = COLOR_GRAY;
|
||||
lv_cbs_def.bullet.bcolor[LV_BTN_STATE_PR] = COLOR_BLACK;
|
||||
lv_cbs_def.bullet.flags[LV_BTN_STATE_PR].light_en = 0;
|
||||
|
||||
lv_cbs_def.bullet.mcolor[LV_BTN_STATE_TGL_REL] = COLOR_MAKE(0x20, 0x30, 0x40);
|
||||
lv_cbs_def.bullet.gcolor[LV_BTN_STATE_TGL_REL] = COLOR_MAKE(0x10, 0x20, 0x30);
|
||||
lv_cbs_def.bullet.bcolor[LV_BTN_STATE_TGL_REL] = COLOR_WHITE;
|
||||
lv_cbs_def.bullet.flags[LV_BTN_STATE_TGL_REL].light_en = 1;
|
||||
|
||||
lv_cbs_def.bullet.mcolor[LV_BTN_STATE_TGL_PR] = COLOR_MAKE(0x50, 0x70, 0x90);
|
||||
lv_cbs_def.bullet.gcolor[LV_BTN_STATE_TGL_PR] = COLOR_MAKE(0x20, 0x30, 0x40);
|
||||
lv_cbs_def.bullet.bcolor[LV_BTN_STATE_TGL_PR] = COLOR_WHITE;
|
||||
lv_cbs_def.bullet.flags[LV_BTN_STATE_TGL_PR].light_en = 1;
|
||||
|
||||
lv_cbs_def.bullet.mcolor[LV_BTN_STATE_INA] = COLOR_SILVER;
|
||||
lv_cbs_def.bullet.gcolor[LV_BTN_STATE_INA] = COLOR_GRAY;
|
||||
lv_cbs_def.bullet.bcolor[LV_BTN_STATE_INA] = COLOR_WHITE;
|
||||
lv_cbs_def.bullet.flags[LV_BTN_STATE_INA].light_en = 0;
|
||||
|
||||
lv_cbs_def.bullet.rects.bwidth = 2 * LV_DOWNSCALE;
|
||||
lv_cbs_def.bullet.rects.bopa = 70;
|
||||
lv_cbs_def.bullet.rects.light = 6 * LV_DOWNSCALE;
|
||||
lv_cbs_def.bullet.rects.empty = 0;
|
||||
lv_cbs_def.bullet.rects.round = LV_OBJ_DEF_WIDTH / 3 / 4;
|
||||
lv_cbs_def.bullet.rects.hpad = 0 * LV_DOWNSCALE;
|
||||
lv_cbs_def.bullet.rects.vpad = 0 * LV_DOWNSCALE;
|
||||
lv_cbs_def.bullet.rects.opad = 0 * LV_DOWNSCALE;
|
||||
|
||||
/*Label*/
|
||||
lv_labels_get(LV_LABELS_TXT, &lv_cbs_def.label);
|
||||
lv_cbs_def.label.objs.color = COLOR_MAKE(0x10, 0x18, 0x20);
|
||||
|
||||
/*Others*/
|
||||
lv_cbs_def.bullet_size = LV_OBJ_DEF_WIDTH / 3;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -11,9 +11,10 @@
|
||||
*********************/
|
||||
#include "lv_conf.h"
|
||||
#if USE_LV_CB != 0
|
||||
|
||||
/*Testing of dependencies*/
|
||||
#if USE_LV_BTN == 0
|
||||
#error "lv_cb: lv_rect is required. Enable it in lv_conf.h (USE_LV_BTN 1) "
|
||||
#error "lv_cb: lv_btn is required. Enable it in lv_conf.h (USE_LV_BTN 1) "
|
||||
#endif
|
||||
|
||||
#if USE_LV_LABEL == 0
|
||||
@@ -37,26 +38,10 @@ typedef struct
|
||||
{
|
||||
lv_btn_ext_t bg_btn; /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
lv_obj_t * bullet;
|
||||
lv_obj_t * label;
|
||||
lv_obj_t * bullet; /*Pointer to button*/
|
||||
lv_obj_t * label; /*Pointer to label*/
|
||||
}lv_cb_ext_t;
|
||||
|
||||
/*Style of check box*/
|
||||
typedef struct
|
||||
{
|
||||
lv_btns_t bg; /*Style of ancestor*/
|
||||
/*New style element for this type */
|
||||
lv_btns_t bullet;
|
||||
lv_labels_t label;
|
||||
cord_t bullet_size;
|
||||
}lv_cbs_t;
|
||||
|
||||
/*Built-in styles of check box*/
|
||||
typedef enum
|
||||
{
|
||||
LV_CBS_DEF,
|
||||
}lv_cbs_builtin_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
@@ -92,12 +77,11 @@ void lv_cb_set_text(lv_obj_t * cb, const char * txt);
|
||||
const char * lv_cb_get_text(lv_obj_t * cb);
|
||||
|
||||
/**
|
||||
* Return with a pointer to a built-in style and/or copy it to a variable
|
||||
* @param style a style name from lv_cbs_builtin_t enum
|
||||
* @param copy copy the style to this variable. (NULL if unused)
|
||||
* @return pointer to an lv_cbs_t style
|
||||
* Get the bullet (lv_btn) of a check box
|
||||
* @param cb pointer to check box object
|
||||
* @return pointer to the bullet of the check box (lv_btn)
|
||||
*/
|
||||
lv_cbs_t * lv_cbs_get(lv_cbs_builtin_t style, lv_cbs_t * copy);
|
||||
lv_obj_t * lv_cb_get_bullet(lv_obj_t * cb);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_chart_design(lv_obj_t * chart, const area_t * mask, lv_design_mode_t mode);
|
||||
static void lv_charts_init(void);
|
||||
static void lv_chart_draw_div(lv_obj_t * chart, const area_t * mask);
|
||||
static void lv_chart_draw_lines(lv_obj_t * chart, const area_t * mask);
|
||||
static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask);
|
||||
@@ -39,8 +38,6 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask);
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_charts_t lv_charts_def;
|
||||
static lv_charts_t lv_charts_transp;
|
||||
static lv_design_f_t ancestor_design_f;
|
||||
|
||||
/**********************
|
||||
@@ -64,13 +61,13 @@ static lv_design_f_t ancestor_design_f;
|
||||
lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
{
|
||||
/*Create the ancestor basic object*/
|
||||
lv_obj_t * new_chart = lv_rect_create(par, copy);
|
||||
lv_obj_t * new_chart = lv_obj_create(par, copy);
|
||||
dm_assert(new_chart);
|
||||
|
||||
/*Allocate the object type specific extended data*/
|
||||
lv_chart_ext_t * ext = lv_obj_alloc_ext(new_chart, sizeof(lv_chart_ext_t));
|
||||
dm_assert(ext);
|
||||
ll_init(&ext->dl_ll, sizeof(cord_t *));
|
||||
ll_init(&ext->dl_ll, sizeof(lv_chart_dl_t));
|
||||
ext->dl_num = 0;
|
||||
ext->ymin = LV_CHART_YMIN_DEF;
|
||||
ext->ymax = LV_CHART_YMAX_DEF;
|
||||
@@ -78,6 +75,9 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->vdiv_num = LV_CHART_VDIV_DEF;
|
||||
ext->pnum = LV_CHART_PNUM_DEF;
|
||||
ext->type = LV_CHART_LINE;
|
||||
ext->dl_opa = OPA_COVER;
|
||||
ext->dl_dark = OPA_50;
|
||||
ext->dl_width = 2 * LV_DOWNSCALE;
|
||||
|
||||
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_f(new_chart);
|
||||
|
||||
@@ -86,7 +86,7 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
|
||||
/*Init the new chart background object*/
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_style(new_chart, lv_charts_get(LV_CHARTS_DEF, NULL));
|
||||
lv_obj_set_style(new_chart, lv_style_get(LV_STYLE_PRETTY, NULL));
|
||||
} else {
|
||||
lv_chart_ext_t * ext_copy = lv_obj_get_ext(copy);
|
||||
ext->type = ext_copy->type;
|
||||
@@ -95,6 +95,7 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->hdiv_num = ext_copy->hdiv_num;
|
||||
ext->vdiv_num = ext_copy->vdiv_num;
|
||||
ext->pnum = ext_copy->pnum;
|
||||
ext->dl_opa = ext_copy->dl_opa;
|
||||
|
||||
/*Refresh the style with new signal function*/
|
||||
lv_obj_refr_style(new_chart);
|
||||
@@ -114,24 +115,18 @@ bool lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param)
|
||||
bool valid;
|
||||
|
||||
/* Include the ancient signal function */
|
||||
valid = lv_rect_signal(chart, sign, param);
|
||||
valid = lv_obj_signal(chart, sign, param);
|
||||
|
||||
/* The object can be deleted so check its validity and then
|
||||
* make the object specific signal handling */
|
||||
if(valid != false) {
|
||||
cord_t ** datal;
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
|
||||
switch(sign) {
|
||||
case LV_SIGNAL_CLEANUP:
|
||||
LL_READ(ext->dl_ll, datal) {
|
||||
dm_free(*datal);
|
||||
}
|
||||
|
||||
ll_clear(&ext->dl_ll);
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
LL_READ(ext->dl_ll, datal) {
|
||||
dm_free(*datal);
|
||||
}
|
||||
ll_clear(&ext->dl_ll);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,20 +136,23 @@ bool lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param)
|
||||
/**
|
||||
* Allocate and add a data line to the chart
|
||||
* @param chart pointer to a chart object
|
||||
* @return pointer to the allocated data lie (an array for the data points)
|
||||
* @param color color of the data line
|
||||
* @return pointer to the allocated data line (
|
||||
*/
|
||||
cord_t * lv_chart_add_dataline(lv_obj_t * chart)
|
||||
lv_chart_dl_t * lv_chart_add_data_line(lv_obj_t * chart, color_t color)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
|
||||
cord_t ** dl = ll_ins_head(&ext->dl_ll);
|
||||
cord_t def = (ext->ymax - ext->ymin) >> 2; /*1/4 range as default value*/
|
||||
lv_chart_dl_t * dl = ll_ins_head(&ext->dl_ll);
|
||||
cord_t def = (ext->ymin + ext->ymax) >> 1; /*half range as default value*/
|
||||
|
||||
if(dl == NULL) return NULL;
|
||||
|
||||
*dl = dm_alloc(sizeof(cord_t) * ext->pnum);
|
||||
dl->color = color;
|
||||
|
||||
dl->points = dm_alloc(sizeof(cord_t) * ext->pnum);
|
||||
|
||||
uint16_t i;
|
||||
cord_t * p_tmp = *dl;
|
||||
cord_t * p_tmp = dl->points;
|
||||
for(i = 0; i < ext->pnum; i++) {
|
||||
*p_tmp = def;
|
||||
p_tmp++;
|
||||
@@ -162,7 +160,7 @@ cord_t * lv_chart_add_dataline(lv_obj_t * chart)
|
||||
|
||||
ext->dl_num++;
|
||||
|
||||
return *dl;
|
||||
return dl;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -232,38 +230,72 @@ void lv_chart_set_type(lv_obj_t * chart, lv_chart_type_t type)
|
||||
void lv_chart_set_pnum(lv_obj_t * chart, uint16_t pnum)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
|
||||
cord_t ** y_data;
|
||||
lv_chart_dl_t * dl;
|
||||
|
||||
if(pnum < 1) pnum = 1;
|
||||
|
||||
LL_READ_BACK(ext->dl_ll, y_data) {
|
||||
*y_data = dm_realloc(*y_data, sizeof(cord_t) * pnum);
|
||||
LL_READ_BACK(ext->dl_ll, dl) {
|
||||
dl->points = dm_realloc(dl->points, sizeof(cord_t) * pnum);
|
||||
}
|
||||
|
||||
ext->pnum = pnum;
|
||||
lv_chart_refr(chart);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the opacity of the data lines
|
||||
* @param chart pointer to chart object
|
||||
* @param opa opacity of the data lines
|
||||
*/
|
||||
void lv_chart_set_dl_opa(lv_obj_t * chart, opa_t opa)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
|
||||
ext->dl_opa = opa;
|
||||
lv_obj_inv(chart);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the line width or point radius of the data lines
|
||||
* @param chart pointer to chart object
|
||||
* @param width the new width
|
||||
*/
|
||||
void lv_chart_set_dl_width(lv_obj_t * chart, cord_t width)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
|
||||
ext->dl_width = width;
|
||||
lv_obj_inv(chart);
|
||||
}
|
||||
/**
|
||||
* Set the dark effect on the bottom of the points or columns
|
||||
* @param chart pointer to chart object
|
||||
* @param dark_eff dark effect level (OPA_TRANSP to turn off)
|
||||
*/
|
||||
void lv_chart_set_dl_dark(lv_obj_t * chart, opa_t dark_eff)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
|
||||
ext->dl_dark = dark_eff;
|
||||
}
|
||||
/**
|
||||
* Shift all data right and set the most right data on a data line
|
||||
* @param chart pointer to chart object
|
||||
* @param dl pointer to a data line on 'chart'
|
||||
* @param y the new value of the most right data
|
||||
*/
|
||||
void lv_chart_set_next(lv_obj_t * chart, cord_t * dl, cord_t y)
|
||||
void lv_chart_set_next(lv_obj_t * chart, lv_chart_dl_t * dl, cord_t y)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
|
||||
|
||||
uint16_t i;
|
||||
for(i = 0; i < ext->pnum - 1; i++) {
|
||||
dl[i] = dl[i + 1];
|
||||
dl->points[i] = dl->points[i + 1];
|
||||
}
|
||||
|
||||
dl[ext->pnum - 1] = y;
|
||||
dl->points[ext->pnum - 1] = y;
|
||||
lv_chart_refr(chart);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
@@ -293,42 +325,37 @@ uint16_t lv_chart_get_pnum(lv_obj_t * chart)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return with a pointer to a built-in style and/or copy it to a variable
|
||||
* @param style a style name from lv_charts_builtin_t enum
|
||||
* @param copy copy the style to this variable. (NULL if unused)
|
||||
* @return pointer to an lv_charts_t style
|
||||
* Get the opacity of the data lines
|
||||
* @param chart pointer to chart object
|
||||
* @return the opacity of the data lines
|
||||
*/
|
||||
lv_charts_t * lv_charts_get(lv_charts_builtin_t style, lv_charts_t * copy)
|
||||
opa_t lv_chart_get_dl_opa(lv_obj_t * chart)
|
||||
{
|
||||
static bool style_inited = false;
|
||||
|
||||
/*Make the style initialization if it is not done yet*/
|
||||
if(style_inited == false) {
|
||||
lv_charts_init();
|
||||
style_inited = true;
|
||||
}
|
||||
|
||||
lv_charts_t * style_p;
|
||||
|
||||
switch(style) {
|
||||
case LV_CHARTS_DEF:
|
||||
style_p = &lv_charts_def;
|
||||
break;
|
||||
case LV_CHARTS_TRANSP:
|
||||
style_p = &lv_charts_transp;
|
||||
break;
|
||||
default:
|
||||
style_p = &lv_charts_def;
|
||||
}
|
||||
|
||||
if(copy != NULL) {
|
||||
if(style_p != NULL) memcpy(copy, style_p, sizeof(lv_charts_t));
|
||||
else memcpy(copy, &lv_charts_def, sizeof(lv_charts_t));
|
||||
}
|
||||
|
||||
return style_p;
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
|
||||
return ext->dl_opa;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the data line width
|
||||
* @param chart pointer to chart object
|
||||
* @return the width the data lines (lines or points)
|
||||
*/
|
||||
cord_t lv_chart_get_dl_width(lv_obj_t * chart)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
|
||||
return ext->dl_width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the dark effect level on the bottom of the points or columns
|
||||
* @param chart pointer to chart object
|
||||
* @return dark effect level (OPA_TRANSP to turn off)
|
||||
*/
|
||||
opa_t lv_chart_get_dl_dark(lv_obj_t * chart, opa_t dark_eff)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
|
||||
return ext->dl_dark;
|
||||
}
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
@@ -350,28 +377,16 @@ static bool lv_chart_design(lv_obj_t * chart, const area_t * mask, lv_design_mod
|
||||
/*Return false if the object is not covers the mask_p area*/
|
||||
return ancestor_design_f(chart, mask, mode);
|
||||
} else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
/*Draw the rectangle ancient*/
|
||||
ancestor_design_f(chart, mask, mode);
|
||||
|
||||
/*Draw the object*/
|
||||
/*Draw the background*/
|
||||
lv_draw_rect(&chart->cords, mask, lv_obj_get_style(chart));
|
||||
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
|
||||
|
||||
lv_chart_draw_div(chart, mask);
|
||||
|
||||
switch(ext->type) {
|
||||
case LV_CHART_LINE:
|
||||
lv_chart_draw_lines(chart, mask);
|
||||
break;
|
||||
case LV_CHART_COL:
|
||||
lv_chart_draw_cols(chart, mask);
|
||||
break;
|
||||
case LV_CHART_POINT:
|
||||
lv_chart_draw_points(chart, mask);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(ext->type & LV_CHART_LINE) lv_chart_draw_lines(chart, mask);
|
||||
if(ext->type & LV_CHART_COL) lv_chart_draw_cols(chart, mask);
|
||||
if(ext->type & LV_CHART_POINT) lv_chart_draw_points(chart, mask);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -384,34 +399,61 @@ static bool lv_chart_design(lv_obj_t * chart, const area_t * mask, lv_design_mod
|
||||
static void lv_chart_draw_div(lv_obj_t * chart, const area_t * mask)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
|
||||
lv_charts_t * style = lv_obj_get_style(chart);
|
||||
|
||||
if(style->div_lines.objs.transp != 0) return;
|
||||
lv_style_t * style = lv_obj_get_style(chart);
|
||||
|
||||
uint8_t div_i;
|
||||
uint8_t div_i_end;
|
||||
uint8_t div_i_start;
|
||||
point_t p1;
|
||||
point_t p2;
|
||||
cord_t w = lv_obj_get_width(chart);
|
||||
cord_t h = lv_obj_get_height(chart);
|
||||
opa_t div_opa = (uint16_t)lv_obj_get_opa(chart) * style->div_line_opa / 100;
|
||||
cord_t x_ofs = chart->cords.x1;
|
||||
cord_t y_ofs = chart->cords.y1;
|
||||
p1.x = 0 + x_ofs;
|
||||
p2.x = w + x_ofs;
|
||||
for(div_i = 1; div_i <= ext->hdiv_num; div_i ++) {
|
||||
p1.y = (int32_t)((int32_t)h * div_i) / (ext->hdiv_num + 1);
|
||||
p1.y += y_ofs;
|
||||
p2.y = p1.y;
|
||||
lv_draw_line(&p1, &p2, mask, &style->div_lines, div_opa);
|
||||
|
||||
if(ext->hdiv_num != 0) {
|
||||
/*Draw slide lines if no border*/
|
||||
if(style->bwidth != 0) {
|
||||
div_i_start = 1;
|
||||
div_i_end = ext->hdiv_num;
|
||||
} else {
|
||||
div_i_start = 0;
|
||||
div_i_end = ext->hdiv_num + 1;
|
||||
}
|
||||
|
||||
p1.x = 0 + x_ofs;
|
||||
p2.x = w + x_ofs;
|
||||
for(div_i = div_i_start; div_i <= div_i_end; div_i++) {
|
||||
p1.y = (int32_t)((int32_t)h * div_i) / (ext->hdiv_num + 1);
|
||||
p1.y += y_ofs;
|
||||
if(div_i == div_i_start) p1.y += (style->line_width >> 1) + 1; /*The first line might not be visible*/
|
||||
if(div_i == div_i_end) p1.y -= (style->line_width >> 1) + 1; /*The last line might not be visible*/
|
||||
|
||||
p2.y = p1.y;
|
||||
lv_draw_line(&p1, &p2, mask, style);
|
||||
}
|
||||
}
|
||||
|
||||
p1.y = 0 + y_ofs;
|
||||
p2.y = h + y_ofs;
|
||||
for(div_i = 1; div_i <= ext->vdiv_num; div_i ++) {
|
||||
p1.x = (int32_t)((int32_t)w * div_i) / (ext->vdiv_num + 1);
|
||||
p1.x += x_ofs;
|
||||
p2.x = p1.x;
|
||||
lv_draw_line(&p1, &p2, mask, &style->div_lines, div_opa);
|
||||
if(ext->vdiv_num != 0) {
|
||||
/*Draw slide lines if no border*/
|
||||
if(style->bwidth != 0) {
|
||||
div_i_start = 1;
|
||||
div_i_end = ext->vdiv_num;
|
||||
} else {
|
||||
div_i_start = 0;
|
||||
div_i_end = ext->vdiv_num + 1;
|
||||
}
|
||||
|
||||
p1.y = 0 + y_ofs;
|
||||
p2.y = h + y_ofs;
|
||||
for(div_i = div_i_start; div_i <= div_i_end; div_i ++) {
|
||||
p1.x = (int32_t)((int32_t)w * div_i) / (ext->vdiv_num + 1);
|
||||
p1.x += x_ofs;
|
||||
if(div_i == div_i_start) p1.x += (style->line_width >> 1) + 1; /*The first line might not be visible*/
|
||||
if(div_i == div_i_end) p1.x -= (style->line_width >> 1) + 1; /*The last line might not be visible*/
|
||||
p2.x = p1.x;
|
||||
lv_draw_line(&p1, &p2, mask, style);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -422,30 +464,29 @@ static void lv_chart_draw_div(lv_obj_t * chart, const area_t * mask)
|
||||
static void lv_chart_draw_lines(lv_obj_t * chart, const area_t * mask)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
|
||||
lv_charts_t * style_p = lv_obj_get_style(chart);
|
||||
lv_style_t * style = lv_obj_get_style(chart);
|
||||
|
||||
uint8_t i;
|
||||
point_t p1;
|
||||
point_t p2;
|
||||
cord_t w = lv_obj_get_width(chart);
|
||||
cord_t h = lv_obj_get_height(chart);
|
||||
opa_t opa = (uint16_t)lv_obj_get_opa(chart) * style_p->data_opa / 100;
|
||||
cord_t x_ofs = chart->cords.x1;
|
||||
cord_t y_ofs = chart->cords.y1;
|
||||
int32_t y_tmp;
|
||||
cord_t ** y_data;
|
||||
uint8_t dl_cnt = 0;
|
||||
lv_lines_t lines;
|
||||
lv_lines_get(LV_LINES_CHART, &lines);
|
||||
lv_chart_dl_t * dl;
|
||||
lv_style_t lines;
|
||||
lv_style_get(LV_STYLE_PLAIN, &lines);
|
||||
lines.opa = (uint16_t)((uint16_t)style->opa * ext->dl_opa) >> 8;
|
||||
lines.line_width = ext->dl_width;
|
||||
|
||||
/*Go through all data lines*/
|
||||
LL_READ_BACK(ext->dl_ll, y_data) {
|
||||
lines.objs.color = style_p->color[dl_cnt];
|
||||
lines.width = style_p->width;
|
||||
LL_READ_BACK(ext->dl_ll, dl) {
|
||||
lines.ccolor = dl->color;
|
||||
|
||||
p1.x = 0 + x_ofs;
|
||||
p2.x = 0 + x_ofs;
|
||||
y_tmp = (int32_t)((int32_t) (*y_data)[0] - ext->ymin) * h;
|
||||
y_tmp = (int32_t)((int32_t) dl->points[0] - ext->ymin) * h;
|
||||
y_tmp = y_tmp / (ext->ymax - ext->ymin);
|
||||
p2.y = h - y_tmp + y_ofs;
|
||||
|
||||
@@ -455,13 +496,12 @@ static void lv_chart_draw_lines(lv_obj_t * chart, const area_t * mask)
|
||||
|
||||
p2.x = ((w * i) / (ext->pnum - 1)) + x_ofs;
|
||||
|
||||
y_tmp = (int32_t)((int32_t) (*y_data)[i] - ext->ymin) * h;
|
||||
y_tmp = (int32_t)((int32_t) dl->points[i] - ext->ymin) * h;
|
||||
y_tmp = y_tmp / (ext->ymax - ext->ymin);
|
||||
p2.y = h - y_tmp + y_ofs;
|
||||
|
||||
lv_draw_line(&p1, &p2, mask, &lines, opa);
|
||||
lv_draw_line(&p1, &p2, mask, &lines);
|
||||
}
|
||||
dl_cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -473,43 +513,43 @@ static void lv_chart_draw_lines(lv_obj_t * chart, const area_t * mask)
|
||||
static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
|
||||
lv_charts_t * style_p = lv_obj_get_style(chart);
|
||||
lv_style_t * style = lv_obj_get_style(chart);
|
||||
|
||||
uint8_t i;
|
||||
area_t cir_a;
|
||||
cord_t w = lv_obj_get_width(chart);
|
||||
cord_t h = lv_obj_get_height(chart);
|
||||
opa_t opa = (uint16_t)lv_obj_get_opa(chart) * style_p->data_opa / 100;
|
||||
cord_t x_ofs = chart->cords.x1;
|
||||
cord_t y_ofs = chart->cords.y1;
|
||||
int32_t y_tmp;
|
||||
cord_t ** y_data;
|
||||
uint8_t dl_cnt = 0;
|
||||
lv_rects_t rects;
|
||||
cord_t rad = style_p->width;
|
||||
lv_chart_dl_t * dl;
|
||||
uint8_t dl_cnt = 0;
|
||||
lv_style_t style_point;
|
||||
lv_style_get(LV_STYLE_PLAIN, &style_point);
|
||||
|
||||
lv_rects_get(LV_RECTS_DEF, &rects);
|
||||
rects.bwidth = 0;
|
||||
rects.empty = 0;
|
||||
rects.round = LV_RECT_CIRCLE;
|
||||
style_point.bwidth = 0;
|
||||
style_point.empty = 0;
|
||||
style_point.radius = LV_RADIUS_CIRCLE;
|
||||
style_point.opa = (uint16_t)((uint16_t)style->opa * ext->dl_opa) >> 8;
|
||||
style_point.radius = ext->dl_width;
|
||||
|
||||
/*Go through all data lines*/
|
||||
LL_READ_BACK(ext->dl_ll, y_data) {
|
||||
rects.objs.color = style_p->color[dl_cnt];
|
||||
rects.gcolor = color_mix(COLOR_BLACK, style_p->color[dl_cnt], style_p->dark_eff);
|
||||
LL_READ_BACK(ext->dl_ll, dl) {
|
||||
style_point.mcolor = dl->color;
|
||||
style_point.gcolor = color_mix(COLOR_BLACK, dl->color, ext->dl_dark);
|
||||
|
||||
for(i = 0; i < ext->pnum; i ++) {
|
||||
cir_a.x1 = ((w * i) / (ext->pnum - 1)) + x_ofs;
|
||||
cir_a.x2 = cir_a.x1 + rad;
|
||||
cir_a.x1 -= rad;
|
||||
cir_a.x2 = cir_a.x1 + style_point.radius;
|
||||
cir_a.x1 -= style_point.radius;
|
||||
|
||||
y_tmp = (int32_t)((int32_t) (*y_data)[i] - ext->ymin) * h;
|
||||
y_tmp = (int32_t)((int32_t) dl->points[i] - ext->ymin) * h;
|
||||
y_tmp = y_tmp / (ext->ymax - ext->ymin);
|
||||
cir_a.y1 = h - y_tmp + y_ofs;
|
||||
cir_a.y2 = cir_a.y1 + rad;
|
||||
cir_a.y1 -= rad;
|
||||
cir_a.y2 = cir_a.y1 + style_point.radius;
|
||||
cir_a.y1 -= style_point.radius;
|
||||
|
||||
lv_draw_rect(&cir_a, mask, &rects, opa);
|
||||
lv_draw_rect(&cir_a, mask, &style_point);
|
||||
}
|
||||
dl_cnt++;
|
||||
}
|
||||
@@ -523,7 +563,7 @@ static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask)
|
||||
static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext(chart);
|
||||
lv_charts_t * style_p = lv_obj_get_style(chart);
|
||||
lv_style_t * style = lv_obj_get_style(chart);
|
||||
|
||||
uint8_t i;
|
||||
area_t col_a;
|
||||
@@ -531,89 +571,44 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask)
|
||||
bool mask_ret;
|
||||
cord_t w = lv_obj_get_width(chart);
|
||||
cord_t h = lv_obj_get_height(chart);
|
||||
opa_t opa = (uint16_t)lv_obj_get_opa(chart) * style_p->data_opa / 100;
|
||||
int32_t y_tmp;
|
||||
cord_t ** y_data;
|
||||
uint8_t dl_cnt = 0;
|
||||
lv_rects_t rects;
|
||||
cord_t col_w = w / (2 * ext->dl_num * ext->pnum); /* Suppose (2 * dl_num) * pnum columns*/
|
||||
lv_chart_dl_t * dl;
|
||||
lv_style_t rects;
|
||||
cord_t col_w = w / ((ext->dl_num + 1) * ext->pnum); /* Suppose + 1 dl as separator*/
|
||||
cord_t x_ofs = col_w / 2; /*Shift with a half col.*/
|
||||
lv_rects_get(LV_RECTS_DEF, &rects);
|
||||
|
||||
lv_style_get(LV_STYLE_PLAIN, &rects);
|
||||
rects.bwidth = 0;
|
||||
rects.empty = 0;
|
||||
rects.round = 0;
|
||||
rects.radius = 0;
|
||||
rects.opa = (uint16_t)((uint16_t)style->opa * ext->dl_opa) >> 8;
|
||||
|
||||
col_a.y2 = chart->cords.y2;
|
||||
|
||||
/*Go through all data lines*/
|
||||
LL_READ_BACK(ext->dl_ll, y_data) {
|
||||
rects.objs.color = style_p->color[dl_cnt];
|
||||
rects.gcolor = color_mix(COLOR_BLACK, style_p->color[dl_cnt], style_p->dark_eff);
|
||||
cord_t x_act;
|
||||
|
||||
for(i = 0; i < ext->pnum; i ++) {
|
||||
/* Calculate the x coordinates. Suppose (2 * dl_num) * pnum columns and draw to every second
|
||||
* the other columns will be spaces.
|
||||
* col_w = w / (2 * ext->dl_num * ext->pnum)
|
||||
* act_col_x = col_w * i * ext->dl_num * 2 + 2 * dl_cnt
|
||||
* Reorder the operation to multiply first*/
|
||||
/*Go through all points*/
|
||||
for(i = 0; i < ext->pnum; i ++) {
|
||||
x_act = (int32_t)((int32_t) w * i) / ext->pnum;
|
||||
x_act += chart->cords.x1 + x_ofs;
|
||||
|
||||
col_a.x1 = (int32_t)((int32_t) w * ((i * ext->dl_num * 2) + (2 * dl_cnt))) /
|
||||
(ext->pnum * 2 * ext->dl_num);
|
||||
col_a.x1 += chart->cords.x1;
|
||||
col_a.x2 = col_a.x1 + col_w;
|
||||
col_a.x1 += x_ofs;
|
||||
col_a.x2 += x_ofs;
|
||||
/*Draw the current point of all data line*/
|
||||
LL_READ_BACK(ext->dl_ll, dl) {
|
||||
rects.mcolor = dl->color;
|
||||
rects.gcolor = color_mix(COLOR_BLACK, dl->color, ext->dl_dark);
|
||||
col_a.x1 = x_act;
|
||||
col_a.x2 = col_a.x1 + col_w;
|
||||
x_act += col_w;
|
||||
|
||||
y_tmp = (int32_t)((int32_t) dl->points[i] - ext->ymin) * h;
|
||||
y_tmp = y_tmp / (ext->ymax - ext->ymin);
|
||||
col_a.y1 = h - y_tmp + chart->cords.y1;
|
||||
|
||||
y_tmp = (int32_t)((int32_t) (*y_data)[i] - ext->ymin) * h;
|
||||
y_tmp = y_tmp / (ext->ymax - ext->ymin);
|
||||
col_a.y1 = h - y_tmp + chart->cords.y1;
|
||||
|
||||
mask_ret = area_union(&col_mask, mask, &col_a);
|
||||
if(mask_ret != false) {
|
||||
lv_draw_rect(&chart->cords, &col_mask, &rects, opa);
|
||||
}
|
||||
}
|
||||
dl_cnt++;
|
||||
mask_ret = area_union(&col_mask, mask, &col_a);
|
||||
if(mask_ret != false) {
|
||||
lv_draw_rect(&chart->cords, &col_mask, &rects);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the chart styles
|
||||
*/
|
||||
static void lv_charts_init(void)
|
||||
{
|
||||
/*Default style*/
|
||||
/* Background */
|
||||
lv_rects_get(LV_RECTS_DEF, &lv_charts_def.bg_rects);
|
||||
lv_charts_def.bg_rects.objs.color = COLOR_MAKE(0x60, 0x80, 0xA0);
|
||||
lv_charts_def.bg_rects.gcolor = COLOR_WHITE;
|
||||
lv_charts_def.bg_rects.bcolor = COLOR_BLACK;
|
||||
|
||||
/* Div. line */
|
||||
lv_lines_get(LV_LINES_DECOR, &lv_charts_def.div_lines);
|
||||
lv_charts_def.div_lines.width = 1 * LV_DOWNSCALE;
|
||||
lv_charts_def.div_lines.objs.color = COLOR_BLACK;
|
||||
lv_charts_def.div_line_opa = OPA_COVER;
|
||||
|
||||
/*Data lines*/
|
||||
lv_charts_def.width = 2 * LV_DOWNSCALE;
|
||||
lv_charts_def.data_opa = 100;
|
||||
lv_charts_def.dark_eff = 150;
|
||||
lv_charts_def.color[0] = COLOR_RED;
|
||||
lv_charts_def.color[1] = COLOR_GREEN;
|
||||
lv_charts_def.color[2] = COLOR_BLUE;
|
||||
lv_charts_def.color[3] = COLOR_MAGENTA;
|
||||
lv_charts_def.color[4] = COLOR_CYAN;
|
||||
lv_charts_def.color[5] = COLOR_YELLOW;
|
||||
lv_charts_def.color[6] = COLOR_WHITE;
|
||||
lv_charts_def.color[7] = COLOR_GRAY;
|
||||
|
||||
|
||||
memcpy(&lv_charts_transp, &lv_charts_def, sizeof(lv_charts_t));
|
||||
lv_charts_transp.bg_rects.empty = 1;
|
||||
lv_charts_transp.bg_rects.bwidth = 0;
|
||||
lv_charts_transp.div_lines.objs.transp = 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_CHARTBG_H
|
||||
#define LV_CHARTBG_H
|
||||
#ifndef LV_CHART_H
|
||||
#define LV_CHART_H
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
@@ -12,69 +12,49 @@
|
||||
#include "lv_conf.h"
|
||||
#if USE_LV_CHART != 0
|
||||
|
||||
/*Testing of dependencies*/
|
||||
#if USE_LV_RECT == 0
|
||||
#error "lv_chart: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) "
|
||||
#endif
|
||||
|
||||
#if USE_LV_LINE == 0
|
||||
#error "lv_chart: lv_line is required. Enable it in lv_conf.h (USE_LV_LINE 1) "
|
||||
#endif
|
||||
|
||||
#include "../lv_obj/lv_obj.h"
|
||||
#include "lv_rect.h"
|
||||
#include "lv_line.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_CHART_DL_NUM 8 /*Max data line number. Used in the style.*/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
/*Data of chart background*/
|
||||
typedef struct
|
||||
{
|
||||
lv_rect_ext_t bg_rects; /*Ext. of ancestor*/
|
||||
cord_t * points;
|
||||
color_t color;
|
||||
}lv_chart_dl_t;
|
||||
|
||||
/*Data of chart */
|
||||
typedef struct
|
||||
{
|
||||
/*No inherited ext*/ /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
cord_t ymin;
|
||||
cord_t ymax;
|
||||
ll_dsc_t dl_ll; /*Linked list for the data line pointers (stores lv_chart_dl_t)*/
|
||||
cord_t ymin; /*y min value (used to scale the data)*/
|
||||
cord_t ymax; /*y max value (used to scale the data)*/
|
||||
uint8_t hdiv_num; /*Number of horizontal division lines*/
|
||||
uint8_t vdiv_num; /*Number of vertical division lines*/
|
||||
ll_dsc_t dl_ll; /*Linked list for the data line pointers (stores cord_t * )*/
|
||||
uint16_t pnum; /*Point number in a data line*/
|
||||
uint8_t type :2; /*Line, column or point chart (from 'lv_chart_type_t')*/
|
||||
uint8_t dl_num; /*Data line number in dl_ll*/
|
||||
cord_t dl_width; /*Line width or point radius*/
|
||||
uint8_t dl_num; /*Number of data lines in dl_ll*/
|
||||
opa_t dl_opa; /*Opacity of data lines*/
|
||||
opa_t dl_dark; /*Dark level of the point/column bottoms*/
|
||||
uint8_t type :3; /*Line, column or point chart (from 'lv_chart_type_t')*/
|
||||
}lv_chart_ext_t;
|
||||
|
||||
/*Chart types*/
|
||||
typedef enum
|
||||
{
|
||||
LV_CHART_LINE,
|
||||
LV_CHART_COL,
|
||||
LV_CHART_POINT,
|
||||
LV_CHART_NONE = 0,
|
||||
LV_CHART_LINE = 0x01,
|
||||
LV_CHART_COL = 0x02,
|
||||
LV_CHART_POINT = 0x04,
|
||||
}lv_chart_type_t;
|
||||
|
||||
/*Style of chart background*/
|
||||
typedef struct
|
||||
{
|
||||
lv_rects_t bg_rects; /*Style of ancestor*/
|
||||
/*New style element for this type */
|
||||
lv_lines_t div_lines;
|
||||
uint8_t div_line_opa; /*Percentage of obj. opacity*/
|
||||
color_t color[LV_CHART_DL_NUM]; /*Line/Point/Col color */
|
||||
uint16_t width; /*Line width or point radius*/
|
||||
opa_t data_opa; /*Line/Point/Col opacity in the percentage of obj. opacity*/
|
||||
uint8_t dark_eff; /*Dark effect on the bottom of ó points and columns*/
|
||||
}lv_charts_t;
|
||||
|
||||
/*Built-in styles of chart background*/
|
||||
typedef enum
|
||||
{
|
||||
LV_CHARTS_DEF,
|
||||
LV_CHARTS_TRANSP,
|
||||
}lv_charts_builtin_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
@@ -99,9 +79,10 @@ bool lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param);
|
||||
/**
|
||||
* Allocate and add a data line to the chart
|
||||
* @param chart pointer to a chart object
|
||||
* @return pointer to the allocated data lie (an array for the data points)
|
||||
* @param color color of the data line
|
||||
* @return pointer to the allocated data line (
|
||||
*/
|
||||
cord_t * lv_chart_add_dataline(lv_obj_t * chart);
|
||||
lv_chart_dl_t * lv_chart_add_data_line(lv_obj_t * chart, color_t color);
|
||||
|
||||
/**
|
||||
* Refresh a chart if its data line has changed
|
||||
@@ -141,13 +122,34 @@ void lv_chart_set_type(lv_obj_t * chart, lv_chart_type_t type);
|
||||
*/
|
||||
void lv_chart_set_pnum(lv_obj_t * chart, uint16_t pnum);
|
||||
|
||||
/**
|
||||
* Set the opacity of the data lines
|
||||
* @param chart pointer to chart object
|
||||
* @param opa opacity of the data lines
|
||||
*/
|
||||
void lv_chart_set_dl_opa(lv_obj_t * chart, opa_t opa);
|
||||
|
||||
/**
|
||||
* Set the line width or point radius of the data lines
|
||||
* @param chart pointer to chart object
|
||||
* @param width the new width
|
||||
*/
|
||||
void lv_chart_set_dl_width(lv_obj_t * chart, cord_t width);
|
||||
|
||||
/**
|
||||
* Set the dark effect on the bottom of the points or columns
|
||||
* @param chart pointer to chart object
|
||||
* @param dark_eff dark effect level (OPA_TRANSP to turn off)
|
||||
*/
|
||||
void lv_chart_set_dl_dark(lv_obj_t * chart, opa_t dark_eff);
|
||||
|
||||
/**
|
||||
* Shift all data right and set the most right data on a data line
|
||||
* @param chart pointer to chart object
|
||||
* @param dl pointer to a data line on 'chart'
|
||||
* @param y the new value of the most right data
|
||||
*/
|
||||
void lv_chart_set_next(lv_obj_t * chart, cord_t * dl, cord_t y);
|
||||
void lv_chart_set_next(lv_obj_t * chart, lv_chart_dl_t * dl, cord_t y);
|
||||
|
||||
/**
|
||||
* Get the type of a chart
|
||||
@@ -164,12 +166,25 @@ lv_chart_type_t lv_chart_get_type(lv_obj_t * chart);
|
||||
uint16_t lv_chart_get_pnum(lv_obj_t * chart);
|
||||
|
||||
/**
|
||||
* Return with a pointer to a built-in style and/or copy it to a variable
|
||||
* @param style a style name from lv_charts_builtin_t enum
|
||||
* @param copy copy the style to this variable. (NULL if unused)
|
||||
* @return pointer to an lv_charts_t style
|
||||
* Get the opacity of the data lines
|
||||
* @param chart pointer to chart object
|
||||
* @return the opacity of the data lines
|
||||
*/
|
||||
lv_charts_t * lv_charts_get(lv_charts_builtin_t style, lv_charts_t * copy);
|
||||
opa_t lv_chart_get_dl_opa(lv_obj_t * chart);
|
||||
|
||||
/**
|
||||
* Get the data line width
|
||||
* @param chart pointer to chart object
|
||||
* @return the width the data lines (lines or points)
|
||||
*/
|
||||
cord_t lv_chart_get_dl_width(lv_obj_t * chart);
|
||||
|
||||
/**
|
||||
* Get the dark effect level on the bottom of the points or columns
|
||||
* @param chart pointer to chart object
|
||||
* @return dark effect level (OPA_TRANSP to turn off)
|
||||
*/
|
||||
opa_t lv_chart_get_dl_dark(lv_obj_t * chart, opa_t dark_eff);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
613
lv_objx/lv_cont.c
Normal file
613
lv_objx/lv_cont.c
Normal file
@@ -0,0 +1,613 @@
|
||||
/**
|
||||
* @file lv_rect.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_conf.h"
|
||||
|
||||
#if USE_LV_CONT != 0
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "lv_cont.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_draw/lv_draw_vbasic.h"
|
||||
#include "misc/gfx/area.h"
|
||||
|
||||
#include "misc/gfx/color.h"
|
||||
#include "misc/math/math_base.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
#if 0
|
||||
static bool lv_cont_design(lv_obj_t * cont, const area_t * mask, lv_design_mode_t mode);
|
||||
#endif
|
||||
|
||||
static void lv_cont_refr_layout(lv_obj_t * cont);
|
||||
static void lv_cont_layout_col(lv_obj_t * cont);
|
||||
static void lv_cont_layout_row(lv_obj_t * cont);
|
||||
static void lv_cont_layout_center(lv_obj_t * cont);
|
||||
static void lv_cont_layout_pretty(lv_obj_t * cont);
|
||||
static void lv_cont_layout_grid(lv_obj_t * cont);
|
||||
static void lv_cont_refr_autofit(lv_obj_t * cont);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/*-----------------
|
||||
* Create function
|
||||
*-----------------*/
|
||||
|
||||
/**
|
||||
* Create a container objects
|
||||
* @param par pointer to an object, it will be the parent of the new container
|
||||
* @param copy pointer to a container object, if not NULL then the new object will be copied from it
|
||||
* @return pointer to the created container
|
||||
*/
|
||||
lv_obj_t * lv_cont_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
{
|
||||
/*Create a basic object*/
|
||||
lv_obj_t * new_rect = lv_obj_create(par, copy);
|
||||
dm_assert(new_rect);
|
||||
lv_obj_alloc_ext(new_rect, sizeof(lv_cont_ext_t));
|
||||
lv_cont_ext_t * ext = lv_obj_get_ext(new_rect);
|
||||
dm_assert(ext);
|
||||
ext->hfit_en = 0;
|
||||
ext->vfit_en = 0;
|
||||
ext->layout = LV_CONT_LAYOUT_OFF;
|
||||
|
||||
lv_obj_set_signal_f(new_rect, lv_cont_signal);
|
||||
|
||||
/*Init the new container*/
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_style(new_rect, lv_style_get(LV_STYLE_PLAIN, NULL));
|
||||
}
|
||||
/*Copy an existing object*/
|
||||
else {
|
||||
lv_cont_ext_t * copy_ext = lv_obj_get_ext(copy);
|
||||
ext->hfit_en = copy_ext->hfit_en;
|
||||
ext->vfit_en = copy_ext->vfit_en;
|
||||
ext->layout = copy_ext->layout;
|
||||
|
||||
/*Refresh the style with new signal function*/
|
||||
lv_obj_refr_style(new_rect);
|
||||
|
||||
}
|
||||
|
||||
return new_rect;
|
||||
}
|
||||
|
||||
/**
|
||||
* Signal function of the container
|
||||
* @param cont pointer to a container object
|
||||
* @param sign a signal type from lv_signal_t enum
|
||||
* @param param pointer to a signal specific variable
|
||||
*/
|
||||
bool lv_cont_signal(lv_obj_t * cont, lv_signal_t sign, void * param)
|
||||
{
|
||||
bool valid;
|
||||
|
||||
/* Include the ancient signal function */
|
||||
valid = lv_obj_signal(cont, sign, param);
|
||||
|
||||
/* The object can be deleted so check its validity and then
|
||||
* make the object specific signal handling */
|
||||
if(valid != false) {
|
||||
switch(sign) {
|
||||
case LV_SIGNAL_STYLE_CHG: /*Recalculate the padding if the style changed*/
|
||||
lv_cont_refr_layout(cont);
|
||||
lv_cont_refr_autofit(cont);
|
||||
break;
|
||||
case LV_SIGNAL_CHILD_CHG:
|
||||
lv_cont_refr_layout(cont);
|
||||
lv_cont_refr_autofit(cont);
|
||||
break;
|
||||
case LV_SIGNAL_CORD_CHG:
|
||||
if(lv_obj_get_width(cont) != area_get_width(param) ||
|
||||
lv_obj_get_height(cont) != area_get_height(param)) {
|
||||
lv_cont_refr_layout(cont);
|
||||
lv_cont_refr_autofit(cont);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Setter functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Set the layout on a container
|
||||
* @param cont pointer to a container object
|
||||
* @param layout a layout from 'lv_cont_layout_t'
|
||||
*/
|
||||
void lv_cont_set_layout(lv_obj_t * cont, lv_cont_layout_t layout)
|
||||
{
|
||||
lv_cont_ext_t * ext = lv_obj_get_ext(cont);
|
||||
ext->layout = layout;
|
||||
|
||||
/*Send a signal to refresh the layout*/
|
||||
cont->signal_f(cont, LV_SIGNAL_CHILD_CHG, NULL);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enable the horizontal or vertical fit.
|
||||
* The container size will be set to involve the children horizontally or vertically.
|
||||
* @param cont pointer to a container object
|
||||
* @param hor_en true: enable the horizontal padding
|
||||
* @param ver_en true: enable the vertical padding
|
||||
*/
|
||||
void lv_cont_set_fit(lv_obj_t * cont, bool hor_en, bool ver_en)
|
||||
{
|
||||
lv_obj_inv(cont);
|
||||
lv_cont_ext_t * ext = lv_obj_get_ext(cont);
|
||||
ext->hfit_en = hor_en == false ? 0 : 1;
|
||||
ext->vfit_en = ver_en == false ? 0 : 1;
|
||||
|
||||
/*Send a signal to set a new size*/
|
||||
cont->signal_f(cont, LV_SIGNAL_CORD_CHG, cont);
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Get the layout of a container
|
||||
* @param cont pointer to container object
|
||||
* @return the layout from 'lv_cont_layout_t'
|
||||
*/
|
||||
lv_cont_layout_t lv_cont_get_layout(lv_obj_t * cont)
|
||||
{
|
||||
lv_cont_ext_t * ext = lv_obj_get_ext(cont);
|
||||
return ext->layout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get horizontal fit enable attribute of a container
|
||||
* @param cont pointer to a container object
|
||||
* @return true: horizontal padding is enabled
|
||||
*/
|
||||
bool lv_cont_get_hfit(lv_obj_t * cont)
|
||||
{
|
||||
lv_cont_ext_t * ext = lv_obj_get_ext(cont);
|
||||
return ext->hfit_en == 0 ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get vertical fit enable attribute of a container
|
||||
* @param cont pointer to a container object
|
||||
* @return true: vertical padding is enabled
|
||||
*/
|
||||
bool lv_cont_get_vfit(lv_obj_t * cont)
|
||||
{
|
||||
lv_cont_ext_t * ext = lv_obj_get_ext(cont);
|
||||
return ext->vfit_en == 0 ? false : true;
|
||||
}
|
||||
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
#if 0
|
||||
/**
|
||||
* Handle the drawing related tasks of the containers
|
||||
* @param cont pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
*/
|
||||
static bool lv_cont_design(lv_obj_t * cont, const area_t * mask, lv_design_mode_t mode)
|
||||
{
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
|
||||
return false;
|
||||
} else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
|
||||
|
||||
} else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Refresh the layout of a container
|
||||
* @param cont pointer to an object which layout should be refreshed
|
||||
*/
|
||||
static void lv_cont_refr_layout(lv_obj_t * cont)
|
||||
{
|
||||
lv_cont_layout_t type = lv_cont_get_layout(cont);
|
||||
|
||||
/*'rect' has to be at least 1 child*/
|
||||
if(lv_obj_get_child(cont, NULL) == NULL) return;
|
||||
|
||||
if(type == LV_CONT_LAYOUT_OFF) return;
|
||||
|
||||
if(type == LV_CONT_LAYOUT_CENTER) {
|
||||
lv_cont_layout_center(cont);
|
||||
} else if(type == LV_CONT_LAYOUT_COL_L || type == LV_CONT_LAYOUT_COL_M || type == LV_CONT_LAYOUT_COL_R) {
|
||||
lv_cont_layout_col(cont);
|
||||
} else if(type == LV_CONT_LAYOUT_ROW_T || type == LV_CONT_LAYOUT_ROW_M || type == LV_CONT_LAYOUT_ROW_B) {
|
||||
lv_cont_layout_row(cont);
|
||||
} else if(type == LV_CONT_LAYOUT_PRETTY) {
|
||||
lv_cont_layout_pretty(cont);
|
||||
} else if(type == LV_CONT_LAYOUT_GRID) {
|
||||
lv_cont_layout_grid(cont);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle column type layouts
|
||||
* @param cont pointer to an object which layout should be handled
|
||||
*/
|
||||
static void lv_cont_layout_col(lv_obj_t * cont)
|
||||
{
|
||||
lv_cont_layout_t type = lv_cont_get_layout(cont);
|
||||
lv_obj_t * child;
|
||||
|
||||
/*Adjust margin and get the alignment type*/
|
||||
lv_align_t align;
|
||||
lv_style_t * style = lv_obj_get_style(cont);
|
||||
cord_t hpad_corr;
|
||||
|
||||
switch(type) {
|
||||
case LV_CONT_LAYOUT_COL_L:
|
||||
hpad_corr = style->hpad;
|
||||
align = LV_ALIGN_IN_TOP_LEFT;
|
||||
break;
|
||||
case LV_CONT_LAYOUT_COL_M:
|
||||
hpad_corr = 0;
|
||||
align = LV_ALIGN_IN_TOP_MID;
|
||||
break;
|
||||
case LV_CONT_LAYOUT_COL_R:
|
||||
hpad_corr = -style->hpad;
|
||||
align = LV_ALIGN_IN_TOP_RIGHT;
|
||||
break;
|
||||
default:
|
||||
hpad_corr = 0;
|
||||
align = LV_ALIGN_IN_TOP_LEFT;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Disable child change action because the children will be moved a lot
|
||||
* an unnecessary child change signals could be sent*/
|
||||
lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG);
|
||||
/* Align the children */
|
||||
cord_t last_cord = style->vpad;
|
||||
LL_READ_BACK(cont->child_ll, child) {
|
||||
if(lv_obj_get_hidden(child) != false ||
|
||||
lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue;
|
||||
|
||||
lv_obj_align(child, cont, align, hpad_corr , last_cord);
|
||||
last_cord += lv_obj_get_height(child) + style->opad;
|
||||
}
|
||||
|
||||
lv_obj_clr_protect(cont, LV_PROTECT_CHILD_CHG);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle row type layouts
|
||||
* @param cont pointer to an object which layout should be handled
|
||||
*/
|
||||
static void lv_cont_layout_row(lv_obj_t * cont)
|
||||
{
|
||||
lv_cont_layout_t type = lv_cont_get_layout(cont);
|
||||
lv_obj_t * child;
|
||||
|
||||
/*Adjust margin and get the alignment type*/
|
||||
lv_align_t align;
|
||||
lv_style_t * style = lv_obj_get_style(cont);
|
||||
cord_t vpad_corr = style->vpad;
|
||||
|
||||
switch(type) {
|
||||
case LV_CONT_LAYOUT_ROW_T:
|
||||
vpad_corr = style->vpad;
|
||||
align = LV_ALIGN_IN_TOP_LEFT;
|
||||
break;
|
||||
case LV_CONT_LAYOUT_ROW_M:
|
||||
vpad_corr = 0;
|
||||
align = LV_ALIGN_IN_LEFT_MID;
|
||||
break;
|
||||
case LV_CONT_LAYOUT_ROW_B:
|
||||
vpad_corr = -style->vpad;
|
||||
align = LV_ALIGN_IN_BOTTOM_LEFT;
|
||||
break;
|
||||
default:
|
||||
vpad_corr = 0;
|
||||
align = LV_ALIGN_IN_TOP_LEFT;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Disable child change action because the children will be moved a lot
|
||||
* an unnecessary child change signals could be sent*/
|
||||
lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG);
|
||||
|
||||
/* Align the children */
|
||||
cord_t last_cord = style->hpad;
|
||||
LL_READ_BACK(cont->child_ll, child) {
|
||||
if(lv_obj_get_hidden(child) != false ||
|
||||
lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue;
|
||||
|
||||
lv_obj_align(child, cont, align, last_cord, vpad_corr);
|
||||
last_cord += lv_obj_get_width(child) + style->opad;
|
||||
}
|
||||
|
||||
lv_obj_clr_protect(cont, LV_PROTECT_CHILD_CHG);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the center layout
|
||||
* @param cont pointer to an object which layout should be handled
|
||||
*/
|
||||
static void lv_cont_layout_center(lv_obj_t * cont)
|
||||
{
|
||||
lv_obj_t * child;
|
||||
lv_style_t * style = lv_obj_get_style(cont);
|
||||
uint32_t obj_num = 0;
|
||||
cord_t h_tot = 0;
|
||||
|
||||
LL_READ(cont->child_ll, child) {
|
||||
h_tot += lv_obj_get_height(child) + style->opad;
|
||||
obj_num ++;
|
||||
}
|
||||
|
||||
if(obj_num == 0) return;
|
||||
|
||||
h_tot -= style->opad;
|
||||
|
||||
/* Disable child change action because the children will be moved a lot
|
||||
* an unnecessary child change signals could be sent*/
|
||||
lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG);
|
||||
|
||||
/* Align the children */
|
||||
cord_t last_cord = - (h_tot / 2);
|
||||
LL_READ_BACK(cont->child_ll, child) {
|
||||
if(lv_obj_get_hidden(child) != false ||
|
||||
lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue;
|
||||
|
||||
lv_obj_align(child, cont, LV_ALIGN_CENTER, 0, last_cord + lv_obj_get_height(child) / 2);
|
||||
last_cord += lv_obj_get_height(child) + style->opad;
|
||||
}
|
||||
|
||||
lv_obj_clr_protect(cont, LV_PROTECT_CHILD_CHG);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the pretty layout. Put as many object as possible in row
|
||||
* then begin a new row
|
||||
* @param cont pointer to an object which layout should be handled
|
||||
*/
|
||||
static void lv_cont_layout_pretty(lv_obj_t * cont)
|
||||
{
|
||||
lv_obj_t * child_rs; /* Row starter child */
|
||||
lv_obj_t * child_rc; /* Row closer child */
|
||||
lv_obj_t * child_tmp; /* Temporary child */
|
||||
lv_style_t * style = lv_obj_get_style(cont);
|
||||
cord_t w_obj = lv_obj_get_width(cont);
|
||||
cord_t act_y = style->vpad;
|
||||
/* Disable child change action because the children will be moved a lot
|
||||
* an unnecessary child change signals could be sent*/
|
||||
|
||||
child_rs = ll_get_tail(&cont->child_ll); /*Set the row starter child*/
|
||||
if(child_rs == NULL) return; /*Return if no child*/
|
||||
|
||||
lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG);
|
||||
|
||||
child_rc = child_rs; /*Initially the the row starter and closer is the same*/
|
||||
while(child_rs != NULL) {
|
||||
cord_t h_row = 0;
|
||||
cord_t w_row = style->hpad * 2; /*The width is at least the left+right hpad*/
|
||||
uint32_t obj_num = 0;
|
||||
|
||||
/*Find the row closer object and collect some data*/
|
||||
do {
|
||||
if(lv_obj_get_hidden(child_rc) == false &&
|
||||
lv_obj_is_protected(child_rc, LV_PROTECT_POS) == false) {
|
||||
if(w_row + lv_obj_get_width(child_rc) > w_obj) break; /*If the next object is already not fit then break*/
|
||||
w_row += lv_obj_get_width(child_rc) + style->opad; /*Add the object width + opad*/
|
||||
h_row = MATH_MAX(h_row, lv_obj_get_height(child_rc)); /*Search the highest object*/
|
||||
obj_num ++;
|
||||
}
|
||||
child_rc = ll_get_prev(&cont->child_ll, child_rc); /*Load the next object*/
|
||||
if(obj_num == 0) child_rs = child_rc; /*If the first object was hidden (or too long) then set the next as first */
|
||||
}while(child_rc != NULL);
|
||||
|
||||
/*Step back one child because the last already not fit*/
|
||||
if(child_rc != NULL && obj_num != 0) child_rc = ll_get_next(&cont->child_ll, child_rc);
|
||||
|
||||
/*If the object is too long then align it to the middle*/
|
||||
if(obj_num == 0) {
|
||||
if(child_rc != NULL) {
|
||||
lv_obj_align(child_rc, cont, LV_ALIGN_IN_TOP_MID, 0, act_y);
|
||||
}
|
||||
}
|
||||
/*If here is only one object in the row then align it to the left*/
|
||||
else if (obj_num == 1) {
|
||||
lv_obj_align(child_rs, cont, LV_ALIGN_IN_TOP_MID, 0, act_y);
|
||||
}
|
||||
/* Align the children (from child_rs to child_rc)*/
|
||||
else {
|
||||
w_row -= style->opad * obj_num;
|
||||
cord_t new_opad = (w_obj - w_row) / (obj_num - 1);
|
||||
cord_t act_x = style->hpad; /*x init*/
|
||||
child_tmp = child_rs;
|
||||
while(child_tmp != NULL) {
|
||||
if(lv_obj_get_hidden(child_tmp) == false &&
|
||||
lv_obj_is_protected(child_tmp, LV_PROTECT_POS) == false) {
|
||||
lv_obj_align(child_tmp, cont, LV_ALIGN_IN_TOP_LEFT, act_x, act_y);
|
||||
act_x += lv_obj_get_width(child_tmp) + new_opad;
|
||||
}
|
||||
if(child_tmp == child_rc) break;
|
||||
child_tmp = ll_get_prev(&cont->child_ll, child_tmp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(child_rc == NULL) break;
|
||||
act_y += style->opad + h_row; /*y increment*/
|
||||
child_rs = ll_get_prev(&cont->child_ll, child_rc); /*Go to the next object*/
|
||||
child_rc = child_rs;
|
||||
}
|
||||
lv_obj_clr_protect(cont, LV_PROTECT_CHILD_CHG);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the grid layout. Align same-sized objects in a grid
|
||||
* @param cont pointer to an object which layout should be handled
|
||||
*/
|
||||
static void lv_cont_layout_grid(lv_obj_t * cont)
|
||||
{
|
||||
lv_obj_t * child;
|
||||
lv_style_t * style = lv_obj_get_style(cont);
|
||||
cord_t w_tot = lv_obj_get_width(cont);
|
||||
cord_t w_obj = lv_obj_get_width(lv_obj_get_child(cont, NULL));
|
||||
cord_t h_obj = lv_obj_get_height(lv_obj_get_child(cont, NULL));
|
||||
uint16_t obj_row = (w_tot - (2 * style->hpad)) / (w_obj + style->opad); /*Obj. num. in a row*/
|
||||
cord_t x_ofs;
|
||||
if(obj_row > 1) {
|
||||
x_ofs = w_obj + (w_tot - (2 * style->hpad) - (obj_row * w_obj)) / (obj_row - 1);
|
||||
} else {
|
||||
x_ofs = w_tot / 2 - w_obj / 2;
|
||||
}
|
||||
cord_t y_ofs = h_obj + style->opad;
|
||||
|
||||
/* Disable child change action because the children will be moved a lot
|
||||
* an unnecessary child change signals could be sent*/
|
||||
lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG);
|
||||
|
||||
/* Align the children */
|
||||
cord_t act_x = style->hpad;
|
||||
cord_t act_y = style->vpad;
|
||||
uint16_t obj_cnt = 0;
|
||||
LL_READ_BACK(cont->child_ll, child) {
|
||||
if(lv_obj_get_hidden(child) != false ||
|
||||
lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue;
|
||||
|
||||
if(obj_row > 1) {
|
||||
lv_obj_set_pos(child, act_x, act_y);
|
||||
act_x += x_ofs;
|
||||
} else {
|
||||
lv_obj_set_pos(child, x_ofs, act_y);
|
||||
}
|
||||
obj_cnt ++;
|
||||
|
||||
if(obj_cnt >= obj_row) {
|
||||
obj_cnt = 0;
|
||||
act_x = style->hpad;
|
||||
act_y += y_ofs;
|
||||
}
|
||||
}
|
||||
|
||||
lv_obj_clr_protect(cont, LV_PROTECT_CHILD_CHG);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle auto fit. Set the size of the object to involve all children.
|
||||
* @param cont pointer to an object which size will be modified
|
||||
*/
|
||||
static void lv_cont_refr_autofit(lv_obj_t * cont)
|
||||
{
|
||||
lv_cont_ext_t * ext = lv_obj_get_ext(cont);
|
||||
|
||||
if(ext->hfit_en == 0 &&
|
||||
ext->vfit_en == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
area_t new_cords;
|
||||
area_t ori;
|
||||
lv_style_t * style = lv_obj_get_style(cont);
|
||||
lv_obj_t * i;
|
||||
cord_t hpad = style->hpad;
|
||||
cord_t vpad = style->vpad;
|
||||
|
||||
/*Search the side coordinates of the children*/
|
||||
lv_obj_get_cords(cont, &ori);
|
||||
lv_obj_get_cords(cont, &new_cords);
|
||||
|
||||
new_cords.x1 = CORD_MAX;
|
||||
new_cords.y1 = CORD_MAX;
|
||||
new_cords.x2 = CORD_MIN;
|
||||
new_cords.y2 = CORD_MIN;
|
||||
|
||||
LL_READ(cont->child_ll, i) {
|
||||
if(lv_obj_get_hidden(i) != false) continue;
|
||||
new_cords.x1 = MATH_MIN(new_cords.x1, i->cords.x1);
|
||||
new_cords.y1 = MATH_MIN(new_cords.y1, i->cords.y1);
|
||||
new_cords.x2 = MATH_MAX(new_cords.x2, i->cords.x2);
|
||||
new_cords.y2 = MATH_MAX(new_cords.y2, i->cords.y2);
|
||||
}
|
||||
|
||||
/*If the value is not the init value then the page has >=1 child.*/
|
||||
if(new_cords.x1 != CORD_MAX) {
|
||||
if(ext->hfit_en != 0) {
|
||||
new_cords.x1 -= hpad;
|
||||
new_cords.x2 += hpad;
|
||||
} else {
|
||||
new_cords.x1 = cont->cords.x1;
|
||||
new_cords.x2 = cont->cords.x2;
|
||||
}
|
||||
if(ext->vfit_en != 0) {
|
||||
new_cords.y1 -= vpad;
|
||||
new_cords.y2 += vpad;
|
||||
} else {
|
||||
new_cords.y1 = cont->cords.y1;
|
||||
new_cords.y2 = cont->cords.y2;
|
||||
}
|
||||
|
||||
/*Do nothing if the coordinates are not changed*/
|
||||
if(cont->cords.x1 != new_cords.x1 ||
|
||||
cont->cords.y1 != new_cords.y1 ||
|
||||
cont->cords.x2 != new_cords.x2 ||
|
||||
cont->cords.y2 != new_cords.y2) {
|
||||
|
||||
lv_obj_inv(cont);
|
||||
area_cpy(&cont->cords, &new_cords);
|
||||
lv_obj_inv(cont);
|
||||
|
||||
/*Notify the object about its new coordinates*/
|
||||
cont->signal_f(cont, LV_SIGNAL_CORD_CHG, &ori);
|
||||
|
||||
/*Inform the parent about the new coordinates*/
|
||||
lv_obj_t * par = lv_obj_get_parent(cont);
|
||||
par->signal_f(par, LV_SIGNAL_CHILD_CHG, cont);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
112
lv_objx/lv_cont.h
Normal file
112
lv_objx/lv_cont.h
Normal file
@@ -0,0 +1,112 @@
|
||||
/**
|
||||
* @file lv_cont.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_CONT_H
|
||||
#define LV_CONT_H
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_conf.h"
|
||||
#if USE_LV_CONT != 0
|
||||
|
||||
#include "../lv_obj/lv_obj.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/*Layout options*/
|
||||
typedef enum
|
||||
{
|
||||
LV_CONT_LAYOUT_OFF = 0,
|
||||
LV_CONT_LAYOUT_CENTER,
|
||||
LV_CONT_LAYOUT_COL_L, /*Column left align*/
|
||||
LV_CONT_LAYOUT_COL_M, /*Column middle align*/
|
||||
LV_CONT_LAYOUT_COL_R, /*Column right align*/
|
||||
LV_CONT_LAYOUT_ROW_T, /*Row top align*/
|
||||
LV_CONT_LAYOUT_ROW_M, /*Row middle align*/
|
||||
LV_CONT_LAYOUT_ROW_B, /*Row bottom align*/
|
||||
LV_CONT_LAYOUT_PRETTY, /*Put as many object as possible in row and begin a new row*/
|
||||
LV_CONT_LAYOUT_GRID, /*Align same-sized object into a grid*/
|
||||
}lv_cont_layout_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/*Inherited from 'base_obj' so no inherited ext. */ /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
uint8_t layout :5; /*A layout from 'lv_cont_layout_t' enum*/
|
||||
uint8_t hfit_en :1; /*Enable horizontal padding to involve all children*/
|
||||
uint8_t vfit_en :1; /*Enable horizontal padding to involve all children*/
|
||||
}lv_cont_ext_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Create a container objects
|
||||
* @param par pointer to an object, it will be the parent of the new container
|
||||
* @param copy pointer to a container object, if not NULL then the new object will be copied from it
|
||||
* @return pointer to the created container
|
||||
*/
|
||||
lv_obj_t * lv_cont_create(lv_obj_t * par, lv_obj_t * copy);
|
||||
|
||||
/**
|
||||
* Signal function of the container
|
||||
* @param cont pointer to a container object
|
||||
* @param sign a signal type from lv_signal_t enum
|
||||
* @param param pointer to a signal specific variable
|
||||
*/
|
||||
bool lv_cont_signal(lv_obj_t * cont, lv_signal_t sign, void * param);
|
||||
|
||||
/**
|
||||
* Set the layout on a container
|
||||
* @param cont pointer to a container object
|
||||
* @param layout a layout from 'lv_cont_layout_t'
|
||||
*/
|
||||
void lv_cont_set_layout(lv_obj_t * cont, lv_cont_layout_t layout);
|
||||
|
||||
/**
|
||||
* Enable the horizontal or vertical fit.
|
||||
* The container size will be set to involve the children horizontally or vertically.
|
||||
* @param cont pointer to a container object
|
||||
* @param hor_en true: enable the horizontal padding
|
||||
* @param ver_en true: enable the vertical padding
|
||||
*/
|
||||
void lv_cont_set_fit(lv_obj_t * cont, bool hor_en, bool ver_en);
|
||||
|
||||
/**
|
||||
* Get the layout of a container
|
||||
* @param cont pointer to container object
|
||||
* @return the layout from 'lv_cont_layout_t'
|
||||
*/
|
||||
lv_cont_layout_t lv_cont_get_layout(lv_obj_t * cont);
|
||||
|
||||
/**
|
||||
* Get horizontal fit enable attribute of a container
|
||||
* @param cont pointer to a container object
|
||||
* @return true: horizontal padding is enabled
|
||||
*/
|
||||
bool lv_cont_get_hfit(lv_obj_t * cont);
|
||||
|
||||
/**
|
||||
* Get vertical fit enable attribute of a container
|
||||
* @param cont pointer to a container object
|
||||
* @return true: vertical padding is enabled
|
||||
*/
|
||||
bool lv_cont_get_vfit(lv_obj_t * cont);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
445
lv_objx/lv_ddlist.c
Normal file
445
lv_objx/lv_ddlist.c
Normal file
@@ -0,0 +1,445 @@
|
||||
/**
|
||||
* @file lv_ddlist.c
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_conf.h"
|
||||
#if USE_LV_DDLIST != 0
|
||||
|
||||
#include "lv_ddlist.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "misc/gfx/anim.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_DDLIST_DEF_ANIM_TIME 200 /*ms*/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_ddlist_design(lv_obj_t * ddlist, const area_t * mask, lv_design_mode_t mode);
|
||||
static lv_action_res_t lv_ddlist_rel_action(lv_obj_t * ddlist, lv_dispi_t * dispi);
|
||||
static void lv_ddlist_refr_size(lv_obj_t * ddlist, uint16_t anim_time);
|
||||
static void lv_ddlist_pos_act_option(lv_obj_t * ddlist);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_design_f_t ancestor_design_f;
|
||||
static const char * def_options[] = {"Option 1", "Option 2", "Option 3", ""};
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/*-----------------
|
||||
* Create function
|
||||
*-----------------*/
|
||||
|
||||
/**
|
||||
* Create a drop down list objects
|
||||
* @param par pointer to an object, it will be the parent of the new drop down list
|
||||
* @param copy pointer to a drop down list object, if not NULL then the new object will be copied from it
|
||||
* @return pointer to the created drop down list
|
||||
*/
|
||||
lv_obj_t * lv_ddlist_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
{
|
||||
/*Create the ancestor drop down list*/
|
||||
lv_obj_t * new_ddlist = lv_page_create(par, copy);
|
||||
dm_assert(new_ddlist);
|
||||
|
||||
/*Allocate the drop down list type specific extended data*/
|
||||
lv_ddlist_ext_t * ext = lv_obj_alloc_ext(new_ddlist, sizeof(lv_ddlist_ext_t));
|
||||
dm_assert(ext);
|
||||
|
||||
/*Initialize the allocated 'ext' */
|
||||
ext->opt_label = NULL;
|
||||
ext->cb = NULL;
|
||||
ext->opened = 0;
|
||||
ext->auto_size = 0;
|
||||
ext->sel_opt = 0;
|
||||
ext->anim_time = LV_DDLIST_DEF_ANIM_TIME;
|
||||
ext->style_sel = lv_style_get(LV_STYLE_PLAIN_COLOR, NULL);
|
||||
|
||||
/*The signal and design functions are not copied so set them here*/
|
||||
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_f(new_ddlist);
|
||||
|
||||
lv_obj_set_signal_f(new_ddlist, lv_ddlist_signal);
|
||||
lv_obj_set_design_f(new_ddlist, lv_ddlist_design);
|
||||
|
||||
/*Init the new drop down list drop down list*/
|
||||
if(copy == NULL) {
|
||||
lv_obj_t * scrl = lv_page_get_scrl(new_ddlist);
|
||||
lv_obj_set_drag(scrl, false);
|
||||
lv_obj_set_style(scrl, lv_style_get(LV_STYLE_TRANSP, NULL));
|
||||
|
||||
ext->opt_label = lv_label_create(new_ddlist, NULL);
|
||||
lv_cont_set_fit(new_ddlist, true, false);
|
||||
lv_page_set_rel_action(new_ddlist, lv_ddlist_rel_action);
|
||||
lv_page_set_sb_mode(new_ddlist, LV_PAGE_SB_MODE_DRAG);
|
||||
lv_obj_set_style(new_ddlist, lv_style_get(LV_STYLE_PRETTY, NULL));
|
||||
lv_ddlist_set_options(new_ddlist, def_options);
|
||||
}
|
||||
/*Copy an existing drop down list*/
|
||||
else {
|
||||
lv_ddlist_ext_t * copy_ext = lv_obj_get_ext(copy);
|
||||
ext->opt_label = lv_label_create(new_ddlist, copy_ext->opt_label);
|
||||
lv_label_set_text(ext->opt_label, lv_label_get_text(copy_ext->opt_label));
|
||||
ext->sel_opt = copy_ext->sel_opt;
|
||||
ext->auto_size = copy_ext->auto_size;
|
||||
ext->cb = copy_ext->cb;
|
||||
|
||||
/*Refresh the style with new signal function*/
|
||||
lv_obj_refr_style(new_ddlist);
|
||||
}
|
||||
|
||||
return new_ddlist;
|
||||
}
|
||||
|
||||
/**
|
||||
* Signal function of the drop down list
|
||||
* @param ddlist pointer to a drop down list object
|
||||
* @param sign a signal type from lv_signal_t enum
|
||||
* @param param pointer to a signal specific variable
|
||||
* @return true: the object is still valid (not deleted), false: the object become invalid
|
||||
*/
|
||||
bool lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * param)
|
||||
{
|
||||
bool valid;
|
||||
|
||||
/* Include the ancient signal function */
|
||||
valid = lv_page_signal(ddlist, sign, param);
|
||||
|
||||
/* The object can be deleted so check its validity and then
|
||||
* make the object specific signal handling */
|
||||
if(valid != false) {
|
||||
if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist);
|
||||
lv_obj_set_style(ext->opt_label, lv_obj_get_style(ddlist));
|
||||
lv_ddlist_refr_size(ddlist, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Setter functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Set the options in a drop down list
|
||||
* @param ddlist pointer to drop down list object
|
||||
* @param options an array of strings wit the text of the options.
|
||||
* The lest element has to be "" (empty string)
|
||||
* E.g. const char * opts[] = {"apple", "banana", "orange", ""};
|
||||
*/
|
||||
void lv_ddlist_set_options(lv_obj_t * ddlist, const char ** options)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist);
|
||||
|
||||
lv_label_set_text(ext->opt_label, "");
|
||||
uint16_t i = 0;
|
||||
while(options[i][0] != '\0') {
|
||||
lv_label_append_text(ext->opt_label, options[i]);
|
||||
if(options[i + 1][0] != '\0') lv_label_append_text(ext->opt_label, "\n");
|
||||
i++;
|
||||
}
|
||||
|
||||
lv_ddlist_refr_size(ddlist, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the selected option
|
||||
* @param ddlist pointer to drop down list object
|
||||
* @param sel_opt id of the selected option (0 ... number of option - 1);
|
||||
*/
|
||||
void lv_ddlist_set_selected(lv_obj_t * ddlist, uint16_t sel_opt)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist);
|
||||
|
||||
ext->sel_opt = sel_opt;
|
||||
|
||||
/*Move the list to show the current option*/
|
||||
if(ext->opened == 0) {
|
||||
lv_ddlist_pos_act_option(ddlist);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a function to call when a new option is chosen
|
||||
* @param ddlist pointer to a drop down list
|
||||
* @param cb pointer to a call back function
|
||||
*/
|
||||
void lv_ddlist_set_action(lv_obj_t * ddlist, lv_action_t cb)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist);
|
||||
ext->cb = cb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the auto size attribute. If enabled the height will reduced to be visible on the parent.
|
||||
* In this case the drop down list can be scrolled.
|
||||
* @param ddlist pointer to a drop down list
|
||||
* @param auto_size true: enable auto size, false: disable
|
||||
*/
|
||||
void lv_ddlist_set_auto_size(lv_obj_t * ddlist, bool auto_size)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist);
|
||||
ext->auto_size = auto_size == false ? 0 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the open/close animation time.
|
||||
* @param ddlist pointer to a drop down list
|
||||
* @param anim_time: open/close animation time [ms]
|
||||
*/
|
||||
void lv_ddlist_set_anim_time(lv_obj_t * ddlist, uint16_t anim_time)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist);
|
||||
ext->anim_time = anim_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the style of the rectangle on the selected option
|
||||
* @param ddlist pointer to a drop down list object
|
||||
* @param style pointer the new style of the select rectangle
|
||||
*/
|
||||
void lv_dlist_set_style_select(lv_obj_t * ddlist, lv_style_t * style)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist);
|
||||
ext->style_sel = style;
|
||||
|
||||
}
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Get the options of a drop down list
|
||||
* @param ddlist pointer to drop down list object
|
||||
* @return the options separated by '\n'-s (E.g. "Option1\nOption2\nOption3")
|
||||
*/
|
||||
const char * lv_ddlist_get_options(lv_obj_t * ddlist)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist);
|
||||
return lv_label_get_text(ext->opt_label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the selected option
|
||||
* @param ddlist pointer to drop down list object
|
||||
* @return id of the selected option (0 ... number of option - 1);
|
||||
*/
|
||||
uint16_t lv_ddlist_get_selected(lv_obj_t * ddlist)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist);
|
||||
|
||||
return ext->sel_opt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the auto size attribute.
|
||||
* @param ddlist pointer to a drop down list object
|
||||
* @return true: the auto_size is enabled, false: disabled
|
||||
*/
|
||||
bool lv_ddlist_get_auto_size(lv_obj_t * ddlist, bool auto_size)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist);
|
||||
return ext->auto_size == 0 ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the style of the rectangle on the selected option
|
||||
* @param ddlist pointer to a drop down list object
|
||||
* @return pointer the style of the select rectangle
|
||||
*/
|
||||
lv_style_t * lv_ddlist_get_style_select(lv_obj_t * ddlist)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist);
|
||||
if(ext->style_sel == NULL) return lv_obj_get_style(ddlist);
|
||||
|
||||
return ext->style_sel;
|
||||
}
|
||||
/**
|
||||
* Get the open/close animation time.
|
||||
* @param ddlist pointer to a drop down list
|
||||
* @return open/close animation time [ms]
|
||||
*/
|
||||
uint16_t lv_ddlist_get_anim_time(lv_obj_t * ddlist)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist);
|
||||
return ext->anim_time;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Handle the drawing related tasks of the drop down lists
|
||||
* @param ddlist pointer to an object
|
||||
* @param mask the object will be drawn only in this area
|
||||
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
|
||||
* (return 'true' if yes)
|
||||
* LV_DESIGN_DRAW: draw the object (always return 'true')
|
||||
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
|
||||
* @param return true/false, depends on 'mode'
|
||||
*/
|
||||
static bool lv_ddlist_design(lv_obj_t * ddlist, const area_t * mask, lv_design_mode_t mode)
|
||||
{
|
||||
/*Return false if the object is not covers the mask_p area*/
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
return ancestor_design_f(ddlist, mask, mode);
|
||||
}
|
||||
/*Draw the object*/
|
||||
else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
ancestor_design_f(ddlist, mask, mode);
|
||||
|
||||
/*If the list is opened draw a rectangle below the selected item*/
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist);
|
||||
if(ext->opened != 0) {
|
||||
lv_style_t * style = lv_obj_get_style(ddlist);
|
||||
const font_t * font = style->font;
|
||||
cord_t font_h = font_get_height(font) >> FONT_ANTIALIAS;
|
||||
area_t rect_area;
|
||||
lv_style_t * style_page_scrl = lv_obj_get_style(lv_page_get_scrl(ddlist));
|
||||
rect_area.y1 = ext->opt_label->cords.y1;
|
||||
rect_area.y1 += ext->sel_opt * (font_h + style->line_space);
|
||||
rect_area.y1 -= style->line_space / 2;
|
||||
|
||||
rect_area.y2 = rect_area.y1 + font_h + style->line_space;
|
||||
rect_area.x1 = ext->opt_label->cords.x1 - style_page_scrl->hpad;
|
||||
rect_area.x2 = rect_area.x1 + lv_obj_get_width(lv_page_get_scrl(ddlist));
|
||||
|
||||
lv_draw_rect(&rect_area, mask, ext->style_sel);
|
||||
}
|
||||
}
|
||||
/*Post draw when the children are drawn*/
|
||||
else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
ancestor_design_f(ddlist, mask, mode);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a drop down list is released to open it or set new option
|
||||
* @param ddlist pointer to a drop down list object
|
||||
* @param dispi pointer to the called display input
|
||||
* @return LV_ACTION_RES_INV if the ddlist it deleted in the user callback else LV_ACTION_RES_OK
|
||||
*/
|
||||
static lv_action_res_t lv_ddlist_rel_action(lv_obj_t * ddlist, lv_dispi_t * dispi)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist);
|
||||
|
||||
if(ext->opened == 0) { /*Open the list*/
|
||||
ext->opened = 1;
|
||||
lv_obj_set_drag(lv_page_get_scrl(ddlist), true);
|
||||
} else {
|
||||
ext->opened = 0;
|
||||
lv_obj_set_drag(lv_page_get_scrl(ddlist), false);
|
||||
|
||||
/*Search the clicked option*/
|
||||
point_t p;
|
||||
lv_dispi_get_point(dispi, &p);
|
||||
p.x -= ext->opt_label->cords.x1;
|
||||
p.y -= ext->opt_label->cords.y1;
|
||||
uint16_t letter_i;
|
||||
letter_i = lv_label_get_letter_on(ext->opt_label, &p);
|
||||
|
||||
uint16_t new_opt = 0;
|
||||
const char * txt = lv_label_get_text(ext->opt_label);
|
||||
uint16_t i;
|
||||
for(i = 0; i < letter_i; i++) {
|
||||
if(txt[i] == '\n') new_opt ++;
|
||||
}
|
||||
|
||||
ext->sel_opt = new_opt;
|
||||
|
||||
if(ext->cb != NULL) {
|
||||
ext->cb(ddlist, dispi);
|
||||
}
|
||||
}
|
||||
lv_ddlist_refr_size(ddlist, ext->anim_time);
|
||||
|
||||
return LV_ACTION_RES_OK;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the size of drop down list according its start (open or closed)
|
||||
* @param ddlist pointer to a drop down list object
|
||||
* @param anim_time animations time for open/close [ms]
|
||||
*/
|
||||
static void lv_ddlist_refr_size(lv_obj_t * ddlist, uint16_t anim_time)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist);
|
||||
lv_style_t * style = lv_obj_get_style(ddlist);
|
||||
cord_t new_height;
|
||||
if(ext->opened != 0) { /*Open the list*/
|
||||
new_height = lv_obj_get_height(lv_page_get_scrl(ddlist)) + 2 * style->vpad;
|
||||
lv_obj_t * parent = lv_obj_get_parent(ddlist);
|
||||
/*Reduce the height if enabled and required*/
|
||||
if(ext->auto_size != 0 && new_height + ddlist->cords.y1 > parent->cords.y2) {
|
||||
new_height = parent->cords.y2 - ddlist->cords.y1;
|
||||
}
|
||||
} else { /*Close the list*/
|
||||
const font_t * font = style->font;
|
||||
lv_style_t * label_style = lv_obj_get_style(ext->opt_label);
|
||||
cord_t font_h = font_get_height(font) >> FONT_ANTIALIAS;
|
||||
new_height = font_h + 2 * label_style->line_space;
|
||||
}
|
||||
if(anim_time == 0) {
|
||||
lv_obj_set_height(ddlist, new_height);
|
||||
lv_ddlist_pos_act_option(ddlist);
|
||||
} else {
|
||||
anim_t a;
|
||||
a.var = ddlist;
|
||||
a.start = lv_obj_get_height(ddlist);
|
||||
a.end = new_height;
|
||||
a.fp = (anim_fp_t)lv_obj_set_height;
|
||||
a.path = anim_get_path(ANIM_PATH_LIN);
|
||||
a.end_cb = (anim_cb_t)lv_ddlist_pos_act_option;
|
||||
a.act_time = 0;
|
||||
a.time = ext->anim_time;
|
||||
a.playback = 0;
|
||||
a.playback_pause = 0;
|
||||
a.repeat = 0;
|
||||
a.repeat_pause = 0;
|
||||
|
||||
anim_create(&a);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the position of list when it is closed to show the selected item
|
||||
* @param ddlist pointer to a drop down list
|
||||
*/
|
||||
static void lv_ddlist_pos_act_option(lv_obj_t * ddlist)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist);
|
||||
lv_style_t * style = lv_obj_get_style(ddlist);
|
||||
const font_t * font = style->font;
|
||||
cord_t font_h = font_get_height(font) >> FONT_ANTIALIAS;
|
||||
lv_style_t * label_style = lv_obj_get_style(ext->opt_label);
|
||||
lv_obj_t * scrl = lv_page_get_scrl(ddlist);
|
||||
lv_style_t * style_scrl = lv_obj_get_style(scrl);
|
||||
|
||||
lv_obj_set_y(scrl, -(ext->sel_opt * (font_h + label_style->line_space) - label_style->line_space) - style_scrl->hpad);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
144
lv_objx/lv_ddlist.h
Normal file
144
lv_objx/lv_ddlist.h
Normal file
@@ -0,0 +1,144 @@
|
||||
/**
|
||||
* @file lv_ddlist.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_DDLIST_H
|
||||
#define LV_DDLIST_H
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_conf.h"
|
||||
#if USE_LV_DDLIST != 0
|
||||
|
||||
/*Testing of dependencies*/
|
||||
#if USE_LV_PAGE == 0
|
||||
#error "lv_ddlist: lv_page is required. Enable it in lv_conf.h (USE_LV_PAGE 1) "
|
||||
#endif
|
||||
|
||||
#if USE_LV_LABEL == 0
|
||||
#error "lv_ddlist: lv_label is required. Enable it in lv_conf.h (USE_LV_LABEL 1) "
|
||||
#endif
|
||||
|
||||
#include "../lv_obj/lv_obj.h"
|
||||
#include "../lv_objx/lv_page.h"
|
||||
#include "../lv_objx/lv_label.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
/*Data of drop down list*/
|
||||
typedef struct
|
||||
{
|
||||
lv_page_ext_t page; /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
lv_obj_t * opt_label; /*Label for the options*/
|
||||
lv_style_t * style_sel; /*Style of the selected option*/
|
||||
lv_action_t cb; /*Pointer to function to call when an option is slected*/
|
||||
uint16_t sel_opt; /*Index of the current option*/
|
||||
uint16_t anim_time; /*Open/Close animation time [ms]*/
|
||||
uint8_t opened :1; /*1: The list is opened*/
|
||||
uint8_t auto_size :1; /*1: Set height to show all options. 0: Set height maximum to the parent bottom*/
|
||||
}lv_ddlist_ext_t;
|
||||
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Create a drop down list objects
|
||||
* @param par pointer to an object, it will be the parent of the new drop down list
|
||||
* @param copy pointer to a drop down list object, if not NULL then the new object will be copied from it
|
||||
* @return pointer to the created drop down list
|
||||
*/
|
||||
lv_obj_t * lv_ddlist_create(lv_obj_t * par, lv_obj_t * copy);
|
||||
|
||||
/**
|
||||
* Signal function of the drop down list
|
||||
* @param ddlist pointer to a drop down list object
|
||||
* @param sign a signal type from lv_signal_t enum
|
||||
* @param param pointer to a signal specific variable
|
||||
* @return true: the object is still valid (not deleted), false: the object become invalid
|
||||
*/
|
||||
bool lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * param);
|
||||
|
||||
/**
|
||||
* Set the options in a drop down list
|
||||
* @param ddlist pointer to drop down list object
|
||||
* @param options an array of strings wit the text of the options.
|
||||
* The lest element has to be "" (empty string)
|
||||
* E.g. const char * opts[] = {"apple", "banana", "orange", ""};
|
||||
*/
|
||||
void lv_ddlist_set_options(lv_obj_t * ddlist, const char ** options);
|
||||
|
||||
/**
|
||||
* Set the selected option
|
||||
* @param ddlist pointer to drop down list object
|
||||
* @param sel_opt id of the selected option (0 ... number of option - 1);
|
||||
*/
|
||||
void lv_ddlist_set_selected(lv_obj_t * ddlist, uint16_t sel_opt);
|
||||
|
||||
|
||||
/**
|
||||
* Set a function to call when a new option is chosen
|
||||
* @param ddlist pointer to a drop down list
|
||||
* @param cb pointer to a call back function
|
||||
*/
|
||||
void lv_ddlist_set_action(lv_obj_t * ddlist, lv_action_t cb);
|
||||
|
||||
/**
|
||||
* Set the auto size attribute. If enabled the height will reduced to be visible on the parent.
|
||||
* In this case the drop down list can be scrolled.
|
||||
* @param ddlist pointer to a drop down list
|
||||
* @param auto_size true: enable auto size, false: disable
|
||||
*/
|
||||
void lv_ddlist_set_auto_size(lv_obj_t * ddlist, bool auto_size);
|
||||
|
||||
/**
|
||||
* Set the style of the rectangle on the selected option
|
||||
* @param ddlist pointer to a drop down list object
|
||||
* @param style pointer the new style of the select rectangle
|
||||
*/
|
||||
void lv_dlist_set_style_select(lv_obj_t * ddlist, lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Get the options of a drop down list
|
||||
* @param ddlist pointer to drop down list object
|
||||
* @return the options separated by '\n'-s (E.g. "Option1\nOption2\nOption3")
|
||||
*/
|
||||
const char * lv_ddlist_get_options(lv_obj_t * ddlist);
|
||||
|
||||
/**
|
||||
* Get the selected option
|
||||
* @param ddlist pointer to drop down list object
|
||||
* @return id of the selected option (0 ... number of option - 1);
|
||||
*/
|
||||
uint16_t lv_ddlist_get_selected(lv_obj_t * ddlist);
|
||||
|
||||
/**
|
||||
* Get the auto size attribute.
|
||||
* @param ddlist pointer to a drop down list object
|
||||
* @return true: the auto_size is enabled, false: disabled
|
||||
*/
|
||||
bool lv_ddlist_get_auto_size(lv_obj_t * ddlist, bool auto_size);
|
||||
|
||||
/**
|
||||
* Get the style of the rectangle on the selected option
|
||||
* @param ddlist pointer to a drop down list object
|
||||
* @return pointer the style of the select rectangle
|
||||
*/
|
||||
lv_style_t * lv_ddlist_get_style_select(lv_obj_t * ddlist);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -11,18 +11,17 @@
|
||||
#if USE_LV_GAUGE != 0
|
||||
|
||||
#include "lv_gauge.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_misc/text.h"
|
||||
#include "misc/gfx/text.h"
|
||||
#include "misc/math/trigo.h"
|
||||
#include "misc/math/math_base.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_GAUGE_DEF_WIDTH (150 * LV_DOWNSCALE)
|
||||
#define LV_GAUGE_DEF_HEIGHT (150 * LV_DOWNSCALE)
|
||||
#define LV_GAUGE_DEF_NEEDLE_COLOR COLOR_RED
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@@ -32,15 +31,14 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_gauge_design(lv_obj_t * gauge, const area_t * mask, lv_design_mode_t mode);
|
||||
static void lv_gauge_draw_scale(lv_obj_t * gauge, const area_t * mask);
|
||||
static void lv_gauge_draw_needle(lv_obj_t * gauge, const area_t * mask);
|
||||
static void lv_gauges_init(void);
|
||||
static void lv_gauge_draw_scale(lv_obj_t * gauge, const area_t * mask, lv_style_t * style);
|
||||
static void lv_gauge_draw_needle(lv_obj_t * gauge, const area_t * mask, lv_style_t * style);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_gauges_t lv_gauges_def; /*Default gauge style*/
|
||||
static lv_design_f_t ancestor_design_f = NULL;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
@@ -62,7 +60,7 @@ static lv_design_f_t ancestor_design_f = NULL;
|
||||
lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
{
|
||||
/*Create the ancestor gauge*/
|
||||
lv_obj_t * new_gauge = lv_rect_create(par, copy);
|
||||
lv_obj_t * new_gauge = lv_lmeter_create(par, copy);
|
||||
dm_assert(new_gauge);
|
||||
|
||||
/*Allocate the gauge type specific extended data*/
|
||||
@@ -70,12 +68,11 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
dm_assert(ext);
|
||||
|
||||
/*Initialize the allocated 'ext' */
|
||||
ext->min = 0;
|
||||
ext->max = 100;
|
||||
ext->needle_num = 1;
|
||||
ext->low_critical = 0;
|
||||
ext->needle_num = 0;
|
||||
ext->values = NULL;
|
||||
ext->txt = NULL;
|
||||
ext->needle_colors = NULL;
|
||||
ext->low_critical = 0;
|
||||
ext->style_critical = lv_style_get(LV_STYLE_PRETTY_COLOR, NULL);
|
||||
|
||||
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_f(new_gauge);
|
||||
|
||||
@@ -85,19 +82,17 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
|
||||
/*Init the new gauge gauge*/
|
||||
if(copy == NULL) {
|
||||
lv_gauge_set_needle_num(new_gauge, 1);
|
||||
lv_gauge_set_text(new_gauge, "%d");
|
||||
lv_obj_set_size(new_gauge, LV_GAUGE_DEF_WIDTH, LV_GAUGE_DEF_HEIGHT);
|
||||
lv_obj_set_style(new_gauge, lv_gauges_get(LV_GAUGES_DEF, NULL));
|
||||
lv_lmeter_set_scale(new_gauge, 220, 6);
|
||||
lv_gauge_set_needle_num(new_gauge, 1, NULL);
|
||||
lv_obj_set_size(new_gauge, 2 * LV_DPI, 2 * LV_DPI);
|
||||
lv_obj_set_style(new_gauge, lv_style_get(LV_STYLE_PRETTY, NULL));
|
||||
}
|
||||
/*Copy an existing gauge*/
|
||||
else {
|
||||
lv_gauge_ext_t * copy_ext = lv_obj_get_ext(copy);
|
||||
ext->min = copy_ext->min;
|
||||
ext->max = copy_ext->max;
|
||||
ext->low_critical = copy_ext->low_critical;
|
||||
lv_gauge_set_needle_num(new_gauge, lv_gauge_get_needle_num(copy));
|
||||
lv_gauge_set_text(new_gauge, lv_gauge_get_text(copy));
|
||||
lv_gauge_set_style_critical(new_gauge, lv_gauge_get_style_critical(copy));
|
||||
lv_gauge_set_needle_num(new_gauge, copy_ext->needle_num, copy_ext->needle_colors);
|
||||
|
||||
uint8_t i;
|
||||
for(i = 0; i < ext->needle_num; i++) {
|
||||
@@ -123,19 +118,19 @@ bool lv_gauge_signal(lv_obj_t * gauge, lv_signal_t sign, void * param)
|
||||
bool valid;
|
||||
|
||||
/* Include the ancient signal function */
|
||||
valid = lv_rect_signal(gauge, sign, param);
|
||||
valid = lv_lmeter_signal(gauge, sign, param);
|
||||
|
||||
/* The object can be deleted so check its validity and then
|
||||
* make the object specific signal handling */
|
||||
if(valid != false) {
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext(gauge);
|
||||
switch(sign) {
|
||||
case LV_SIGNAL_CLEANUP:
|
||||
dm_free(ext->values);
|
||||
ext->values = NULL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
dm_free(ext->values);
|
||||
ext->values = NULL;
|
||||
}
|
||||
else if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
|
||||
lv_style_t * style_crit = lv_gauge_get_style_critical(gauge);
|
||||
if(style_crit->swidth > gauge->ext_size) gauge->ext_size = style_crit->swidth;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,37 +142,32 @@ bool lv_gauge_signal(lv_obj_t * gauge, lv_signal_t sign, void * param)
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Set the number of needles (should be <= LV_GAUGE_MAX_NEEDLE)
|
||||
* Set the number of needles
|
||||
* @param gauge pointer to gauge object
|
||||
* @param num number of needles
|
||||
* @param colors an array of colors for needles (with 'num' elements)
|
||||
*/
|
||||
void lv_gauge_set_needle_num(lv_obj_t * gauge, uint8_t num)
|
||||
void lv_gauge_set_needle_num(lv_obj_t * gauge, uint8_t num, color_t * colors)
|
||||
{
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext(gauge);
|
||||
if(ext->values != NULL) dm_free(ext->values);
|
||||
if(ext->values != NULL) {
|
||||
dm_free(ext->values);
|
||||
ext->values = NULL;
|
||||
}
|
||||
|
||||
ext->values = dm_alloc(num * sizeof(int16_t));
|
||||
ext->values = dm_realloc(ext->values, num * sizeof(int16_t));
|
||||
|
||||
int16_t min = lv_bar_get_min_value(gauge);
|
||||
uint8_t n;
|
||||
for(n = ext->needle_num; n < num; n++) {
|
||||
ext->values[n] = min;
|
||||
}
|
||||
|
||||
ext->needle_num = num;
|
||||
ext->needle_colors = colors;
|
||||
lv_obj_inv(gauge);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the range of a gauge
|
||||
* @param gauge pointer to gauge object
|
||||
* @param min min value
|
||||
* @param max max value
|
||||
*/
|
||||
void lv_gauge_set_range(lv_obj_t * gauge, int16_t min, int16_t max)
|
||||
{
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext(gauge);
|
||||
|
||||
/*Be sure the smaller value is min and the greater is max*/
|
||||
ext->min = MATH_MIN(min, max);
|
||||
ext->max = MATH_MAX(min, max);
|
||||
|
||||
lv_obj_inv(gauge);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of a needle
|
||||
@@ -191,28 +181,16 @@ void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle, int16_t value)
|
||||
|
||||
if(needle >= ext->needle_num) return;
|
||||
|
||||
if(value > ext->max) value = ext->max;
|
||||
if(value < ext->min) value = ext->min;
|
||||
int16_t min = lv_bar_get_min_value(gauge);
|
||||
int16_t max = lv_bar_get_max_value(gauge);
|
||||
|
||||
if(value > max) value = max;
|
||||
else if(value < min) value = min;
|
||||
|
||||
ext->values[needle] = value;
|
||||
|
||||
lv_obj_inv(gauge);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set text on a gauge
|
||||
* @param gauge pinter to a gauge object
|
||||
* @param txt a printf like format string
|
||||
* with 1 place for a number (e.g. "Value: %d");
|
||||
*/
|
||||
void lv_gauge_set_text(lv_obj_t * gauge, const char * txt)
|
||||
{
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext(gauge);
|
||||
|
||||
if(ext->txt != NULL) dm_free(ext->txt);
|
||||
|
||||
ext->txt = dm_alloc(strlen(txt) + 1);
|
||||
strcpy(ext->txt, txt);
|
||||
/*To be consistent with bar set the first needle's value for the bar*/
|
||||
if(needle == 0) lv_bar_set_value(gauge, value);
|
||||
|
||||
lv_obj_inv(gauge);
|
||||
}
|
||||
@@ -231,6 +209,18 @@ void lv_gauge_set_low_critical(lv_obj_t * gauge, bool low)
|
||||
lv_obj_inv(gauge);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the critical style of the gauge
|
||||
* @param gauge pointer to a gauge object
|
||||
* @param style pointer to the new critical style
|
||||
*/
|
||||
void lv_gauge_set_style_critical(lv_obj_t * gauge, lv_style_t * style)
|
||||
{
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext(gauge);
|
||||
ext->style_critical = style;
|
||||
gauge->signal_f(gauge, LV_SIGNAL_REFR_EXT_SIZE, NULL);
|
||||
lv_obj_inv(gauge);
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
@@ -256,24 +246,13 @@ uint8_t lv_gauge_get_needle_num(lv_obj_t * gauge)
|
||||
int16_t lv_gauge_get_value(lv_obj_t * gauge, uint8_t needle)
|
||||
{
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext(gauge);
|
||||
int16_t min = lv_bar_get_min_value(gauge);
|
||||
|
||||
if(needle >= ext->needle_num) return ext->min;
|
||||
if(needle >= ext->needle_num) return min;
|
||||
|
||||
return ext->values[needle];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the text of a gauge
|
||||
* @param gauge pointer to gauge
|
||||
* @return the set text. (not with the current value)
|
||||
*/
|
||||
const char * lv_gauge_get_text(lv_obj_t * gauge)
|
||||
{
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext(gauge);
|
||||
return ext->txt;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get which value is more critical (lower or higher)
|
||||
* @param gauge pointer to a gauge object
|
||||
@@ -287,37 +266,17 @@ bool lv_gauge_get_low_critical(lv_obj_t * gauge)
|
||||
}
|
||||
|
||||
/**
|
||||
* Return with a pointer to a built-in style and/or copy it to a variable
|
||||
* @param style a style name from lv_gauges_builtin_t enum
|
||||
* @param copy copy the style to this variable. (NULL if unused)
|
||||
* @return pointer to an lv_gauges_t style
|
||||
* Get the critical style of the gauge
|
||||
* @param gauge pointer to a gauge object
|
||||
* @return pointer to the critical style
|
||||
*/
|
||||
lv_gauges_t * lv_gauges_get(lv_gauges_builtin_t style, lv_gauges_t * copy)
|
||||
lv_style_t * lv_gauge_get_style_critical(lv_obj_t * gauge)
|
||||
{
|
||||
static bool style_inited = false;
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext(gauge);
|
||||
|
||||
/*Make the style initialization if it is not done yet*/
|
||||
if(style_inited == false) {
|
||||
lv_gauges_init();
|
||||
style_inited = true;
|
||||
}
|
||||
if(ext->style_critical == NULL) return lv_obj_get_style(gauge);
|
||||
|
||||
lv_gauges_t *style_p;
|
||||
|
||||
switch(style) {
|
||||
case LV_GAUGES_DEF:
|
||||
style_p = &lv_gauges_def;
|
||||
break;
|
||||
default:
|
||||
style_p = &lv_gauges_def;
|
||||
}
|
||||
|
||||
if(copy != NULL) {
|
||||
if(style_p != NULL) memcpy(copy, style_p, sizeof(lv_gauges_t));
|
||||
else memcpy(copy, &lv_gauges_def, sizeof(lv_gauges_t));
|
||||
}
|
||||
|
||||
return style_p;
|
||||
return ext->style_critical;
|
||||
}
|
||||
|
||||
/**********************
|
||||
@@ -336,40 +295,54 @@ lv_gauges_t * lv_gauges_get(lv_gauges_builtin_t style, lv_gauges_t * copy)
|
||||
*/
|
||||
static bool lv_gauge_design(lv_obj_t * gauge, const area_t * mask, lv_design_mode_t mode)
|
||||
{
|
||||
|
||||
/*Return false if the object is not covers the mask_p area*/
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
return ancestor_design_f(gauge, mask, mode);
|
||||
return false;
|
||||
}
|
||||
/*Draw the object*/
|
||||
else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
lv_gauges_t * style = lv_obj_get_style(gauge);
|
||||
lv_style_t * style_base = lv_obj_get_style(gauge);
|
||||
lv_style_t * style_critical = lv_gauge_get_style_critical(gauge);
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext(gauge);
|
||||
|
||||
/* Draw the background
|
||||
* Re-color the gauge according to the critical value*/
|
||||
color_t mcolor_min = style->rects.objs.color;
|
||||
color_t gcolor_min = style->rects.gcolor;
|
||||
lv_style_t style_bg;
|
||||
int16_t min = lv_bar_get_min_value(gauge);
|
||||
int16_t max = lv_bar_get_max_value(gauge);
|
||||
|
||||
int16_t critical_val = ext->low_critical == 0 ? ext->min : ext->max;
|
||||
/*To be consistent with bar use the bar value as the first needle*/
|
||||
if(ext->needle_num != 0) {
|
||||
ext->values[0] = lv_bar_get_value(gauge);
|
||||
}
|
||||
|
||||
int16_t critical_val = ext->low_critical == 0 ? min : max;
|
||||
uint8_t i;
|
||||
|
||||
for(i = 0; i < ext->needle_num; i++) {
|
||||
critical_val = ext->low_critical == 0 ? MATH_MAX(critical_val, ext->values[i]) : MATH_MIN(critical_val, ext->values[i]);
|
||||
}
|
||||
|
||||
opa_t ratio = ((critical_val - ext->min) * OPA_COVER) / (ext->max - ext->min);
|
||||
opa_t ratio = ((critical_val - min) * OPA_COVER) / (max - min);
|
||||
|
||||
if(ext->low_critical != 0) ratio = OPA_COVER - ratio;
|
||||
|
||||
style->rects.objs.color= color_mix(style->mcolor_critical, mcolor_min, ratio);
|
||||
style->rects.gcolor = color_mix(style->gcolor_critical, gcolor_min, ratio);
|
||||
ancestor_design_f(gauge, mask, mode);
|
||||
style->rects.objs.color= mcolor_min;
|
||||
style->rects.gcolor = gcolor_min;
|
||||
/*Mix the normal and the critical style*/
|
||||
memcpy(&style_bg, style_base, sizeof(lv_style_t));
|
||||
style_bg.ccolor = color_mix(style_critical->ccolor, style_base->ccolor, ratio);
|
||||
style_bg.mcolor= color_mix(style_critical->mcolor, style_base->mcolor, ratio);
|
||||
style_bg.gcolor = color_mix(style_critical->gcolor, style_base->gcolor, ratio);
|
||||
style_bg.bcolor = color_mix(style_critical->bcolor, style_base->bcolor, ratio);
|
||||
style_bg.scolor = color_mix(style_critical->scolor, style_base->scolor, ratio);
|
||||
style_bg.swidth = (cord_t)(((cord_t)style_critical->swidth * ratio) + ((cord_t)style_base->swidth * (OPA_COVER - ratio))) >> 8;
|
||||
style_bg.opa = (cord_t)(((uint16_t)style_critical->opa * ratio) + ((uint16_t)style_base->opa * (OPA_COVER - ratio))) >> 8;
|
||||
|
||||
lv_gauge_draw_scale(gauge, mask);
|
||||
lv_draw_rect(&gauge->cords, mask, &style_bg);
|
||||
|
||||
lv_gauge_draw_needle(gauge, mask);
|
||||
lv_gauge_draw_scale(gauge, mask, &style_bg);
|
||||
|
||||
lv_gauge_draw_needle(gauge, mask, &style_bg);
|
||||
}
|
||||
/*Post draw when the children are drawn*/
|
||||
else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
@@ -384,22 +357,23 @@ static bool lv_gauge_design(lv_obj_t * gauge, const area_t * mask, lv_design_mod
|
||||
* @param gauge pointer to gauge object
|
||||
* @param mask mask of drawing
|
||||
*/
|
||||
static void lv_gauge_draw_scale(lv_obj_t * gauge, const area_t * mask)
|
||||
static void lv_gauge_draw_scale(lv_obj_t * gauge, const area_t * mask, lv_style_t * style)
|
||||
{
|
||||
lv_gauges_t * style = lv_obj_get_style(gauge);
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext(gauge);
|
||||
|
||||
char scale_txt[16];
|
||||
|
||||
cord_t r = lv_obj_get_width(gauge) / 2 - style->scale_pad;
|
||||
cord_t r = lv_obj_get_width(gauge) / 2 - style->hpad;
|
||||
cord_t x_ofs = lv_obj_get_width(gauge) / 2 + gauge->cords.x1;
|
||||
cord_t y_ofs = lv_obj_get_height(gauge) / 2 + gauge->cords.y1;
|
||||
int16_t angle_ofs = 90 + (360 - style->scale_angle) / 2;
|
||||
int16_t scale_angle = lv_lmeter_get_scale_angle(gauge);
|
||||
uint16_t scale_num = lv_lmeter_get_scale_num(gauge);
|
||||
int16_t angle_ofs = 90 + (360 - scale_angle) / 2;
|
||||
int16_t min = lv_bar_get_min_value(gauge);
|
||||
int16_t max = lv_bar_get_max_value(gauge);
|
||||
|
||||
uint8_t i;
|
||||
for(i = 0; i < style->scale_label_num; i++) {
|
||||
for(i = 0; i < scale_num; i++) {
|
||||
/*Calculate the position a scale label*/
|
||||
int16_t angle = (i * style->scale_angle) / (style->scale_label_num - 1) + angle_ofs;
|
||||
int16_t angle = (i * scale_angle) / (scale_num - 1) + angle_ofs;
|
||||
|
||||
cord_t y = (int32_t)((int32_t)trigo_sin(angle) * r) / TRIGO_SIN_MAX;
|
||||
y += y_ofs;
|
||||
@@ -407,15 +381,15 @@ static void lv_gauge_draw_scale(lv_obj_t * gauge, const area_t * mask)
|
||||
cord_t x = (int32_t)((int32_t)trigo_sin(angle + 90) * r) / TRIGO_SIN_MAX;
|
||||
x += x_ofs;
|
||||
|
||||
int16_t scale_act = (int32_t)((int32_t)(ext->max - ext->min) * i) / (style->scale_label_num - 1);
|
||||
scale_act += ext->min;
|
||||
int16_t scale_act = (int32_t)((int32_t)(max - min) * i) / (scale_num - 1);
|
||||
scale_act += min;
|
||||
sprintf(scale_txt, "%d", scale_act);
|
||||
|
||||
area_t label_cord;
|
||||
point_t label_size;
|
||||
txt_get_size(&label_size, scale_txt, font_get(style->scale_labels.font),
|
||||
style->scale_labels.letter_space, style->scale_labels.line_space,
|
||||
LV_CORD_MAX, TXT_FLAG_NONE);
|
||||
txt_get_size(&label_size, scale_txt, style->font,
|
||||
style->letter_space, style->line_space,
|
||||
CORD_MAX, TXT_FLAG_NONE);
|
||||
|
||||
/*Draw the label*/
|
||||
label_cord.x1 = x - label_size.x / 2;
|
||||
@@ -423,132 +397,61 @@ static void lv_gauge_draw_scale(lv_obj_t * gauge, const area_t * mask)
|
||||
label_cord.x2 = label_cord.x1 + label_size.x;
|
||||
label_cord.y2 = label_cord.y1 + label_size.y;
|
||||
|
||||
lv_draw_label(&label_cord, mask, &style->scale_labels, OPA_COVER, scale_txt, TXT_FLAG_NONE);
|
||||
lv_draw_label(&label_cord, mask, style, scale_txt, TXT_FLAG_NONE);
|
||||
}
|
||||
|
||||
/*Calculate the critical value*/
|
||||
int16_t critical_value = ext->low_critical == 0 ? ext->min : ext->max;;
|
||||
for(i = 0; i < ext->needle_num; i++) {
|
||||
critical_value = ext->low_critical == 0 ?
|
||||
MATH_MAX(critical_value, ext->values[i]) : MATH_MIN(critical_value, ext->values[i]);
|
||||
}
|
||||
|
||||
/*Write the critical value if enabled*/
|
||||
if(ext->txt[0] != '\0') {
|
||||
char value_txt[16];
|
||||
sprintf(value_txt, ext->txt, critical_value);
|
||||
|
||||
area_t label_cord;
|
||||
point_t label_size;
|
||||
txt_get_size(&label_size, value_txt, font_get(style->value_labels.font),
|
||||
style->value_labels.letter_space, style->value_labels.line_space,
|
||||
LV_CORD_MAX, TXT_FLAG_NONE);
|
||||
|
||||
/*Draw the label*/
|
||||
label_cord.x1 = gauge->cords.x1 + lv_obj_get_width(gauge) / 2 - label_size.x / 2;
|
||||
label_cord.y1 = gauge->cords.y1 +
|
||||
(cord_t)style->value_pos * lv_obj_get_height(gauge) / 100 - label_size.y / 2;
|
||||
|
||||
label_cord.x2 = label_cord.x1 + label_size.x;
|
||||
label_cord.y2 = label_cord.y1 + label_size.y;
|
||||
|
||||
lv_draw_label(&label_cord, mask, &style->value_labels, OPA_COVER, value_txt, TXT_FLAG_NONE);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Draw the needles of a gauge
|
||||
* @param gauge pointer to gauge object
|
||||
* @param mask mask of drawing
|
||||
*/
|
||||
static void lv_gauge_draw_needle(lv_obj_t * gauge, const area_t * mask)
|
||||
static void lv_gauge_draw_needle(lv_obj_t * gauge, const area_t * mask, lv_style_t * style)
|
||||
{
|
||||
lv_gauges_t * style = lv_obj_get_style(gauge);
|
||||
lv_style_t style_needle;
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext(gauge);
|
||||
|
||||
cord_t r = lv_obj_get_width(gauge) / 2 - style->scale_pad;
|
||||
cord_t r = lv_obj_get_width(gauge) / 2 - style->opad;
|
||||
cord_t x_ofs = lv_obj_get_width(gauge) / 2 + gauge->cords.x1;
|
||||
cord_t y_ofs = lv_obj_get_height(gauge) / 2 + gauge->cords.y1;
|
||||
int16_t angle_ofs = 90 + (360 - style->scale_angle) / 2;
|
||||
uint16_t angle = lv_lmeter_get_scale_angle(gauge);
|
||||
int16_t angle_ofs = 90 + (360 - angle) / 2;
|
||||
int16_t min = lv_bar_get_min_value(gauge);
|
||||
int16_t max = lv_bar_get_max_value(gauge);
|
||||
point_t p_mid;
|
||||
point_t p_end;
|
||||
uint8_t i;
|
||||
|
||||
memcpy(&style_needle, style, sizeof(lv_style_t));
|
||||
|
||||
p_mid.x = x_ofs;
|
||||
p_mid.y = y_ofs;
|
||||
for(i = 0; i < ext->needle_num; i++) {
|
||||
/*Calculate the end point of a needle*/
|
||||
int16_t needle_angle = (ext->values[i] - ext->min) * style->scale_angle /
|
||||
(ext->max - ext->min) + angle_ofs;
|
||||
int16_t needle_angle = (ext->values[i] - min) * angle / (max - min) + angle_ofs;
|
||||
p_end.y = (trigo_sin(needle_angle) * r) / TRIGO_SIN_MAX + y_ofs;
|
||||
p_end.x = (trigo_sin(needle_angle + 90) * r) / TRIGO_SIN_MAX + x_ofs;
|
||||
|
||||
/*Draw the needle with the corresponding color*/
|
||||
style->needle_lines.objs.color = style->needle_color[i];
|
||||
|
||||
lv_draw_line(&p_mid, &p_end, mask, &style->needle_lines, style->needle_opa);
|
||||
if(ext->needle_colors == NULL) style_needle.ccolor = LV_GAUGE_DEF_NEEDLE_COLOR;
|
||||
else style_needle.ccolor = ext->needle_colors[i];
|
||||
|
||||
lv_draw_line(&p_mid, &p_end, mask, &style_needle);
|
||||
}
|
||||
|
||||
/*Draw the needle middle area*/
|
||||
lv_rects_t nm;
|
||||
lv_style_t style_neddle_mid;
|
||||
lv_style_get(LV_STYLE_PLAIN, &style_neddle_mid);
|
||||
style_neddle_mid.mcolor = style->bcolor;
|
||||
style_neddle_mid.gcolor = style->bcolor;
|
||||
style_neddle_mid.radius = LV_RADIUS_CIRCLE;
|
||||
|
||||
area_t nm_cord;
|
||||
lv_rects_get(LV_RECTS_DEF, &nm);
|
||||
nm.bwidth = 0;
|
||||
nm.round = LV_RECT_CIRCLE;
|
||||
nm.objs.color = style->needle_mid_color;
|
||||
nm.gcolor = style->needle_mid_color;
|
||||
nm_cord.x1 = x_ofs - style->opad;
|
||||
nm_cord.y1 = y_ofs - style->opad;
|
||||
nm_cord.x2 = x_ofs + style->opad;
|
||||
nm_cord.y2 = y_ofs + style->opad;
|
||||
|
||||
nm_cord.x1 = x_ofs - style->needle_mid_r;
|
||||
nm_cord.y1 = y_ofs - style->needle_mid_r;
|
||||
nm_cord.x2 = x_ofs + style->needle_mid_r;
|
||||
nm_cord.y2 = y_ofs + style->needle_mid_r;
|
||||
|
||||
lv_draw_rect(&nm_cord, mask, &nm, OPA_100);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the built-in gauge styles
|
||||
*/
|
||||
static void lv_gauges_init(void)
|
||||
{
|
||||
/*Default style*/
|
||||
lv_rects_get(LV_RECTS_DEF, &lv_gauges_def.rects);
|
||||
lv_gauges_def.rects.round = LV_RECT_CIRCLE;
|
||||
lv_gauges_def.rects.bwidth = 4 * LV_DOWNSCALE;
|
||||
lv_gauges_def.rects.objs.color = COLOR_MAKE(0x00, 0xaa, 0x00);//GREEN;
|
||||
lv_gauges_def.rects.gcolor = COLOR_BLACK;
|
||||
lv_gauges_def.rects.bcolor = COLOR_BLACK;
|
||||
|
||||
lv_gauges_def.gcolor_critical = COLOR_BLACK;
|
||||
lv_gauges_def.mcolor_critical = COLOR_MAKE(0xff, 0x50, 0x50);
|
||||
|
||||
lv_labels_get(LV_LABELS_DEF, &lv_gauges_def.scale_labels);
|
||||
lv_gauges_def.scale_labels.objs.color = COLOR_MAKE(0xd0, 0xd0, 0xd0);
|
||||
|
||||
lv_labels_get(LV_LABELS_DEF, &lv_gauges_def.value_labels);
|
||||
lv_gauges_def.value_labels.objs.color = COLOR_WHITE;
|
||||
lv_gauges_def.value_labels.letter_space = 3 * LV_DOWNSCALE;
|
||||
lv_gauges_def.value_labels.mid = 1;
|
||||
|
||||
lv_gauges_def.value_pos = 75;
|
||||
|
||||
lv_lines_get(LV_LINES_DEF, &lv_gauges_def.needle_lines);
|
||||
lv_gauges_def.needle_lines.objs.color = COLOR_WHITE;
|
||||
lv_gauges_def.needle_lines.width = 3 * LV_DOWNSCALE;
|
||||
|
||||
lv_gauges_def.needle_color[0] = COLOR_SILVER;
|
||||
lv_gauges_def.needle_color[1] = COLOR_MAKE(0x40, 0x90, 0xe0);
|
||||
lv_gauges_def.needle_color[2] = COLOR_MAKE(0x50, 0xe0, 0x50);
|
||||
lv_gauges_def.needle_color[3] = COLOR_MAKE(0xff, 0xff, 0x70);
|
||||
|
||||
lv_gauges_def.needle_mid_r = 5 * LV_DOWNSCALE;
|
||||
lv_gauges_def.needle_mid_color = COLOR_GRAY;
|
||||
lv_gauges_def.needle_opa = OPA_80;
|
||||
lv_gauges_def.scale_pad = 20 * LV_DOWNSCALE;
|
||||
lv_gauges_def.scale_label_num = 6;
|
||||
lv_gauges_def.scale_angle = 220;
|
||||
lv_draw_rect(&nm_cord, mask, &style_neddle_mid);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,16 +14,8 @@
|
||||
#if USE_LV_GAUGE != 0
|
||||
|
||||
/*Testing of dependencies*/
|
||||
#if USE_LV_RECT == 0
|
||||
#error "lv_gauge: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) "
|
||||
#endif
|
||||
|
||||
#if USE_LV_LABEL == 0
|
||||
#error "lv_gauge: lv_label is required. Enable it in lv_conf.h (USE_LV_LABEL 1) "
|
||||
#endif
|
||||
|
||||
#if USE_LV_RECT == 0
|
||||
#error "lv_gauge: lv_line is required. Enable it in lv_conf.h (USE_LV_LINE 1) "
|
||||
#if USE_LV_LMETER == 0
|
||||
#error "lv_gauge: lv_lmeter is required. Enable it in lv_conf.h (USE_LV_LMETER 1) "
|
||||
#endif
|
||||
|
||||
#if USE_TRIGO == 0
|
||||
@@ -32,7 +24,7 @@
|
||||
|
||||
|
||||
#include "../lv_obj/lv_obj.h"
|
||||
#include "lv_rect.h"
|
||||
#include "lv_lmeter.h"
|
||||
#include "lv_label.h"
|
||||
#include "lv_line.h"
|
||||
|
||||
@@ -48,50 +40,19 @@
|
||||
/*Data of gauge*/
|
||||
typedef struct
|
||||
{
|
||||
lv_rect_ext_t rect; /*Ext. of ancestor*/
|
||||
lv_lmeter_ext_t lmeter; /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
int16_t min; /*Minimum value of the scale*/
|
||||
int16_t max; /*Maximum value of the scale*/
|
||||
int16_t * values; /*Array of the set values (for needles) */
|
||||
char * txt; /*Printf-like text to display with the most critical value (e.g. "Value: %d")*/
|
||||
uint8_t needle_num; /*Number of needles*/
|
||||
uint8_t low_critical :1; /*0: the higher value is more critical, 1: the lower value is more critical*/
|
||||
int16_t * values; /*Array of the set values (for needles) */
|
||||
lv_style_t * style_critical; /*Fade to this style nearer to the critical value*/
|
||||
color_t * needle_colors; /*Color of the needles (color_t my_colors[needle_num])*/
|
||||
uint8_t needle_num; /*Number of needles*/
|
||||
uint8_t low_critical:1; /*0: the higher value is more critical, 1: the lower value is more critical*/
|
||||
}lv_gauge_ext_t;
|
||||
|
||||
/*Style of gauge*/
|
||||
typedef struct
|
||||
{
|
||||
lv_rects_t rects; /*Style of ancestor*/
|
||||
/*New style element for this type */
|
||||
color_t mcolor_critical; /*Top color at critical.*/
|
||||
color_t gcolor_critical; /*Bottom color at critical*/
|
||||
/*Scale settings*/
|
||||
uint16_t scale_angle; /*Angle of the scale in deg. (~220)*/
|
||||
lv_labels_t scale_labels; /*Style of the scale labels*/
|
||||
cord_t scale_pad; /*Padding of scale labels from the edge*/
|
||||
uint8_t scale_label_num; /*Number of scale labels (~6)*/
|
||||
/*Needle settings*/
|
||||
lv_lines_t needle_lines; /*Style of neddles*/
|
||||
color_t needle_color[LV_GAUGE_MAX_NEEDLE]; /*Color of needles*/
|
||||
color_t needle_mid_color; /*Color of middle where the needles start*/
|
||||
cord_t needle_mid_r; /*Radius of the needle middle area*/
|
||||
opa_t needle_opa; /*Opacity of the needles*/
|
||||
/*Value text settings*/
|
||||
lv_labels_t value_labels; /*Style of the value label*/
|
||||
uint8_t value_pos; /*Vertical position of the value label in percentage of object height (0..100 %)*/
|
||||
}lv_gauges_t;
|
||||
|
||||
/*Built-in styles of gauge*/
|
||||
typedef enum
|
||||
{
|
||||
LV_GAUGES_DEF,
|
||||
}lv_gauges_builtin_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
|
||||
/**
|
||||
* Create a gauge objects
|
||||
* @param par pointer to an object, it will be the parent of the new gauge
|
||||
@@ -110,19 +71,12 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy);
|
||||
bool lv_gauge_signal(lv_obj_t * gauge, lv_signal_t sign, void * param);
|
||||
|
||||
/**
|
||||
* Set the number of needles (should be <= LV_GAUGE_MAX_NEEDLE)
|
||||
* Set the number of needles
|
||||
* @param gauge pointer to gauge object
|
||||
* @param num number of needles
|
||||
* @param colors an array of colors for needles (with 'num' elements)
|
||||
*/
|
||||
void lv_gauge_set_needle_num(lv_obj_t * gauge, uint8_t num);
|
||||
|
||||
/**
|
||||
* Set the range of a gauge
|
||||
* @param gauge pointer to gauge object
|
||||
* @param min min value
|
||||
* @param max max value
|
||||
*/
|
||||
void lv_gauge_set_range(lv_obj_t * gauge, int16_t min, int16_t max);
|
||||
void lv_gauge_set_needle_num(lv_obj_t * gauge, uint8_t num, color_t * colors);
|
||||
|
||||
/**
|
||||
* Set the value of a needle
|
||||
@@ -132,14 +86,6 @@ void lv_gauge_set_range(lv_obj_t * gauge, int16_t min, int16_t max);
|
||||
*/
|
||||
void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle, int16_t value);
|
||||
|
||||
/**
|
||||
* Set text on a gauge
|
||||
* @param gauge pinter to a gauge object
|
||||
* @param txt a printf like format string
|
||||
* with 1 place for a number (e.g. "Value: %d");
|
||||
*/
|
||||
void lv_gauge_set_text(lv_obj_t * gauge, const char * txt);
|
||||
|
||||
/**
|
||||
* Set which value is more critical (lower or higher)
|
||||
* @param gauge pointer to a gauge object
|
||||
@@ -147,6 +93,13 @@ void lv_gauge_set_text(lv_obj_t * gauge, const char * txt);
|
||||
*/
|
||||
void lv_gauge_set_low_critical(lv_obj_t * gauge, bool low);
|
||||
|
||||
/**
|
||||
* Set the critical style of the gauge
|
||||
* @param gauge pointer to a gauge object
|
||||
* @param style pointer to the new critical style
|
||||
*/
|
||||
void lv_gauge_set_style_critical(lv_obj_t * gauge, lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Get the number of needles on a gauge
|
||||
* @param gauge pointer to gauge
|
||||
@@ -162,13 +115,6 @@ uint8_t lv_gauge_get_needle_num(lv_obj_t * gauge);
|
||||
*/
|
||||
int16_t lv_gauge_get_value(lv_obj_t * gauge, uint8_t needle);
|
||||
|
||||
/**
|
||||
* Get the text of a gauge
|
||||
* @param gauge pointer to gauge
|
||||
* @return the set text. (not with the current value)
|
||||
*/
|
||||
const char * lv_gauge_get_text(lv_obj_t * gauge);
|
||||
|
||||
/**
|
||||
* Get which value is more critical (lower or higher)
|
||||
* @param gauge pointer to a gauge object
|
||||
@@ -177,12 +123,11 @@ const char * lv_gauge_get_text(lv_obj_t * gauge);
|
||||
bool lv_gauge_get_low_critical(lv_obj_t * gauge);
|
||||
|
||||
/**
|
||||
* Return with a pointer to a built-in style and/or copy it to a variable
|
||||
* @param style a style name from lv_gauges_builtin_t enum
|
||||
* @param copy copy the style to this variable. (NULL if unused)
|
||||
* @return pointer to an lv_gauges_t style
|
||||
* Get the critical style of the gauge
|
||||
* @param gauge pointer to a gauge object
|
||||
* @return pointer to the critical style
|
||||
*/
|
||||
lv_gauges_t * lv_gauges_get(lv_gauges_builtin_t style, lv_gauges_t * copy);
|
||||
lv_style_t * lv_gauge_get_style_critical(lv_obj_t * gauge);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
144
lv_objx/lv_img.c
144
lv_objx/lv_img.c
@@ -16,7 +16,7 @@
|
||||
#include "misc/fs/ufs/ufs.h"
|
||||
|
||||
#if LV_IMG_ENABLE_SYMBOLS != 0
|
||||
#include "../lv_misc/text.h"
|
||||
#include "misc/gfx/text.h"
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
@@ -31,16 +31,12 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_img_design(lv_obj_t * img, const area_t * mask, lv_design_mode_t mode);
|
||||
static void lv_imgs_init(void);
|
||||
|
||||
static bool lv_img_is_symbol(const char * txt);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_imgs_t lv_imgs_def;
|
||||
static lv_imgs_t lv_imgs_light;
|
||||
static lv_imgs_t lv_imgs_dark;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
@@ -53,7 +49,7 @@ static lv_imgs_t lv_imgs_dark;
|
||||
/**
|
||||
* Create an image objects
|
||||
* @param par pointer to an object, it will be the parent of the new button
|
||||
* @param copy pointer to a rectangle object, if not NULL then the new object will be copied from it
|
||||
* @param copy pointer to a image object, if not NULL then the new object will be copied from it
|
||||
* @return pointer to the created image
|
||||
*/
|
||||
lv_obj_t * lv_img_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
@@ -72,6 +68,7 @@ lv_obj_t * lv_img_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->h = lv_obj_get_height(new_img);
|
||||
ext->transp = 0;
|
||||
ext->upscale = 0;
|
||||
ext->auto_size = 1;
|
||||
|
||||
/*Init the new object*/
|
||||
lv_obj_set_signal_f(new_img, lv_img_signal);
|
||||
@@ -83,10 +80,13 @@ lv_obj_t * lv_img_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
* and must be screen sized*/
|
||||
if(par != NULL) ext->auto_size = 1;
|
||||
else ext->auto_size = 0;
|
||||
lv_obj_set_style(new_img, lv_imgs_get(LV_IMGS_DEF, NULL));
|
||||
if(par != NULL) lv_obj_set_style(new_img, NULL); /*Inherit the style by default*/
|
||||
else lv_obj_set_style(new_img, lv_style_get(LV_STYLE_PLAIN, NULL)); /*Set style for screens*/
|
||||
} else {
|
||||
ext->auto_size = lv_img_get_auto_size(copy);
|
||||
lv_img_set_file(new_img, LV_EA(copy, lv_img_ext_t)->fn);
|
||||
lv_img_ext_t * copy_ext = lv_obj_get_ext(copy);
|
||||
ext->auto_size = copy_ext->auto_size;
|
||||
ext->upscale = copy_ext->upscale;
|
||||
lv_img_set_file(new_img, copy_ext->fn);
|
||||
|
||||
/*Refresh the style with new signal function*/
|
||||
lv_obj_refr_style(new_img);
|
||||
@@ -111,59 +111,21 @@ bool lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param)
|
||||
/* The object can be deleted so check its validity and then
|
||||
* make the object specific signal handling */
|
||||
if(valid != false) {
|
||||
lv_img_ext_t * img_p = lv_obj_get_ext(img);
|
||||
switch(sign) {
|
||||
case LV_SIGNAL_CLEANUP:
|
||||
dm_free(img_p->fn);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
lv_img_ext_t * ext = lv_obj_get_ext(img);
|
||||
if(sign == LV_SIGNAL_CLEANUP) {
|
||||
dm_free(ext->fn);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||
/*Refresh the file name to refresh the symbol text size*/
|
||||
if(lv_img_is_symbol(ext->fn) != false) {
|
||||
lv_img_set_file(img, ext->fn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return with a pointer to built-in style and/or copy it to a variable
|
||||
* @param style a style name from lv_imgs_builtin_t enum
|
||||
* @param copy copy the style to this variable. (NULL if unused)
|
||||
* @return pointer to an lv_imgs_t style
|
||||
*/
|
||||
lv_imgs_t * lv_imgs_get(lv_imgs_builtin_t style, lv_imgs_t * copy)
|
||||
{
|
||||
static bool style_inited = false;
|
||||
|
||||
/*Make the style initialization if it is not done yet*/
|
||||
if(style_inited == false) {
|
||||
lv_imgs_init();
|
||||
style_inited = true;
|
||||
}
|
||||
|
||||
lv_imgs_t * style_p;
|
||||
|
||||
switch(style) {
|
||||
case LV_IMGS_DEF:
|
||||
style_p = &lv_imgs_def;
|
||||
break;
|
||||
case LV_IMGS_LIGHT:
|
||||
style_p = &lv_imgs_light;
|
||||
break;
|
||||
case LV_IMGS_DARK:
|
||||
style_p = &lv_imgs_dark;
|
||||
break;
|
||||
default:
|
||||
style_p = &lv_imgs_def;
|
||||
}
|
||||
|
||||
if(copy != NULL) {
|
||||
if(style_p != NULL) memcpy(copy, style_p, sizeof(lv_imgs_t));
|
||||
else memcpy(copy, &lv_imgs_def, sizeof(lv_imgs_t));
|
||||
}
|
||||
|
||||
return style_p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a file to the RAMFS from a picture data
|
||||
* @param fn file name of the new file (e.g. "pic1", will be available at "U:/pic1")
|
||||
@@ -209,6 +171,7 @@ void lv_img_set_file(lv_obj_t * img, const char * fn)
|
||||
header.w = lv_obj_get_width(img);
|
||||
header.h = lv_obj_get_height(img);
|
||||
header.transp = 0;
|
||||
header.cd = 0;
|
||||
}
|
||||
|
||||
fs_close(&file);
|
||||
@@ -217,20 +180,22 @@ void lv_img_set_file(lv_obj_t * img, const char * fn)
|
||||
ext->h = header.h;
|
||||
ext->transp = header.transp;
|
||||
|
||||
#if LV_ANTIALIAS != 0
|
||||
if(ext->upscale != 0) {
|
||||
ext->w *= 2;
|
||||
ext->h *= 2;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/*Handle symbol texts*/
|
||||
else {
|
||||
#if LV_IMG_ENABLE_SYMBOLS
|
||||
lv_imgs_t * imgs = lv_obj_get_style(img);
|
||||
lv_style_t * style = lv_obj_get_style(img);
|
||||
point_t size;
|
||||
txt_get_size(&size, fn, font_get(imgs->sym_font), 0, 0, LV_CORD_MAX, TXT_FLAG_NONE);
|
||||
txt_get_size(&size, fn, style->font, style->letter_space, style->line_space, CORD_MAX, TXT_FLAG_NONE);
|
||||
ext->w = size.x;
|
||||
ext->h = size.y;
|
||||
ext->transp = 0;
|
||||
ext->transp = 1; /*Symbols always have transparent parts*/
|
||||
#else
|
||||
/*Never goes here, just to be sure handle this */
|
||||
ext->w = lv_obj_get_width(img);
|
||||
@@ -240,13 +205,8 @@ void lv_img_set_file(lv_obj_t * img, const char * fn)
|
||||
|
||||
}
|
||||
|
||||
if(ext->upscale != 0) {
|
||||
ext->w *= LV_DOWNSCALE;
|
||||
ext->h *= LV_DOWNSCALE;
|
||||
}
|
||||
|
||||
if(fn != NULL) {
|
||||
ext->fn = dm_realloc(ext->fn, strlen(fn) + 1);
|
||||
ext->fn = dm_realloc(ext->fn, strlen(fn) + 1);
|
||||
strcpy(ext->fn, fn);
|
||||
} else {
|
||||
ext->fn = NULL;
|
||||
@@ -283,7 +243,11 @@ void lv_img_set_auto_size(lv_obj_t * img, bool en)
|
||||
void lv_img_set_upscale(lv_obj_t * img, bool en)
|
||||
{
|
||||
lv_img_ext_t * ext = lv_obj_get_ext(img);
|
||||
|
||||
|
||||
/*Upscale works only if antialiassing is enabled*/
|
||||
#if LV_ANTIALIAS == 0
|
||||
en = false;
|
||||
#endif
|
||||
ext->upscale = (en == false ? 0 : 1);
|
||||
|
||||
/*Refresh the image with the new size*/
|
||||
@@ -333,33 +297,23 @@ bool lv_img_get_upscale(lv_obj_t * img)
|
||||
*/
|
||||
static bool lv_img_design(lv_obj_t * img, const area_t * mask, lv_design_mode_t mode)
|
||||
{
|
||||
lv_imgs_t * imgs_p = lv_obj_get_style(img);
|
||||
lv_style_t * style = lv_obj_get_style(img);
|
||||
lv_img_ext_t * ext = lv_obj_get_ext(img);
|
||||
|
||||
if(mode == LV_DESIGN_COVER_CHK) {
|
||||
if(ext->transp == 0) {
|
||||
bool cover;
|
||||
cover = area_is_in(mask, &img->cords);
|
||||
return cover;
|
||||
}
|
||||
else return false;
|
||||
bool cover = false;
|
||||
if(ext->transp == 0) cover = area_is_in(mask, &img->cords);
|
||||
return cover;
|
||||
|
||||
} else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
if(ext->h == 0 || ext->w == 0) return true;
|
||||
area_t cords;
|
||||
/*Create a default style for symbol texts*/
|
||||
#if LV_IMG_ENABLE_SYMBOLS != 0
|
||||
bool sym = lv_img_is_symbol(ext->fn);
|
||||
lv_labels_t sym_style;
|
||||
lv_labels_get(LV_LABELS_DEF, &sym_style);
|
||||
sym_style.font = imgs_p->sym_font;
|
||||
sym_style.letter_space = 0;
|
||||
sym_style.line_space = 0;
|
||||
sym_style.mid = 0;
|
||||
sym_style.objs.color = imgs_p->objs.color;
|
||||
#endif
|
||||
|
||||
lv_obj_get_cords(img, &cords);
|
||||
opa_t opa = lv_obj_get_opa(img);
|
||||
|
||||
area_t cords_tmp;
|
||||
cords_tmp.y1 = cords.y1;
|
||||
@@ -371,10 +325,10 @@ static bool lv_img_design(lv_obj_t * img, const area_t * mask, lv_design_mode_t
|
||||
for(; cords_tmp.x1 < cords.x2; cords_tmp.x1 += ext->w, cords_tmp.x2 += ext->w) {
|
||||
|
||||
#if LV_IMG_ENABLE_SYMBOLS == 0
|
||||
lv_draw_img(&cords_tmp, mask, imgs_p, opa, ext->fn);
|
||||
lv_draw_img(&cords_tmp, mask, style, opa, ext->fn);
|
||||
#else
|
||||
if(sym == false) lv_draw_img(&cords_tmp, mask, imgs_p, opa, ext->fn);
|
||||
else lv_draw_label(&cords_tmp, mask, &sym_style, opa, ext->fn, TXT_FLAG_NONE);
|
||||
if(sym == false) lv_draw_img(&cords_tmp, mask, style, ext->fn);
|
||||
else lv_draw_label(&cords_tmp, mask, style, ext->fn, TXT_FLAG_NONE);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -397,6 +351,8 @@ static bool lv_img_is_symbol(const char * txt)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
if(txt == NULL) return false;
|
||||
|
||||
/* if txt begins with an upper case letter then it refers to a driver
|
||||
* so it is a file name*/
|
||||
if(txt[0] >= 'A' && txt[0] <= 'Z') return false;
|
||||
@@ -405,25 +361,5 @@ static bool lv_img_is_symbol(const char * txt)
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the image styles
|
||||
*/
|
||||
static void lv_imgs_init(void)
|
||||
{
|
||||
/*Default style*/
|
||||
lv_imgs_def.objs.color = COLOR_BLACK;
|
||||
lv_imgs_def.recolor_opa = OPA_TRANSP;
|
||||
#if LV_IMG_ENABLE_SYMBOLS != 0
|
||||
lv_imgs_def.sym_font = LV_IMG_DEF_SYMBOL_FONT;
|
||||
#endif
|
||||
/*Dark style*/
|
||||
memcpy(&lv_imgs_dark, &lv_imgs_def, sizeof(lv_imgs_t));
|
||||
lv_imgs_dark.objs.color = COLOR_BLACK; lv_imgs_dark.recolor_opa = OPA_50;
|
||||
|
||||
/*Light style*/
|
||||
memcpy(&lv_imgs_light, &lv_imgs_dark, sizeof(lv_imgs_t));
|
||||
lv_imgs_light.objs.color = COLOR_WHITE; lv_imgs_light.recolor_opa = OPA_50;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user