mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-31 16:27:03 +08:00
chore(format) add formatting for examples & demos, merge test config
This commit is contained in:
+124
-116
@@ -56,7 +56,7 @@ typedef struct {
|
|||||||
uint32_t fps_normal;
|
uint32_t fps_normal;
|
||||||
uint32_t fps_opa;
|
uint32_t fps_opa;
|
||||||
uint8_t weight;
|
uint8_t weight;
|
||||||
}scene_dsc_t;
|
} scene_dsc_t;
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC PROTOTYPES
|
* STATIC PROTOTYPES
|
||||||
@@ -528,65 +528,65 @@ static void sub_text_cb(void)
|
|||||||
* STATIC VARIABLES
|
* STATIC VARIABLES
|
||||||
**********************/
|
**********************/
|
||||||
static scene_dsc_t scenes[] = {
|
static scene_dsc_t scenes[] = {
|
||||||
{.name = "Rectangle", .weight = 30, .create_cb = rectangle_cb},
|
{.name = "Rectangle", .weight = 30, .create_cb = rectangle_cb},
|
||||||
{.name = "Rectangle rounded", .weight = 20, .create_cb = rectangle_rounded_cb},
|
{.name = "Rectangle rounded", .weight = 20, .create_cb = rectangle_rounded_cb},
|
||||||
{.name = "Circle", .weight = 10, .create_cb = rectangle_circle_cb},
|
{.name = "Circle", .weight = 10, .create_cb = rectangle_circle_cb},
|
||||||
{.name = "Border", .weight = 20, .create_cb = border_cb},
|
{.name = "Border", .weight = 20, .create_cb = border_cb},
|
||||||
{.name = "Border rounded", .weight = 30, .create_cb = border_rounded_cb},
|
{.name = "Border rounded", .weight = 30, .create_cb = border_rounded_cb},
|
||||||
{.name = "Circle border", .weight = 10, .create_cb = border_circle_cb},
|
{.name = "Circle border", .weight = 10, .create_cb = border_circle_cb},
|
||||||
{.name = "Border top", .weight = 3, .create_cb = border_top_cb},
|
{.name = "Border top", .weight = 3, .create_cb = border_top_cb},
|
||||||
{.name = "Border left", .weight = 3, .create_cb = border_left_cb},
|
{.name = "Border left", .weight = 3, .create_cb = border_left_cb},
|
||||||
{.name = "Border top + left", .weight = 3, .create_cb = border_top_left_cb},
|
{.name = "Border top + left", .weight = 3, .create_cb = border_top_left_cb},
|
||||||
{.name = "Border left + right", .weight = 3, .create_cb = border_left_right_cb},
|
{.name = "Border left + right", .weight = 3, .create_cb = border_left_right_cb},
|
||||||
{.name = "Border top + bottom", .weight = 3, .create_cb = border_top_bottom_cb},
|
{.name = "Border top + bottom", .weight = 3, .create_cb = border_top_bottom_cb},
|
||||||
|
|
||||||
{.name = "Shadow small", .weight = 3, .create_cb = shadow_small_cb},
|
{.name = "Shadow small", .weight = 3, .create_cb = shadow_small_cb},
|
||||||
{.name = "Shadow small offset", .weight = 5, .create_cb = shadow_small_ofs_cb},
|
{.name = "Shadow small offset", .weight = 5, .create_cb = shadow_small_ofs_cb},
|
||||||
{.name = "Shadow large", .weight = 5, .create_cb = shadow_large_cb},
|
{.name = "Shadow large", .weight = 5, .create_cb = shadow_large_cb},
|
||||||
{.name = "Shadow large offset", .weight = 3, .create_cb = shadow_large_ofs_cb},
|
{.name = "Shadow large offset", .weight = 3, .create_cb = shadow_large_ofs_cb},
|
||||||
|
|
||||||
{.name = "Image RGB", .weight = 20, .create_cb = img_rgb_cb},
|
{.name = "Image RGB", .weight = 20, .create_cb = img_rgb_cb},
|
||||||
{.name = "Image ARGB", .weight = 20, .create_cb = img_argb_cb},
|
{.name = "Image ARGB", .weight = 20, .create_cb = img_argb_cb},
|
||||||
{.name = "Image chorma keyed", .weight = 5, .create_cb = img_ckey_cb},
|
{.name = "Image chorma keyed", .weight = 5, .create_cb = img_ckey_cb},
|
||||||
{.name = "Image indexed", .weight = 5, .create_cb = img_index_cb},
|
{.name = "Image indexed", .weight = 5, .create_cb = img_index_cb},
|
||||||
{.name = "Image alpha only", .weight = 5, .create_cb = img_alpha_cb},
|
{.name = "Image alpha only", .weight = 5, .create_cb = img_alpha_cb},
|
||||||
|
|
||||||
{.name = "Image RGB recolor", .weight = 5, .create_cb = img_rgb_recolor_cb},
|
{.name = "Image RGB recolor", .weight = 5, .create_cb = img_rgb_recolor_cb},
|
||||||
{.name = "Image ARGB recolor", .weight = 20, .create_cb = img_argb_recolor_cb},
|
{.name = "Image ARGB recolor", .weight = 20, .create_cb = img_argb_recolor_cb},
|
||||||
{.name = "Image chorma keyed recolor", .weight = 3, .create_cb = img_ckey_recolor_cb},
|
{.name = "Image chorma keyed recolor", .weight = 3, .create_cb = img_ckey_recolor_cb},
|
||||||
{.name = "Image indexed recolor", .weight = 3, .create_cb = img_index_recolor_cb},
|
{.name = "Image indexed recolor", .weight = 3, .create_cb = img_index_recolor_cb},
|
||||||
|
|
||||||
{.name = "Image RGB rotate", .weight = 3, .create_cb = img_rgb_rot_cb},
|
{.name = "Image RGB rotate", .weight = 3, .create_cb = img_rgb_rot_cb},
|
||||||
{.name = "Image RGB rotate anti aliased", .weight = 3, .create_cb = img_rgb_rot_aa_cb},
|
{.name = "Image RGB rotate anti aliased", .weight = 3, .create_cb = img_rgb_rot_aa_cb},
|
||||||
{.name = "Image ARGB rotate", .weight = 5, .create_cb = img_argb_rot_cb},
|
{.name = "Image ARGB rotate", .weight = 5, .create_cb = img_argb_rot_cb},
|
||||||
{.name = "Image ARGB rotate anti aliased", .weight = 5, .create_cb = img_argb_rot_aa_cb},
|
{.name = "Image ARGB rotate anti aliased", .weight = 5, .create_cb = img_argb_rot_aa_cb},
|
||||||
{.name = "Image RGB zoom", .weight = 3, .create_cb = img_rgb_zoom_cb},
|
{.name = "Image RGB zoom", .weight = 3, .create_cb = img_rgb_zoom_cb},
|
||||||
{.name = "Image RGB zoom anti aliased", .weight = 3, .create_cb = img_rgb_zoom_aa_cb},
|
{.name = "Image RGB zoom anti aliased", .weight = 3, .create_cb = img_rgb_zoom_aa_cb},
|
||||||
{.name = "Image ARGB zoom", .weight = 5, .create_cb = img_argb_zoom_cb},
|
{.name = "Image ARGB zoom", .weight = 5, .create_cb = img_argb_zoom_cb},
|
||||||
{.name = "Image ARGB zoom anti aliased", .weight = 5, .create_cb = img_argb_zoom_aa_cb},
|
{.name = "Image ARGB zoom anti aliased", .weight = 5, .create_cb = img_argb_zoom_aa_cb},
|
||||||
|
|
||||||
{.name = "Text small", .weight = 20, .create_cb = txt_small_cb},
|
{.name = "Text small", .weight = 20, .create_cb = txt_small_cb},
|
||||||
{.name = "Text medium", .weight = 30, .create_cb = txt_medium_cb},
|
{.name = "Text medium", .weight = 30, .create_cb = txt_medium_cb},
|
||||||
{.name = "Text large", .weight = 20, .create_cb = txt_large_cb},
|
{.name = "Text large", .weight = 20, .create_cb = txt_large_cb},
|
||||||
|
|
||||||
{.name = "Text small compressed", .weight = 3, .create_cb = txt_small_compr_cb},
|
{.name = "Text small compressed", .weight = 3, .create_cb = txt_small_compr_cb},
|
||||||
{.name = "Text medium compressed", .weight = 5, .create_cb = txt_medium_compr_cb},
|
{.name = "Text medium compressed", .weight = 5, .create_cb = txt_medium_compr_cb},
|
||||||
{.name = "Text large compressed", .weight = 10, .create_cb = txt_large_compr_cb},
|
{.name = "Text large compressed", .weight = 10, .create_cb = txt_large_compr_cb},
|
||||||
|
|
||||||
{.name = "Line", .weight = 10, .create_cb = line_cb},
|
{.name = "Line", .weight = 10, .create_cb = line_cb},
|
||||||
|
|
||||||
{.name = "Arc think", .weight = 10, .create_cb = arc_think_cb},
|
{.name = "Arc think", .weight = 10, .create_cb = arc_think_cb},
|
||||||
{.name = "Arc thick", .weight = 10, .create_cb = arc_thick_cb},
|
{.name = "Arc thick", .weight = 10, .create_cb = arc_thick_cb},
|
||||||
|
|
||||||
{.name = "Substr. rectangle", .weight = 10, .create_cb = sub_rectangle_cb},
|
{.name = "Substr. rectangle", .weight = 10, .create_cb = sub_rectangle_cb},
|
||||||
{.name = "Substr. border", .weight = 10, .create_cb = sub_border_cb},
|
{.name = "Substr. border", .weight = 10, .create_cb = sub_border_cb},
|
||||||
{.name = "Substr. shadow", .weight = 10, .create_cb = sub_shadow_cb},
|
{.name = "Substr. shadow", .weight = 10, .create_cb = sub_shadow_cb},
|
||||||
{.name = "Substr. image", .weight = 10, .create_cb = sub_img_cb},
|
{.name = "Substr. image", .weight = 10, .create_cb = sub_img_cb},
|
||||||
{.name = "Substr. line", .weight = 10, .create_cb = sub_line_cb},
|
{.name = "Substr. line", .weight = 10, .create_cb = sub_line_cb},
|
||||||
{.name = "Substr. arc", .weight = 10, .create_cb = sub_arc_cb},
|
{.name = "Substr. arc", .weight = 10, .create_cb = sub_arc_cb},
|
||||||
{.name = "Substr. text", .weight = 10, .create_cb = sub_text_cb},
|
{.name = "Substr. text", .weight = 10, .create_cb = sub_text_cb},
|
||||||
|
|
||||||
{.name = "", .create_cb = NULL}
|
{.name = "", .create_cb = NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int32_t scene_act = -1;
|
static int32_t scene_act = -1;
|
||||||
@@ -597,22 +597,22 @@ static uint32_t rnd_act;
|
|||||||
|
|
||||||
|
|
||||||
static uint32_t rnd_map[] = {
|
static uint32_t rnd_map[] = {
|
||||||
0xbd13204f, 0x67d8167f, 0x20211c99, 0xb0a7cc05,
|
0xbd13204f, 0x67d8167f, 0x20211c99, 0xb0a7cc05,
|
||||||
0x06d5c703, 0xeafb01a7, 0xd0473b5c, 0xc999aaa2,
|
0x06d5c703, 0xeafb01a7, 0xd0473b5c, 0xc999aaa2,
|
||||||
0x86f9d5d9, 0x294bdb29, 0x12a3c207, 0x78914d14,
|
0x86f9d5d9, 0x294bdb29, 0x12a3c207, 0x78914d14,
|
||||||
0x10a30006, 0x6134c7db, 0x194443af, 0x142d1099,
|
0x10a30006, 0x6134c7db, 0x194443af, 0x142d1099,
|
||||||
0x376292d5, 0x20f433c5, 0x074d2a59, 0x4e74c293,
|
0x376292d5, 0x20f433c5, 0x074d2a59, 0x4e74c293,
|
||||||
0x072a0810, 0xdd0f136d, 0x5cca6dbc, 0x623bfdd8,
|
0x072a0810, 0xdd0f136d, 0x5cca6dbc, 0x623bfdd8,
|
||||||
0xb645eb2f, 0xbe50894a, 0xc9b56717, 0xe0f912c8,
|
0xb645eb2f, 0xbe50894a, 0xc9b56717, 0xe0f912c8,
|
||||||
0x4f6b5e24, 0xfe44b128, 0xe12d57a8, 0x9b15c9cc,
|
0x4f6b5e24, 0xfe44b128, 0xe12d57a8, 0x9b15c9cc,
|
||||||
0xab2ae1d3, 0xb4dc5074, 0x67d457c8, 0x8e46b00c,
|
0xab2ae1d3, 0xb4dc5074, 0x67d457c8, 0x8e46b00c,
|
||||||
0xa29a1871, 0xcee40332, 0x80f93aa1, 0x85286096,
|
0xa29a1871, 0xcee40332, 0x80f93aa1, 0x85286096,
|
||||||
0x09bd6b49, 0x95072088, 0x2093924b, 0x6a27328f,
|
0x09bd6b49, 0x95072088, 0x2093924b, 0x6a27328f,
|
||||||
0xa796079b, 0xc3b488bc, 0xe29bcce0, 0x07048a4c,
|
0xa796079b, 0xc3b488bc, 0xe29bcce0, 0x07048a4c,
|
||||||
0x7d81bd99, 0x27aacb30, 0x44fc7a0e, 0xa2382241,
|
0x7d81bd99, 0x27aacb30, 0x44fc7a0e, 0xa2382241,
|
||||||
0x8357a17d, 0x97e9c9cc, 0xad10ff52, 0x9923fc5c,
|
0x8357a17d, 0x97e9c9cc, 0xad10ff52, 0x9923fc5c,
|
||||||
0x8f2c840a, 0x20356ba2, 0x7997a677, 0x9a7f1800,
|
0x8f2c840a, 0x20356ba2, 0x7997a677, 0x9a7f1800,
|
||||||
0x35c7562b, 0xd901fe51, 0x8f4e053d, 0xa5b94923,
|
0x35c7562b, 0xd901fe51, 0x8f4e053d, 0xa5b94923,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
@@ -662,12 +662,13 @@ static void monitor_cb(lv_disp_drv_t * drv, uint32_t time, uint32_t px)
|
|||||||
if(opa_mode) {
|
if(opa_mode) {
|
||||||
scenes[scene_act].refr_cnt_opa ++;
|
scenes[scene_act].refr_cnt_opa ++;
|
||||||
scenes[scene_act].time_sum_opa += time;
|
scenes[scene_act].time_sum_opa += time;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
scenes[scene_act].refr_cnt_normal ++;
|
scenes[scene_act].refr_cnt_normal ++;
|
||||||
scenes[scene_act].time_sum_normal += time;
|
scenes[scene_act].time_sum_normal += time;
|
||||||
}
|
}
|
||||||
|
|
||||||
// lv_obj_invalidate(lv_scr_act());
|
// lv_obj_invalidate(lv_scr_act());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void scene_next_task_cb(lv_timer_t * timer)
|
static void scene_next_task_cb(lv_timer_t * timer)
|
||||||
@@ -680,24 +681,31 @@ static void scene_next_task_cb(lv_timer_t * timer)
|
|||||||
if(scenes[scene_act].time_sum_opa == 0) scenes[scene_act].time_sum_opa = 1;
|
if(scenes[scene_act].time_sum_opa == 0) scenes[scene_act].time_sum_opa = 1;
|
||||||
scenes[scene_act].fps_opa = (1000 * scenes[scene_act].refr_cnt_opa) / scenes[scene_act].time_sum_opa;
|
scenes[scene_act].fps_opa = (1000 * scenes[scene_act].refr_cnt_opa) / scenes[scene_act].time_sum_opa;
|
||||||
if(scenes[scene_act].create_cb) scene_act++; /*If still there are scenes go to the next*/
|
if(scenes[scene_act].create_cb) scene_act++; /*If still there are scenes go to the next*/
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
scene_act ++;
|
scene_act ++;
|
||||||
}
|
}
|
||||||
opa_mode = false;
|
opa_mode = false;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if(scenes[scene_act].time_sum_normal == 0) scenes[scene_act].time_sum_normal = 1;
|
if(scenes[scene_act].time_sum_normal == 0) scenes[scene_act].time_sum_normal = 1;
|
||||||
scenes[scene_act].fps_normal = (1000 * scenes[scene_act].refr_cnt_normal) / scenes[scene_act].time_sum_normal;
|
scenes[scene_act].fps_normal = (1000 * scenes[scene_act].refr_cnt_normal) / scenes[scene_act].time_sum_normal;
|
||||||
opa_mode = true;
|
opa_mode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(scenes[scene_act].create_cb) {
|
if(scenes[scene_act].create_cb) {
|
||||||
lv_label_set_text_fmt(title, "%"LV_PRId32"/%d: %s%s", scene_act * 2 + (opa_mode ? 1 : 0), (sizeof(scenes) / sizeof(scene_dsc_t) * 2) - 2, scenes[scene_act].name, opa_mode ? " + opa" : "");
|
lv_label_set_text_fmt(title, "%"LV_PRId32"/%d: %s%s", scene_act * 2 + (opa_mode ? 1 : 0),
|
||||||
|
(sizeof(scenes) / sizeof(scene_dsc_t) * 2) - 2, scenes[scene_act].name, opa_mode ? " + opa" : "");
|
||||||
if(opa_mode) {
|
if(opa_mode) {
|
||||||
lv_label_set_text_fmt(subtitle, "Result of \"%s\": %"LV_PRId32" FPS", scenes[scene_act].name, scenes[scene_act].fps_normal);
|
lv_label_set_text_fmt(subtitle, "Result of \"%s\": %"LV_PRId32" FPS", scenes[scene_act].name,
|
||||||
} else {
|
scenes[scene_act].fps_normal);
|
||||||
|
}
|
||||||
|
else {
|
||||||
if(scene_act > 0) {
|
if(scene_act > 0) {
|
||||||
lv_label_set_text_fmt(subtitle, "Result of \"%s + opa\": %"LV_PRId32" FPS", scenes[scene_act - 1].name, scenes[scene_act - 1].fps_opa);
|
lv_label_set_text_fmt(subtitle, "Result of \"%s + opa\": %"LV_PRId32" FPS", scenes[scene_act - 1].name,
|
||||||
} else {
|
scenes[scene_act - 1].fps_opa);
|
||||||
|
}
|
||||||
|
else {
|
||||||
lv_label_set_text(subtitle, "");
|
lv_label_set_text(subtitle, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -750,41 +758,41 @@ static void scene_next_task_cb(lv_timer_t * timer)
|
|||||||
|
|
||||||
lv_coord_t w = lv_obj_get_content_width(lv_scr_act());
|
lv_coord_t w = lv_obj_get_content_width(lv_scr_act());
|
||||||
lv_obj_t * table = lv_table_create(lv_scr_act());
|
lv_obj_t * table = lv_table_create(lv_scr_act());
|
||||||
// lv_obj_clean_style_list(table, LV_PART_MAIN);
|
// lv_obj_clean_style_list(table, LV_PART_MAIN);
|
||||||
lv_table_set_col_cnt(table, 2);
|
lv_table_set_col_cnt(table, 2);
|
||||||
|
|
||||||
lv_table_set_col_width(table, 0, (w * 3) / 4 - 3);
|
lv_table_set_col_width(table, 0, (w * 3) / 4 - 3);
|
||||||
lv_table_set_col_width(table, 1, w / 4 - 3);
|
lv_table_set_col_width(table, 1, w / 4 - 3);
|
||||||
lv_obj_set_width(table, lv_pct(100));
|
lv_obj_set_width(table, lv_pct(100));
|
||||||
|
|
||||||
// static lv_style_t style_cell_slow;
|
// static lv_style_t style_cell_slow;
|
||||||
// static lv_style_t style_cell_very_slow;
|
// static lv_style_t style_cell_very_slow;
|
||||||
// static lv_style_t style_cell_title;
|
// static lv_style_t style_cell_title;
|
||||||
//
|
//
|
||||||
// lv_style_init(&style_cell_title);
|
// lv_style_init(&style_cell_title);
|
||||||
// lv_style_set_bg_color(&style_cell_title, LV_STATE_DEFAULT, lv_palette_main(LV_PALETTE_GREY));
|
// lv_style_set_bg_color(&style_cell_title, LV_STATE_DEFAULT, lv_palette_main(LV_PALETTE_GREY));
|
||||||
// lv_style_set_bg_opa(&style_cell_title, LV_STATE_DEFAULT, LV_OPA_50);
|
// lv_style_set_bg_opa(&style_cell_title, LV_STATE_DEFAULT, LV_OPA_50);
|
||||||
//
|
//
|
||||||
// lv_style_init(&style_cell_slow);
|
// lv_style_init(&style_cell_slow);
|
||||||
// lv_style_set_text_color(&style_cell_slow, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
|
// lv_style_set_text_color(&style_cell_slow, LV_STATE_DEFAULT, LV_COLOR_ORANGE);
|
||||||
//
|
//
|
||||||
// lv_style_init(&style_cell_very_slow);
|
// lv_style_init(&style_cell_very_slow);
|
||||||
// lv_style_set_text_color(&style_cell_very_slow, LV_STATE_DEFAULT, lv_palette_main(LV_PALETTE_RED));
|
// lv_style_set_text_color(&style_cell_very_slow, LV_STATE_DEFAULT, lv_palette_main(LV_PALETTE_RED));
|
||||||
|
|
||||||
// lv_obj_add_style(table, LV_TABLE_PART_CELL2, &style_cell_slow);
|
// lv_obj_add_style(table, LV_TABLE_PART_CELL2, &style_cell_slow);
|
||||||
// lv_obj_add_style(table, LV_TABLE_PART_CELL3, &style_cell_very_slow);
|
// lv_obj_add_style(table, LV_TABLE_PART_CELL3, &style_cell_very_slow);
|
||||||
// lv_obj_add_style(table, LV_TABLE_PART_CELL4, &style_cell_title);
|
// lv_obj_add_style(table, LV_TABLE_PART_CELL4, &style_cell_title);
|
||||||
|
|
||||||
|
|
||||||
uint16_t row = 0;
|
uint16_t row = 0;
|
||||||
lv_table_add_cell_ctrl(table, row, 0, LV_TABLE_CELL_CTRL_MERGE_RIGHT);
|
lv_table_add_cell_ctrl(table, row, 0, LV_TABLE_CELL_CTRL_MERGE_RIGHT);
|
||||||
lv_table_set_cell_value(table, row, 0, "Slow but common cases");
|
lv_table_set_cell_value(table, row, 0, "Slow but common cases");
|
||||||
// lv_table_set_cell_type(table, row, 0, 4);
|
// lv_table_set_cell_type(table, row, 0, 4);
|
||||||
|
|
||||||
LV_LOG("\r\n"
|
LV_LOG("\r\n"
|
||||||
"LVGL v%d.%d.%d " LVGL_VERSION_INFO
|
"LVGL v%d.%d.%d " LVGL_VERSION_INFO
|
||||||
" Benchmark (in csv format)\r\n",
|
" Benchmark (in csv format)\r\n",
|
||||||
LVGL_VERSION_MAJOR, LVGL_VERSION_MINOR, LVGL_VERSION_PATCH);
|
LVGL_VERSION_MAJOR, LVGL_VERSION_MINOR, LVGL_VERSION_PATCH);
|
||||||
|
|
||||||
row++;
|
row++;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
@@ -796,27 +804,27 @@ static void scene_next_task_cb(lv_timer_t * timer)
|
|||||||
lv_snprintf(buf, sizeof(buf), "%"LV_PRIu32, scenes[i].fps_normal);
|
lv_snprintf(buf, sizeof(buf), "%"LV_PRIu32, scenes[i].fps_normal);
|
||||||
lv_table_set_cell_value(table, row, 1, buf);
|
lv_table_set_cell_value(table, row, 1, buf);
|
||||||
|
|
||||||
// lv_table_set_cell_type(table, row, 0, 2);
|
// lv_table_set_cell_type(table, row, 0, 2);
|
||||||
// lv_table_set_cell_type(table, row, 1, 2);
|
// lv_table_set_cell_type(table, row, 1, 2);
|
||||||
|
|
||||||
LV_LOG("%s,%s\r\n", scenes[i].name, buf);
|
LV_LOG("%s,%s\r\n", scenes[i].name, buf);
|
||||||
|
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(scenes[i].fps_opa < 20 && LV_MAX(scenes[i].weight / 2, 1) >= 10) {
|
if(scenes[i].fps_opa < 20 && LV_MAX(scenes[i].weight / 2, 1) >= 10) {
|
||||||
lv_snprintf(buf, sizeof(buf), "%s + opa", scenes[i].name);
|
lv_snprintf(buf, sizeof(buf), "%s + opa", scenes[i].name);
|
||||||
lv_table_set_cell_value(table, row, 0, buf);
|
lv_table_set_cell_value(table, row, 0, buf);
|
||||||
|
|
||||||
LV_LOG("%s,", buf);
|
LV_LOG("%s,", buf);
|
||||||
|
|
||||||
lv_snprintf(buf, sizeof(buf), "%"LV_PRIu32, scenes[i].fps_opa);
|
lv_snprintf(buf, sizeof(buf), "%"LV_PRIu32, scenes[i].fps_opa);
|
||||||
lv_table_set_cell_value(table, row, 1, buf);
|
lv_table_set_cell_value(table, row, 1, buf);
|
||||||
|
|
||||||
// lv_table_set_cell_type(table, row, 0, 2);
|
// lv_table_set_cell_type(table, row, 0, 2);
|
||||||
// lv_table_set_cell_type(table, row, 1, 2);
|
// lv_table_set_cell_type(table, row, 1, 2);
|
||||||
LV_LOG("%s\r\n", buf);
|
LV_LOG("%s\r\n", buf);
|
||||||
|
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -830,7 +838,7 @@ static void scene_next_task_cb(lv_timer_t * timer)
|
|||||||
|
|
||||||
lv_table_add_cell_ctrl(table, row, 0, LV_TABLE_CELL_CTRL_MERGE_RIGHT);
|
lv_table_add_cell_ctrl(table, row, 0, LV_TABLE_CELL_CTRL_MERGE_RIGHT);
|
||||||
lv_table_set_cell_value(table, row, 0, "All cases");
|
lv_table_set_cell_value(table, row, 0, "All cases");
|
||||||
// lv_table_set_cell_type(table, row, 0, 4);
|
// lv_table_set_cell_type(table, row, 0, 4);
|
||||||
row++;
|
row++;
|
||||||
|
|
||||||
for(i = 0; i < sizeof(scenes) / sizeof(scene_dsc_t) - 1; i++) {
|
for(i = 0; i < sizeof(scenes) / sizeof(scene_dsc_t) - 1; i++) {
|
||||||
@@ -840,14 +848,14 @@ static void scene_next_task_cb(lv_timer_t * timer)
|
|||||||
lv_table_set_cell_value(table, row, 1, buf);
|
lv_table_set_cell_value(table, row, 1, buf);
|
||||||
|
|
||||||
if(scenes[i].fps_normal < 10) {
|
if(scenes[i].fps_normal < 10) {
|
||||||
// lv_table_set_cell_type(table, row, 0, 3);
|
// lv_table_set_cell_type(table, row, 0, 3);
|
||||||
// lv_table_set_cell_type(table, row, 1, 3);
|
// lv_table_set_cell_type(table, row, 1, 3);
|
||||||
}
|
}
|
||||||
else if(scenes[i].fps_normal < 20) {
|
else if(scenes[i].fps_normal < 20) {
|
||||||
// lv_table_set_cell_type(table, row, 0, 2);
|
// lv_table_set_cell_type(table, row, 0, 2);
|
||||||
// lv_table_set_cell_type(table, row, 1, 2);
|
// lv_table_set_cell_type(table, row, 1, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
LV_LOG("%s,%s\r\n", scenes[i].name, buf);
|
LV_LOG("%s,%s\r\n", scenes[i].name, buf);
|
||||||
|
|
||||||
row++;
|
row++;
|
||||||
@@ -856,26 +864,26 @@ static void scene_next_task_cb(lv_timer_t * timer)
|
|||||||
lv_table_set_cell_value(table, row, 0, buf);
|
lv_table_set_cell_value(table, row, 0, buf);
|
||||||
|
|
||||||
LV_LOG("%s,", buf);
|
LV_LOG("%s,", buf);
|
||||||
|
|
||||||
lv_snprintf(buf, sizeof(buf), "%"LV_PRIu32, scenes[i].fps_opa);
|
lv_snprintf(buf, sizeof(buf), "%"LV_PRIu32, scenes[i].fps_opa);
|
||||||
lv_table_set_cell_value(table, row, 1, buf);
|
lv_table_set_cell_value(table, row, 1, buf);
|
||||||
|
|
||||||
|
|
||||||
if(scenes[i].fps_opa < 10) {
|
if(scenes[i].fps_opa < 10) {
|
||||||
// lv_table_set_cell_type(table, row, 0, 3);
|
// lv_table_set_cell_type(table, row, 0, 3);
|
||||||
// lv_table_set_cell_type(table, row, 1, 3);
|
// lv_table_set_cell_type(table, row, 1, 3);
|
||||||
}
|
}
|
||||||
else if(scenes[i].fps_opa < 20) {
|
else if(scenes[i].fps_opa < 20) {
|
||||||
// lv_table_set_cell_type(table, row, 0, 2);
|
// lv_table_set_cell_type(table, row, 0, 2);
|
||||||
// lv_table_set_cell_type(table, row, 1, 2);
|
// lv_table_set_cell_type(table, row, 1, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
LV_LOG("%s\r\n", buf);
|
LV_LOG("%s\r\n", buf);
|
||||||
|
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// lv_page_set_scrl_layout(page, LV_LAYOUT_COLUMN_LEFT);
|
// lv_page_set_scrl_layout(page, LV_LAYOUT_COLUMN_LEFT);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ static void ta_event_cb(lv_event_t * e);
|
|||||||
/**********************
|
/**********************
|
||||||
* STATIC VARIABLES
|
* STATIC VARIABLES
|
||||||
**********************/
|
**********************/
|
||||||
static lv_group_t* g;
|
static lv_group_t * g;
|
||||||
static lv_obj_t * tv;
|
static lv_obj_t * tv;
|
||||||
static lv_obj_t * t1;
|
static lv_obj_t * t1;
|
||||||
static lv_obj_t * t2;
|
static lv_obj_t * t2;
|
||||||
@@ -49,18 +49,18 @@ void lv_demo_keypad_encoder(void)
|
|||||||
g = lv_group_create();
|
g = lv_group_create();
|
||||||
lv_group_set_default(g);
|
lv_group_set_default(g);
|
||||||
|
|
||||||
lv_indev_t* cur_drv = NULL;
|
lv_indev_t * cur_drv = NULL;
|
||||||
for (;;) {
|
for(;;) {
|
||||||
cur_drv = lv_indev_get_next(cur_drv);
|
cur_drv = lv_indev_get_next(cur_drv);
|
||||||
if (!cur_drv) {
|
if(!cur_drv) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cur_drv->driver->type == LV_INDEV_TYPE_KEYPAD) {
|
if(cur_drv->driver->type == LV_INDEV_TYPE_KEYPAD) {
|
||||||
lv_indev_set_group(cur_drv, g);
|
lv_indev_set_group(cur_drv, g);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cur_drv->driver->type == LV_INDEV_TYPE_ENCODER) {
|
if(cur_drv->driver->type == LV_INDEV_TYPE_ENCODER) {
|
||||||
lv_indev_set_group(cur_drv, g);
|
lv_indev_set_group(cur_drv, g);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ static void text_input_create(lv_obj_t * parent)
|
|||||||
lv_textarea_set_one_line(ta2, true);
|
lv_textarea_set_one_line(ta2, true);
|
||||||
lv_textarea_set_placeholder_text(ta2, "Type something");
|
lv_textarea_set_placeholder_text(ta2, "Type something");
|
||||||
|
|
||||||
lv_obj_t *kb = lv_keyboard_create(lv_scr_act());
|
lv_obj_t * kb = lv_keyboard_create(lv_scr_act());
|
||||||
lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
||||||
|
|
||||||
lv_obj_add_event_cb(ta1, ta_event_cb, LV_EVENT_ALL, kb);
|
lv_obj_add_event_cb(ta1, ta_event_cb, LV_EVENT_ALL, kb);
|
||||||
|
|||||||
+5
-5
@@ -16,23 +16,23 @@ extern "C" {
|
|||||||
#include "../lvgl.h"
|
#include "../lvgl.h"
|
||||||
|
|
||||||
#if LV_USE_DEMO_WIDGETS
|
#if LV_USE_DEMO_WIDGETS
|
||||||
#include "widgets/lv_demo_widgets.h"
|
#include "widgets/lv_demo_widgets.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_DEMO_BENCHMARK
|
#if LV_USE_DEMO_BENCHMARK
|
||||||
#include "benchmark/lv_demo_benchmark.h"
|
#include "benchmark/lv_demo_benchmark.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_DEMO_STRESS
|
#if LV_USE_DEMO_STRESS
|
||||||
#include "stress/lv_demo_stress.h"
|
#include "stress/lv_demo_stress.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_DEMO_KEYPAD_AND_ENCODER
|
#if LV_USE_DEMO_KEYPAD_AND_ENCODER
|
||||||
#include "keypad_encoder/lv_demo_keypad_encoder.h"
|
#include "keypad_encoder/lv_demo_keypad_encoder.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_USE_DEMO_MUSIC
|
#if LV_USE_DEMO_MUSIC
|
||||||
#include "music/lv_demo_music.h"
|
#include "music/lv_demo_music.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
|
|||||||
+80
-80
@@ -25,7 +25,7 @@
|
|||||||
* STATIC PROTOTYPES
|
* STATIC PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
#if LV_DEMO_MUSIC_AUTO_PLAY
|
#if LV_DEMO_MUSIC_AUTO_PLAY
|
||||||
static void auto_step_cb(lv_timer_t * timer);
|
static void auto_step_cb(lv_timer_t * timer);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
@@ -87,20 +87,20 @@ static const char * genre_list[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const uint32_t time_list[] = {
|
static const uint32_t time_list[] = {
|
||||||
1*60 + 14,
|
1 * 60 + 14,
|
||||||
2*60 + 26,
|
2 * 60 + 26,
|
||||||
1*60 + 54,
|
1 * 60 + 54,
|
||||||
2*60 + 24,
|
2 * 60 + 24,
|
||||||
2*60 + 37,
|
2 * 60 + 37,
|
||||||
3*60 + 33,
|
3 * 60 + 33,
|
||||||
1*60 + 56,
|
1 * 60 + 56,
|
||||||
3*60 + 31,
|
3 * 60 + 31,
|
||||||
2*60 + 20,
|
2 * 60 + 20,
|
||||||
2*60 + 19,
|
2 * 60 + 19,
|
||||||
2*60 + 20,
|
2 * 60 + 20,
|
||||||
2*60 + 19,
|
2 * 60 + 19,
|
||||||
2*60 + 20,
|
2 * 60 + 20,
|
||||||
2*60 + 19,
|
2 * 60 + 19,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
@@ -166,84 +166,84 @@ static void auto_step_cb(lv_timer_t * t)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch(state) {
|
switch(state) {
|
||||||
case 5:
|
case 5:
|
||||||
_lv_demo_music_album_next(true);
|
_lv_demo_music_album_next(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
_lv_demo_music_album_next(true);
|
_lv_demo_music_album_next(true);
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
_lv_demo_music_album_next(true);
|
_lv_demo_music_album_next(true);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
_lv_demo_music_play(0);
|
_lv_demo_music_play(0);
|
||||||
break;
|
break;
|
||||||
#if LV_DEMO_MUSIC_SQUARE || LV_DEMO_MUSIC_ROUND
|
#if LV_DEMO_MUSIC_SQUARE || LV_DEMO_MUSIC_ROUND
|
||||||
case 11:
|
case 11:
|
||||||
lv_obj_scroll_by(ctrl, 0, -LV_VER_RES, LV_ANIM_ON);
|
lv_obj_scroll_by(ctrl, 0, -LV_VER_RES, LV_ANIM_ON);
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
lv_obj_scroll_by(ctrl, 0, -LV_VER_RES, LV_ANIM_ON);
|
lv_obj_scroll_by(ctrl, 0, -LV_VER_RES, LV_ANIM_ON);
|
||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
case 12:
|
case 12:
|
||||||
lv_obj_scroll_by(ctrl, 0, -LV_VER_RES, LV_ANIM_ON);
|
lv_obj_scroll_by(ctrl, 0, -LV_VER_RES, LV_ANIM_ON);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 15:
|
case 15:
|
||||||
lv_obj_scroll_by(list, 0, -300, LV_ANIM_ON);
|
lv_obj_scroll_by(list, 0, -300, LV_ANIM_ON);
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
lv_obj_scroll_by(list, 0, 300, LV_ANIM_ON);
|
lv_obj_scroll_by(list, 0, 300, LV_ANIM_ON);
|
||||||
break;
|
break;
|
||||||
case 18:
|
case 18:
|
||||||
_lv_demo_music_play(1);
|
_lv_demo_music_play(1);
|
||||||
break;
|
break;
|
||||||
case 19:
|
case 19:
|
||||||
lv_obj_scroll_by(ctrl, 0, LV_VER_RES, LV_ANIM_ON);
|
lv_obj_scroll_by(ctrl, 0, LV_VER_RES, LV_ANIM_ON);
|
||||||
break;
|
break;
|
||||||
#if LV_DEMO_MUSIC_SQUARE || LV_DEMO_MUSIC_ROUND
|
#if LV_DEMO_MUSIC_SQUARE || LV_DEMO_MUSIC_ROUND
|
||||||
case 20:
|
case 20:
|
||||||
lv_obj_scroll_by(ctrl, 0, LV_VER_RES, LV_ANIM_ON);
|
lv_obj_scroll_by(ctrl, 0, LV_VER_RES, LV_ANIM_ON);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 30:
|
case 30:
|
||||||
_lv_demo_music_play(2);
|
_lv_demo_music_play(2);
|
||||||
break;
|
break;
|
||||||
case 40: {
|
case 40: {
|
||||||
lv_obj_t * bg = lv_layer_top();
|
lv_obj_t * bg = lv_layer_top();
|
||||||
lv_obj_set_style_bg_color(bg, lv_color_hex(0x6f8af6), 0);
|
lv_obj_set_style_bg_color(bg, lv_color_hex(0x6f8af6), 0);
|
||||||
lv_obj_set_style_text_color(bg, lv_color_white(), 0);
|
lv_obj_set_style_text_color(bg, lv_color_white(), 0);
|
||||||
lv_obj_set_style_bg_opa(bg, LV_OPA_COVER, 0);
|
lv_obj_set_style_bg_opa(bg, LV_OPA_COVER, 0);
|
||||||
lv_obj_fade_in(bg, 400, 0);
|
lv_obj_fade_in(bg, 400, 0);
|
||||||
lv_obj_t * dsc = lv_label_create(bg);
|
lv_obj_t * dsc = lv_label_create(bg);
|
||||||
lv_obj_set_style_text_font(dsc, font_small, 0);
|
lv_obj_set_style_text_font(dsc, font_small, 0);
|
||||||
lv_label_set_text(dsc, "The average FPS is");
|
lv_label_set_text(dsc, "The average FPS is");
|
||||||
lv_obj_align(dsc, LV_ALIGN_TOP_MID, 0, 90);
|
lv_obj_align(dsc, LV_ALIGN_TOP_MID, 0, 90);
|
||||||
|
|
||||||
lv_obj_t * num = lv_label_create(bg);
|
lv_obj_t * num = lv_label_create(bg);
|
||||||
lv_obj_set_style_text_font(num, font_large, 0);
|
lv_obj_set_style_text_font(num, font_large, 0);
|
||||||
#if LV_USE_PERF_MONITOR
|
#if LV_USE_PERF_MONITOR
|
||||||
lv_label_set_text_fmt(num, "%d", lv_refr_get_fps_avg());
|
lv_label_set_text_fmt(num, "%d", lv_refr_get_fps_avg());
|
||||||
#endif
|
#endif
|
||||||
lv_obj_align(num, LV_ALIGN_TOP_MID, 0, 120);
|
lv_obj_align(num, LV_ALIGN_TOP_MID, 0, 120);
|
||||||
|
|
||||||
lv_obj_t * attr = lv_label_create(bg);
|
lv_obj_t * attr = lv_label_create(bg);
|
||||||
lv_obj_set_style_text_align(attr, LV_TEXT_ALIGN_CENTER, 0);
|
lv_obj_set_style_text_align(attr, LV_TEXT_ALIGN_CENTER, 0);
|
||||||
lv_obj_set_style_text_font(attr, font_small, 0);
|
lv_obj_set_style_text_font(attr, font_small, 0);
|
||||||
#if LV_DEMO_MUSIC_SQUARE || LV_DEMO_MUSIC_ROUND
|
#if LV_DEMO_MUSIC_SQUARE || LV_DEMO_MUSIC_ROUND
|
||||||
lv_label_set_text(attr, "Copyright 2020 LVGL Kft.\nwww.lvgl.io | lvgl@lvgl.io");
|
lv_label_set_text(attr, "Copyright 2020 LVGL Kft.\nwww.lvgl.io | lvgl@lvgl.io");
|
||||||
#else
|
#else
|
||||||
lv_label_set_text(attr, "Copyright 2020 LVGL Kft. | www.lvgl.io | lvgl@lvgl.io");
|
lv_label_set_text(attr, "Copyright 2020 LVGL Kft. | www.lvgl.io | lvgl@lvgl.io");
|
||||||
#endif
|
#endif
|
||||||
lv_obj_align(attr, LV_ALIGN_BOTTOM_MID, 0, -10);
|
lv_obj_align(attr, LV_ALIGN_BOTTOM_MID, 0, -10);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 41:
|
case 41:
|
||||||
lv_scr_load(lv_obj_create(NULL));
|
lv_scr_load(lv_obj_create(NULL));
|
||||||
_lv_demo_music_pause();
|
_lv_demo_music_pause();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
state++;
|
state++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ lv_obj_t * _lv_demo_music_list_create(lv_obj_t * parent)
|
|||||||
|
|
||||||
lv_style_init(&style_artist);
|
lv_style_init(&style_artist);
|
||||||
lv_style_set_text_font(&style_artist, font_small);
|
lv_style_set_text_font(&style_artist, font_small);
|
||||||
lv_style_set_text_color(&style_artist,lv_color_hex(0xb1b0be));
|
lv_style_set_text_color(&style_artist, lv_color_hex(0xb1b0be));
|
||||||
|
|
||||||
lv_style_init(&style_time);
|
lv_style_init(&style_time);
|
||||||
lv_style_set_text_font(&style_time, font_medium);
|
lv_style_set_text_font(&style_time, font_medium);
|
||||||
|
|||||||
@@ -23,11 +23,11 @@
|
|||||||
#define BAR_COLOR2 lv_color_hex(0x6f8af6)
|
#define BAR_COLOR2 lv_color_hex(0x6f8af6)
|
||||||
#define BAR_COLOR3 lv_color_hex(0xffffff)
|
#define BAR_COLOR3 lv_color_hex(0xffffff)
|
||||||
#if LV_DEMO_MUSIC_LARGE
|
#if LV_DEMO_MUSIC_LARGE
|
||||||
# define BAR_COLOR1_STOP 160
|
#define BAR_COLOR1_STOP 160
|
||||||
# define BAR_COLOR2_STOP 200
|
#define BAR_COLOR2_STOP 200
|
||||||
#else
|
#else
|
||||||
# define BAR_COLOR1_STOP 80
|
#define BAR_COLOR1_STOP 80
|
||||||
# define BAR_COLOR2_STOP 100
|
#define BAR_COLOR2_STOP 100
|
||||||
#endif
|
#endif
|
||||||
#define BAR_COLOR3_STOP (2 * LV_HOR_RES / 3)
|
#define BAR_COLOR3_STOP (2 * LV_HOR_RES / 3)
|
||||||
#define BAR_CNT 20
|
#define BAR_CNT 20
|
||||||
@@ -82,7 +82,7 @@ static uint32_t bar_ofs = 0;
|
|||||||
static uint32_t spectrum_lane_ofs_start = 0;
|
static uint32_t spectrum_lane_ofs_start = 0;
|
||||||
static uint32_t bar_rot = 0;
|
static uint32_t bar_rot = 0;
|
||||||
static uint32_t time_act;
|
static uint32_t time_act;
|
||||||
static lv_timer_t * sec_counter_timer;
|
static lv_timer_t * sec_counter_timer;
|
||||||
static const lv_font_t * font_small;
|
static const lv_font_t * font_small;
|
||||||
static const lv_font_t * font_large;
|
static const lv_font_t * font_large;
|
||||||
static uint32_t track_id;
|
static uint32_t track_id;
|
||||||
@@ -106,16 +106,18 @@ static const uint16_t rnd_array[30] = {994, 285, 553, 11, 792, 707, 966, 641, 85
|
|||||||
* Callback adapter function to convert parameter types to avoid compile-time
|
* Callback adapter function to convert parameter types to avoid compile-time
|
||||||
* warning.
|
* warning.
|
||||||
*/
|
*/
|
||||||
static void _img_set_zoom_anim_cb(void * obj, int32_t zoom) {
|
static void _img_set_zoom_anim_cb(void * obj, int32_t zoom)
|
||||||
lv_img_set_zoom((lv_obj_t*)obj, (uint16_t)zoom);
|
{
|
||||||
|
lv_img_set_zoom((lv_obj_t *)obj, (uint16_t)zoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Callback adapter function to convert parameter types to avoid compile-time
|
* Callback adapter function to convert parameter types to avoid compile-time
|
||||||
* warning.
|
* warning.
|
||||||
*/
|
*/
|
||||||
static void _obj_set_x_anim_cb(void * obj, int32_t x) {
|
static void _obj_set_x_anim_cb(void * obj, int32_t x)
|
||||||
lv_obj_set_x((lv_obj_t*)obj, (lv_coord_t)x);
|
{
|
||||||
|
lv_obj_set_x((lv_obj_t *)obj, (lv_coord_t)x);
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_obj_t * _lv_demo_music_main_create(lv_obj_t * parent)
|
lv_obj_t * _lv_demo_music_main_create(lv_obj_t * parent)
|
||||||
@@ -145,16 +147,17 @@ lv_obj_t * _lv_demo_music_main_create(lv_obj_t * parent)
|
|||||||
#if LV_DEMO_MUSIC_SQUARE || LV_DEMO_MUSIC_ROUND
|
#if LV_DEMO_MUSIC_SQUARE || LV_DEMO_MUSIC_ROUND
|
||||||
static const lv_coord_t grid_cols[] = {LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
static const lv_coord_t grid_cols[] = {LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
||||||
static lv_coord_t grid_rows[] = {LV_DEMO_MUSIC_HANDLE_SIZE, /*Spacing*/
|
static lv_coord_t grid_rows[] = {LV_DEMO_MUSIC_HANDLE_SIZE, /*Spacing*/
|
||||||
0, /*Spectrum obj, set later*/
|
0, /*Spectrum obj, set later*/
|
||||||
LV_GRID_CONTENT, /*Title box*/
|
LV_GRID_CONTENT, /*Title box*/
|
||||||
LV_GRID_FR(3), /*Spacer*/
|
LV_GRID_FR(3), /*Spacer*/
|
||||||
LV_GRID_CONTENT, /*Icon box*/
|
LV_GRID_CONTENT, /*Icon box*/
|
||||||
LV_GRID_FR(3), /*Spacer*/
|
LV_GRID_FR(3), /*Spacer*/
|
||||||
LV_GRID_CONTENT, /*Control box*/
|
LV_GRID_CONTENT, /*Control box*/
|
||||||
LV_GRID_FR(3), /*Spacer*/
|
LV_GRID_FR(3), /*Spacer*/
|
||||||
LV_GRID_CONTENT, /*Handle box*/
|
LV_GRID_CONTENT, /*Handle box*/
|
||||||
LV_DEMO_MUSIC_HANDLE_SIZE, /*Spacing*/
|
LV_DEMO_MUSIC_HANDLE_SIZE, /*Spacing*/
|
||||||
LV_GRID_TEMPLATE_LAST};
|
LV_GRID_TEMPLATE_LAST
|
||||||
|
};
|
||||||
|
|
||||||
grid_rows[1] = LV_VER_RES;
|
grid_rows[1] = LV_VER_RES;
|
||||||
|
|
||||||
@@ -184,7 +187,8 @@ lv_obj_t * _lv_demo_music_main_create(lv_obj_t * parent)
|
|||||||
LV_GRID_CONTENT, /*Handle box*/
|
LV_GRID_CONTENT, /*Handle box*/
|
||||||
LV_GRID_FR(1), /*Spacer*/
|
LV_GRID_FR(1), /*Spacer*/
|
||||||
LV_DEMO_MUSIC_HANDLE_SIZE, /*Spacing*/
|
LV_DEMO_MUSIC_HANDLE_SIZE, /*Spacing*/
|
||||||
LV_GRID_TEMPLATE_LAST};
|
LV_GRID_TEMPLATE_LAST
|
||||||
|
};
|
||||||
|
|
||||||
lv_obj_set_grid_dsc_array(cont, grid_cols, grid_rows);
|
lv_obj_set_grid_dsc_array(cont, grid_cols, grid_rows);
|
||||||
lv_obj_set_style_grid_row_align(cont, LV_GRID_ALIGN_SPACE_BETWEEN, 0);
|
lv_obj_set_style_grid_row_align(cont, LV_GRID_ALIGN_SPACE_BETWEEN, 0);
|
||||||
@@ -207,7 +211,8 @@ lv_obj_t * _lv_demo_music_main_create(lv_obj_t * parent)
|
|||||||
LV_GRID_CONTENT, /*Handle box*/
|
LV_GRID_CONTENT, /*Handle box*/
|
||||||
LV_GRID_FR(1), /*Spacer*/
|
LV_GRID_FR(1), /*Spacer*/
|
||||||
LV_DEMO_MUSIC_HANDLE_SIZE, /*Spacing*/
|
LV_DEMO_MUSIC_HANDLE_SIZE, /*Spacing*/
|
||||||
LV_GRID_TEMPLATE_LAST};
|
LV_GRID_TEMPLATE_LAST
|
||||||
|
};
|
||||||
|
|
||||||
lv_obj_set_grid_dsc_array(cont, grid_cols, grid_rows);
|
lv_obj_set_grid_dsc_array(cont, grid_cols, grid_rows);
|
||||||
lv_obj_set_style_grid_row_align(cont, LV_GRID_ALIGN_SPACE_BETWEEN, 0);
|
lv_obj_set_style_grid_row_align(cont, LV_GRID_ALIGN_SPACE_BETWEEN, 0);
|
||||||
@@ -292,17 +297,20 @@ void _lv_demo_music_album_next(bool next)
|
|||||||
if(next) {
|
if(next) {
|
||||||
id++;
|
id++;
|
||||||
if(id >= ACTIVE_TRACK_CNT) id = 0;
|
if(id >= ACTIVE_TRACK_CNT) id = 0;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if(id == 0) {
|
if(id == 0) {
|
||||||
id = ACTIVE_TRACK_CNT - 1;
|
id = ACTIVE_TRACK_CNT - 1;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
id--;
|
id--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(playing) {
|
if(playing) {
|
||||||
_lv_demo_music_play(id);
|
_lv_demo_music_play(id);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
track_load(id);
|
track_load(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -381,21 +389,21 @@ static lv_obj_t * create_cont(lv_obj_t * parent)
|
|||||||
lv_obj_t * placeholder1 = lv_obj_create(main_cont);
|
lv_obj_t * placeholder1 = lv_obj_create(main_cont);
|
||||||
lv_obj_remove_style_all(placeholder1);
|
lv_obj_remove_style_all(placeholder1);
|
||||||
lv_obj_clear_flag(placeholder1, LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_clear_flag(placeholder1, LV_OBJ_FLAG_CLICKABLE);
|
||||||
// lv_obj_set_style_bg_color(placeholder1, lv_color_hex(0xff0000), 0);
|
// lv_obj_set_style_bg_color(placeholder1, lv_color_hex(0xff0000), 0);
|
||||||
// lv_obj_set_style_bg_opa(placeholder1, LV_OPA_50, 0);
|
// lv_obj_set_style_bg_opa(placeholder1, LV_OPA_50, 0);
|
||||||
|
|
||||||
lv_obj_t * placeholder2 = lv_obj_create(main_cont);
|
lv_obj_t * placeholder2 = lv_obj_create(main_cont);
|
||||||
lv_obj_remove_style_all(placeholder2);
|
lv_obj_remove_style_all(placeholder2);
|
||||||
lv_obj_clear_flag(placeholder2, LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_clear_flag(placeholder2, LV_OBJ_FLAG_CLICKABLE);
|
||||||
// lv_obj_set_style_bg_color(placeholder2, lv_color_hex(0x00ff00), 0);
|
// lv_obj_set_style_bg_color(placeholder2, lv_color_hex(0x00ff00), 0);
|
||||||
// lv_obj_set_style_bg_opa(placeholder2, LV_OPA_50, 0);
|
// lv_obj_set_style_bg_opa(placeholder2, LV_OPA_50, 0);
|
||||||
|
|
||||||
#if LV_DEMO_MUSIC_SQUARE || LV_DEMO_MUSIC_ROUND
|
#if LV_DEMO_MUSIC_SQUARE || LV_DEMO_MUSIC_ROUND
|
||||||
lv_obj_t * placeholder3 = lv_obj_create(main_cont);
|
lv_obj_t * placeholder3 = lv_obj_create(main_cont);
|
||||||
lv_obj_remove_style_all(placeholder3);
|
lv_obj_remove_style_all(placeholder3);
|
||||||
lv_obj_clear_flag(placeholder3, LV_OBJ_FLAG_CLICKABLE);
|
lv_obj_clear_flag(placeholder3, LV_OBJ_FLAG_CLICKABLE);
|
||||||
// lv_obj_set_style_bg_color(placeholder3, lv_color_hex(0x0000ff), 0);
|
// lv_obj_set_style_bg_color(placeholder3, lv_color_hex(0x0000ff), 0);
|
||||||
// lv_obj_set_style_bg_opa(placeholder3, LV_OPA_20, 0);
|
// lv_obj_set_style_bg_opa(placeholder3, LV_OPA_20, 0);
|
||||||
|
|
||||||
lv_obj_set_size(placeholder1, lv_pct(100), LV_VER_RES);
|
lv_obj_set_size(placeholder1, lv_pct(100), LV_VER_RES);
|
||||||
lv_obj_set_y(placeholder1, 0);
|
lv_obj_set_y(placeholder1, 0);
|
||||||
@@ -423,13 +431,13 @@ static void create_wave_images(lv_obj_t * parent)
|
|||||||
LV_IMG_DECLARE(img_lv_demo_music_wave_top);
|
LV_IMG_DECLARE(img_lv_demo_music_wave_top);
|
||||||
LV_IMG_DECLARE(img_lv_demo_music_wave_bottom);
|
LV_IMG_DECLARE(img_lv_demo_music_wave_bottom);
|
||||||
lv_obj_t * wave_top = lv_img_create(parent);
|
lv_obj_t * wave_top = lv_img_create(parent);
|
||||||
lv_img_set_src(wave_top,&img_lv_demo_music_wave_top);
|
lv_img_set_src(wave_top, &img_lv_demo_music_wave_top);
|
||||||
lv_obj_set_width(wave_top, LV_HOR_RES);
|
lv_obj_set_width(wave_top, LV_HOR_RES);
|
||||||
lv_obj_align(wave_top, LV_ALIGN_TOP_MID, 0, 0);
|
lv_obj_align(wave_top, LV_ALIGN_TOP_MID, 0, 0);
|
||||||
lv_obj_add_flag(wave_top, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
lv_obj_add_flag(wave_top, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
||||||
|
|
||||||
lv_obj_t * wave_bottom = lv_img_create(parent);
|
lv_obj_t * wave_bottom = lv_img_create(parent);
|
||||||
lv_img_set_src(wave_bottom,&img_lv_demo_music_wave_bottom);
|
lv_img_set_src(wave_bottom, &img_lv_demo_music_wave_bottom);
|
||||||
lv_obj_set_width(wave_bottom, LV_HOR_RES);
|
lv_obj_set_width(wave_bottom, LV_HOR_RES);
|
||||||
lv_obj_align(wave_bottom, LV_ALIGN_BOTTOM_MID, 0, 0);
|
lv_obj_align(wave_bottom, LV_ALIGN_BOTTOM_MID, 0, 0);
|
||||||
lv_obj_add_flag(wave_bottom, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
lv_obj_add_flag(wave_bottom, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
||||||
@@ -538,7 +546,7 @@ static lv_obj_t * create_ctrl_box(lv_obj_t * parent)
|
|||||||
#else
|
#else
|
||||||
lv_obj_set_style_pad_bottom(cont, 8, 0);
|
lv_obj_set_style_pad_bottom(cont, 8, 0);
|
||||||
#endif
|
#endif
|
||||||
static const lv_coord_t grid_col[] = {LV_GRID_FR(2), LV_GRID_FR(3),LV_GRID_FR(5), LV_GRID_FR(5), LV_GRID_FR(5), LV_GRID_FR(3), LV_GRID_FR(2), LV_GRID_TEMPLATE_LAST};
|
static const lv_coord_t grid_col[] = {LV_GRID_FR(2), LV_GRID_FR(3), LV_GRID_FR(5), LV_GRID_FR(5), LV_GRID_FR(5), LV_GRID_FR(3), LV_GRID_FR(2), LV_GRID_TEMPLATE_LAST};
|
||||||
static const lv_coord_t grid_row[] = {LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
|
static const lv_coord_t grid_row[] = {LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
|
||||||
lv_obj_set_grid_dsc_array(cont, grid_col, grid_row);
|
lv_obj_set_grid_dsc_array(cont, grid_col, grid_row);
|
||||||
|
|
||||||
@@ -669,13 +677,15 @@ static void track_load(uint32_t id)
|
|||||||
#if LV_DEMO_MUSIC_LANDSCAPE
|
#if LV_DEMO_MUSIC_LANDSCAPE
|
||||||
if(next) {
|
if(next) {
|
||||||
lv_anim_set_values(&a, 0, - LV_HOR_RES / 7);
|
lv_anim_set_values(&a, 0, - LV_HOR_RES / 7);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
lv_anim_set_values(&a, 0, LV_HOR_RES / 7);
|
lv_anim_set_values(&a, 0, LV_HOR_RES / 7);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if(next) {
|
if(next) {
|
||||||
lv_anim_set_values(&a, 0, - LV_HOR_RES / 2);
|
lv_anim_set_values(&a, 0, - LV_HOR_RES / 2);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
lv_anim_set_values(&a, 0, LV_HOR_RES / 2);
|
lv_anim_set_values(&a, 0, LV_HOR_RES / 2);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -768,18 +778,18 @@ static void spectrum_draw_event_cb(lv_event_t * e)
|
|||||||
uint32_t f;
|
uint32_t f;
|
||||||
uint32_t band_w = 0; /*Real number of bars in this band.*/
|
uint32_t band_w = 0; /*Real number of bars in this band.*/
|
||||||
switch(s) {
|
switch(s) {
|
||||||
case 0:
|
case 0:
|
||||||
band_w = 20;
|
band_w = 20;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
band_w = 8;
|
band_w = 8;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
band_w = 4;
|
band_w = 4;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
band_w = 2;
|
band_w = 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add "side bars" with cosine characteristic.*/
|
/* Add "side bars" with cosine characteristic.*/
|
||||||
@@ -799,7 +809,7 @@ static void spectrum_draw_event_cb(lv_event_t * e)
|
|||||||
for(i = 0; i < BAR_CNT; i++) {
|
for(i = 0; i < BAR_CNT; i++) {
|
||||||
uint32_t deg_space = 1;
|
uint32_t deg_space = 1;
|
||||||
uint32_t deg = i * DEG_STEP + 90;
|
uint32_t deg = i * DEG_STEP + 90;
|
||||||
uint32_t j = (i + bar_rot + rnd_array[bar_ofs %10]) % BAR_CNT;
|
uint32_t j = (i + bar_rot + rnd_array[bar_ofs % 10]) % BAR_CNT;
|
||||||
uint32_t k = (i + bar_rot + rnd_array[(bar_ofs + 1) % 10]) % BAR_CNT;
|
uint32_t k = (i + bar_rot + rnd_array[(bar_ofs + 1) % 10]) % BAR_CNT;
|
||||||
|
|
||||||
uint32_t v = (r[k] * animv + r[j] * (amax - animv)) / amax;
|
uint32_t v = (r[k] * animv + r[j] * (amax - animv)) / amax;
|
||||||
@@ -811,8 +821,10 @@ static void spectrum_draw_event_cb(lv_event_t * e)
|
|||||||
|
|
||||||
if(v < BAR_COLOR1_STOP) draw_dsc.bg_color = BAR_COLOR1;
|
if(v < BAR_COLOR1_STOP) draw_dsc.bg_color = BAR_COLOR1;
|
||||||
else if(v > BAR_COLOR3_STOP) draw_dsc.bg_color = BAR_COLOR3;
|
else if(v > BAR_COLOR3_STOP) draw_dsc.bg_color = BAR_COLOR3;
|
||||||
else if(v > BAR_COLOR2_STOP) draw_dsc.bg_color = lv_color_mix(BAR_COLOR3, BAR_COLOR2, ((v - BAR_COLOR2_STOP) * 255) / (BAR_COLOR3_STOP-BAR_COLOR2_STOP));
|
else if(v > BAR_COLOR2_STOP) draw_dsc.bg_color = lv_color_mix(BAR_COLOR3, BAR_COLOR2,
|
||||||
else draw_dsc.bg_color = lv_color_mix(BAR_COLOR2, BAR_COLOR1, ((v - BAR_COLOR1_STOP) * 255) / (BAR_COLOR2_STOP - BAR_COLOR1_STOP));
|
((v - BAR_COLOR2_STOP) * 255) / (BAR_COLOR3_STOP - BAR_COLOR2_STOP));
|
||||||
|
else draw_dsc.bg_color = lv_color_mix(BAR_COLOR2, BAR_COLOR1,
|
||||||
|
((v - BAR_COLOR1_STOP) * 255) / (BAR_COLOR2_STOP - BAR_COLOR1_STOP));
|
||||||
|
|
||||||
uint32_t di = deg + deg_space;
|
uint32_t di = deg + deg_space;
|
||||||
|
|
||||||
@@ -859,7 +871,7 @@ static void spectrum_anim_cb(void * a, int32_t v)
|
|||||||
static int32_t last_bass = -1000;
|
static int32_t last_bass = -1000;
|
||||||
static int32_t dir = 1;
|
static int32_t dir = 1;
|
||||||
if(spectrum[spectrum_i][0] > 12) {
|
if(spectrum[spectrum_i][0] > 12) {
|
||||||
if(spectrum_i-last_bass > 5) {
|
if(spectrum_i - last_bass > 5) {
|
||||||
bass_cnt++;
|
bass_cnt++;
|
||||||
last_bass = spectrum_i;
|
last_bass = spectrum_i;
|
||||||
if(bass_cnt >= 2) {
|
if(bass_cnt >= 2) {
|
||||||
@@ -869,7 +881,7 @@ static void spectrum_anim_cb(void * a, int32_t v)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(spectrum[spectrum_i][0] < 4) bar_rot+= dir;
|
if(spectrum[spectrum_i][0] < 4) bar_rot += dir;
|
||||||
|
|
||||||
lv_img_set_zoom(album_img_obj, LV_IMG_ZOOM_NONE + spectrum[spectrum_i][0]);
|
lv_img_set_zoom(album_img_obj, LV_IMG_ZOOM_NONE + spectrum[spectrum_i][0]);
|
||||||
}
|
}
|
||||||
@@ -891,21 +903,21 @@ static lv_obj_t * album_img_create(lv_obj_t * parent)
|
|||||||
img = lv_img_create(parent);
|
img = lv_img_create(parent);
|
||||||
|
|
||||||
switch(track_id) {
|
switch(track_id) {
|
||||||
case 2:
|
case 2:
|
||||||
lv_img_set_src(img, &img_lv_demo_music_cover_3);
|
lv_img_set_src(img, &img_lv_demo_music_cover_3);
|
||||||
spectrum = spectrum_3;
|
spectrum = spectrum_3;
|
||||||
spectrum_len = sizeof(spectrum_3) / sizeof(spectrum_3[0]);
|
spectrum_len = sizeof(spectrum_3) / sizeof(spectrum_3[0]);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
lv_img_set_src(img, &img_lv_demo_music_cover_2);
|
lv_img_set_src(img, &img_lv_demo_music_cover_2);
|
||||||
spectrum = spectrum_2;
|
spectrum = spectrum_2;
|
||||||
spectrum_len = sizeof(spectrum_2) / sizeof(spectrum_2[0]);
|
spectrum_len = sizeof(spectrum_2) / sizeof(spectrum_2[0]);
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
lv_img_set_src(img, &img_lv_demo_music_cover_1);
|
lv_img_set_src(img, &img_lv_demo_music_cover_1);
|
||||||
spectrum = spectrum_1;
|
spectrum = spectrum_1;
|
||||||
spectrum_len = sizeof(spectrum_1) / sizeof(spectrum_1[0]);
|
spectrum_len = sizeof(spectrum_1) / sizeof(spectrum_1[0]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
lv_img_set_antialias(img, false);
|
lv_img_set_antialias(img, false);
|
||||||
lv_obj_align(img, LV_ALIGN_CENTER, 0, 0);
|
lv_obj_align(img, LV_ALIGN_CENTER, 0, 0);
|
||||||
@@ -929,7 +941,8 @@ static void play_event_click_cb(lv_event_t * e)
|
|||||||
lv_obj_t * obj = lv_event_get_target(e);
|
lv_obj_t * obj = lv_event_get_target(e);
|
||||||
if(lv_obj_has_state(obj, LV_STATE_CHECKED)) {
|
if(lv_obj_has_state(obj, LV_STATE_CHECKED)) {
|
||||||
_lv_demo_music_resume();
|
_lv_demo_music_resume();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
_lv_demo_music_pause();
|
_lv_demo_music_pause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,28 +60,27 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
|||||||
lv_anim_t a;
|
lv_anim_t a;
|
||||||
lv_obj_t * obj;
|
lv_obj_t * obj;
|
||||||
|
|
||||||
// printf("step start: %d\n", state);
|
// printf("step start: %d\n", state);
|
||||||
|
|
||||||
switch(state) {
|
switch(state) {
|
||||||
case -1:
|
case -1: {
|
||||||
{
|
lv_res_t res = lv_mem_test();
|
||||||
lv_res_t res = lv_mem_test();
|
if(res != LV_RES_OK) {
|
||||||
if(res != LV_RES_OK) {
|
LV_LOG_ERROR("Memory integrity error");
|
||||||
LV_LOG_ERROR("Memory integrity error");
|
}
|
||||||
|
|
||||||
|
lv_mem_monitor_t mon;
|
||||||
|
lv_mem_monitor(&mon);
|
||||||
|
|
||||||
|
if(mem_free_start == 0) mem_free_start = mon.free_size;
|
||||||
|
|
||||||
|
LV_LOG_USER("mem leak since start: %d, frag: %3d %%", mem_free_start - mon.free_size, mon.frag_pct);
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_mem_monitor_t mon;
|
|
||||||
lv_mem_monitor(&mon);
|
|
||||||
|
|
||||||
if(mem_free_start == 0) mem_free_start = mon.free_size;
|
|
||||||
|
|
||||||
LV_LOG_USER("mem leak since start: %d, frag: %3d %%", mem_free_start - mon.free_size, mon.frag_pct);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
/* Holder for all object types */
|
/* Holder for all object types */
|
||||||
main_page = lv_obj_create(lv_scr_act());
|
main_page = lv_obj_create(lv_scr_act());
|
||||||
lv_obj_set_size(main_page, LV_HOR_RES / 2 , LV_VER_RES);
|
lv_obj_set_size(main_page, LV_HOR_RES / 2, LV_VER_RES);
|
||||||
lv_obj_set_flex_flow(main_page, LV_FLEX_FLOW_COLUMN);
|
lv_obj_set_flex_flow(main_page, LV_FLEX_FLOW_COLUMN);
|
||||||
|
|
||||||
|
|
||||||
@@ -91,25 +90,24 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
|||||||
lv_label_set_text(obj, "Multi line\n"LV_SYMBOL_OK LV_SYMBOL_CLOSE LV_SYMBOL_WIFI);
|
lv_label_set_text(obj, "Multi line\n"LV_SYMBOL_OK LV_SYMBOL_CLOSE LV_SYMBOL_WIFI);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1: {
|
||||||
{
|
obj = lv_tabview_create(lv_scr_act(), LV_DIR_TOP, 50);
|
||||||
obj = lv_tabview_create(lv_scr_act(), LV_DIR_TOP, 50);
|
lv_obj_set_size(obj, LV_HOR_RES / 2, LV_VER_RES / 2);
|
||||||
lv_obj_set_size(obj, LV_HOR_RES / 2, LV_VER_RES / 2);
|
lv_obj_align(obj, LV_ALIGN_BOTTOM_RIGHT, 0, 0);
|
||||||
lv_obj_align(obj, LV_ALIGN_BOTTOM_RIGHT, 0, 0);
|
lv_obj_t * t = lv_tabview_add_tab(obj, "First");
|
||||||
lv_obj_t * t = lv_tabview_add_tab(obj, "First");
|
|
||||||
|
|
||||||
t = lv_tabview_add_tab(obj, "Second");
|
t = lv_tabview_add_tab(obj, "Second");
|
||||||
lv_obj_t * c = lv_colorwheel_create(t, true);
|
lv_obj_t * c = lv_colorwheel_create(t, true);
|
||||||
lv_obj_set_size(c, 150, 150);
|
lv_obj_set_size(c, 150, 150);
|
||||||
// c = lv_led_create(t, NULL);
|
// c = lv_led_create(t, NULL);
|
||||||
// lv_obj_set_pos(c, 160, 20);
|
// lv_obj_set_pos(c, 160, 20);
|
||||||
t = lv_tabview_add_tab(obj, LV_SYMBOL_EDIT " Edit");
|
t = lv_tabview_add_tab(obj, LV_SYMBOL_EDIT " Edit");
|
||||||
t = lv_tabview_add_tab(obj, LV_SYMBOL_CLOSE);
|
t = lv_tabview_add_tab(obj, LV_SYMBOL_CLOSE);
|
||||||
|
|
||||||
lv_tabview_set_act(obj, 1, LV_ANIM_ON);
|
lv_tabview_set_act(obj, 1, LV_ANIM_ON);
|
||||||
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 5 + 30);
|
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 5 + 30);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
obj = lv_btn_create(main_page);
|
obj = lv_btn_create(main_page);
|
||||||
@@ -148,12 +146,12 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
|||||||
lv_obj_set_style_bg_img_src(obj, LV_SYMBOL_DUMMY"Text from\nstyle", 0);
|
lv_obj_set_style_bg_img_src(obj, LV_SYMBOL_DUMMY"Text from\nstyle", 0);
|
||||||
lv_obj_del_async(obj); /*Delete on next call of `lv_task_handler` (so not now)*/
|
lv_obj_del_async(obj); /*Delete on next call of `lv_task_handler` (so not now)*/
|
||||||
|
|
||||||
// obj = lv_btn_create(main_page);
|
// obj = lv_btn_create(main_page);
|
||||||
// lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
// lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||||
// lv_obj_set_style_bg_img_src(obj, LV_SYMBOL_LEFT);
|
// lv_obj_set_style_bg_img_src(obj, LV_SYMBOL_LEFT);
|
||||||
// lv_obj_set_style_bg_img_opa(obj, LV_OPA_50);
|
// lv_obj_set_style_bg_img_opa(obj, LV_OPA_50);
|
||||||
// lv_obj_set_style_bg_img_tiled(obj, true);
|
// lv_obj_set_style_bg_img_tiled(obj, true);
|
||||||
// lv_obj_scroll_to_view(obj, LV_ANIM_ON);
|
// lv_obj_scroll_to_view(obj, LV_ANIM_ON);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
@@ -184,19 +182,19 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
obj = lv_win_create(lv_scr_act(), 50);
|
obj = lv_win_create(lv_scr_act(), 50);
|
||||||
lv_obj_set_size(obj, LV_HOR_RES / 2, LV_VER_RES / 2);
|
lv_obj_set_size(obj, LV_HOR_RES / 2, LV_VER_RES / 2);
|
||||||
lv_obj_align(obj, LV_ALIGN_BOTTOM_RIGHT, 0, 0);
|
lv_obj_align(obj, LV_ALIGN_BOTTOM_RIGHT, 0, 0);
|
||||||
lv_win_add_title(obj, "Window title");
|
lv_win_add_title(obj, "Window title");
|
||||||
lv_win_add_btn(obj, LV_SYMBOL_CLOSE, 40);
|
lv_win_add_btn(obj, LV_SYMBOL_CLOSE, 40);
|
||||||
lv_win_add_btn(obj, LV_SYMBOL_DOWN, 40);
|
lv_win_add_btn(obj, LV_SYMBOL_DOWN, 40);
|
||||||
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 3 + 5);
|
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 3 + 5);
|
||||||
|
|
||||||
obj = lv_calendar_create(lv_win_get_content(obj));
|
obj = lv_calendar_create(lv_win_get_content(obj));
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
lv_textarea_set_text(ta, "A very very long text which will should make the text area scrollable"
|
lv_textarea_set_text(ta, "A very very long text which will should make the text area scrollable"
|
||||||
"Here area some dummy sentences to be sure the text area will be really scrollable.");
|
"Here area some dummy sentences to be sure the text area will be really scrollable.");
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
obj = lv_keyboard_create(lv_scr_act());
|
obj = lv_keyboard_create(lv_scr_act());
|
||||||
@@ -258,27 +256,26 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
|||||||
lv_textarea_set_one_line(ta, false);
|
lv_textarea_set_one_line(ta, false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 16:
|
case 16: {
|
||||||
{
|
lv_obj_t * tv = lv_tileview_create(lv_scr_act());
|
||||||
lv_obj_t * tv = lv_tileview_create(lv_scr_act());
|
lv_obj_set_size(tv, 200, 200);
|
||||||
lv_obj_set_size(tv, 200, 200);
|
auto_del(tv, LV_DEMO_STRESS_TIME_STEP * 4 + 5);
|
||||||
auto_del(tv, LV_DEMO_STRESS_TIME_STEP * 4 + 5);
|
|
||||||
|
|
||||||
obj = lv_tileview_add_tile(tv, 0, 0, LV_DIR_ALL);
|
obj = lv_tileview_add_tile(tv, 0, 0, LV_DIR_ALL);
|
||||||
obj = lv_label_create(obj);
|
obj = lv_label_create(obj);
|
||||||
lv_label_set_text(obj, "Tile: 0;0");
|
lv_label_set_text(obj, "Tile: 0;0");
|
||||||
|
|
||||||
obj = lv_tileview_add_tile(tv, 0, 1, LV_DIR_ALL);
|
obj = lv_tileview_add_tile(tv, 0, 1, LV_DIR_ALL);
|
||||||
obj = lv_label_create(obj);
|
obj = lv_label_create(obj);
|
||||||
lv_label_set_text(obj, "Tile: 0;1");
|
lv_label_set_text(obj, "Tile: 0;1");
|
||||||
|
|
||||||
obj = lv_tileview_add_tile(tv, 1, 1, LV_DIR_ALL);
|
obj = lv_tileview_add_tile(tv, 1, 1, LV_DIR_ALL);
|
||||||
obj = lv_label_create(obj);
|
obj = lv_label_create(obj);
|
||||||
lv_label_set_text(obj, "Tile: 1;1");
|
lv_label_set_text(obj, "Tile: 1;1");
|
||||||
|
|
||||||
lv_obj_set_tile_id(tv, 1, 1, LV_ANIM_ON);
|
lv_obj_set_tile_id(tv, 1, 1, LV_ANIM_ON);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 18:
|
case 18:
|
||||||
obj = lv_list_create(main_page);
|
obj = lv_list_create(main_page);
|
||||||
@@ -424,7 +421,7 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf("step end: %d\n", state);
|
// printf("step end: %d\n", state);
|
||||||
state ++;
|
state ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+135
-102
@@ -11,7 +11,7 @@
|
|||||||
#if LV_USE_DEMO_WIDGETS
|
#if LV_USE_DEMO_WIDGETS
|
||||||
|
|
||||||
#if LV_MEM_CUSTOM == 0 && LV_MEM_SIZE < (38ul * 1024ul)
|
#if LV_MEM_CUSTOM == 0 && LV_MEM_SIZE < (38ul * 1024ul)
|
||||||
#error Insufficient memory for lv_demo_widgets. Please set LV_MEM_SIZE to at least 38KB (38ul * 1024ul). 48KB is recommended.
|
#error Insufficient memory for lv_demo_widgets. Please set LV_MEM_SIZE to at least 38KB (38ul * 1024ul). 48KB is recommended.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
@@ -25,7 +25,7 @@ typedef enum {
|
|||||||
DISP_SMALL,
|
DISP_SMALL,
|
||||||
DISP_MEDIUM,
|
DISP_MEDIUM,
|
||||||
DISP_LARGE,
|
DISP_LARGE,
|
||||||
}disp_size_t;
|
} disp_size_t;
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC PROTOTYPES
|
* STATIC PROTOTYPES
|
||||||
@@ -35,8 +35,10 @@ static void analytics_create(lv_obj_t * parent);
|
|||||||
static void shop_create(lv_obj_t * parent);
|
static void shop_create(lv_obj_t * parent);
|
||||||
static void color_changer_create(lv_obj_t * parent);
|
static void color_changer_create(lv_obj_t * parent);
|
||||||
|
|
||||||
static lv_obj_t * create_meter_box(lv_obj_t * parent, const char * title, const char * text1, const char * text2, const char * text3);
|
static lv_obj_t * create_meter_box(lv_obj_t * parent, const char * title, const char * text1, const char * text2,
|
||||||
static lv_obj_t * create_shop_item(lv_obj_t * parent, const void * img_src, const char * name, const char * category, const char * price);
|
const char * text3);
|
||||||
|
static lv_obj_t * create_shop_item(lv_obj_t * parent, const void * img_src, const char * name, const char * category,
|
||||||
|
const char * price);
|
||||||
|
|
||||||
static void color_changer_event_cb(lv_event_t * e);
|
static void color_changer_event_cb(lv_event_t * e);
|
||||||
static void color_event_cb(lv_event_t * e);
|
static void color_event_cb(lv_event_t * e);
|
||||||
@@ -114,7 +116,8 @@ void lv_demo_widgets(void)
|
|||||||
#else
|
#else
|
||||||
LV_LOG_WARN("LV_FONT_MONTSERRAT_16 is not enabled for the widgets demo. Using LV_FONT_DEFAULT instead.");
|
LV_LOG_WARN("LV_FONT_MONTSERRAT_16 is not enabled for the widgets demo. Using LV_FONT_DEFAULT instead.");
|
||||||
#endif
|
#endif
|
||||||
} else if(disp_size == DISP_MEDIUM) {
|
}
|
||||||
|
else if(disp_size == DISP_MEDIUM) {
|
||||||
tab_h = 45;
|
tab_h = 45;
|
||||||
#if LV_FONT_MONTSERRAT_20
|
#if LV_FONT_MONTSERRAT_20
|
||||||
font_large = &lv_font_montserrat_20;
|
font_large = &lv_font_montserrat_20;
|
||||||
@@ -126,22 +129,24 @@ void lv_demo_widgets(void)
|
|||||||
#else
|
#else
|
||||||
LV_LOG_WARN("LV_FONT_MONTSERRAT_14 is not enabled for the widgets demo. Using LV_FONT_DEFAULT instead.");
|
LV_LOG_WARN("LV_FONT_MONTSERRAT_14 is not enabled for the widgets demo. Using LV_FONT_DEFAULT instead.");
|
||||||
#endif
|
#endif
|
||||||
} else { /* disp_size == DISP_SMALL */
|
}
|
||||||
|
else { /* disp_size == DISP_SMALL */
|
||||||
tab_h = 45;
|
tab_h = 45;
|
||||||
#if LV_FONT_MONTSERRAT_18
|
#if LV_FONT_MONTSERRAT_18
|
||||||
font_large = &lv_font_montserrat_18;
|
font_large = &lv_font_montserrat_18;
|
||||||
#else
|
#else
|
||||||
LV_LOG_WARN("LV_FONT_MONTSERRAT_18 is not enabled for the widgets demo. Using LV_FONT_DEFAULT instead.");
|
LV_LOG_WARN("LV_FONT_MONTSERRAT_18 is not enabled for the widgets demo. Using LV_FONT_DEFAULT instead.");
|
||||||
#endif
|
#endif
|
||||||
#if LV_FONT_MONTSERRAT_12
|
#if LV_FONT_MONTSERRAT_12
|
||||||
font_normal = &lv_font_montserrat_12;
|
font_normal = &lv_font_montserrat_12;
|
||||||
#else
|
#else
|
||||||
LV_LOG_WARN("LV_FONT_MONTSERRAT_12 is not enabled for the widgets demo. Using LV_FONT_DEFAULT instead.");
|
LV_LOG_WARN("LV_FONT_MONTSERRAT_12 is not enabled for the widgets demo. Using LV_FONT_DEFAULT instead.");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LV_USE_THEME_DEFAULT
|
#if LV_USE_THEME_DEFAULT
|
||||||
lv_theme_default_init(NULL, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), LV_THEME_DEFAULT_DARK, font_normal);
|
lv_theme_default_init(NULL, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), LV_THEME_DEFAULT_DARK,
|
||||||
|
font_normal);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
lv_style_init(&style_text_muted);
|
lv_style_init(&style_text_muted);
|
||||||
@@ -210,7 +215,7 @@ static void profile_create(lv_obj_t * parent)
|
|||||||
|
|
||||||
lv_obj_t * dsc = lv_label_create(panel1);
|
lv_obj_t * dsc = lv_label_create(panel1);
|
||||||
lv_obj_add_style(dsc, &style_text_muted, 0);
|
lv_obj_add_style(dsc, &style_text_muted, 0);
|
||||||
lv_label_set_text(dsc, "This is a short description of me. Take a look at my profile!" );
|
lv_label_set_text(dsc, "This is a short description of me. Take a look at my profile!");
|
||||||
lv_label_set_long_mode(dsc, LV_LABEL_LONG_WRAP);
|
lv_label_set_long_mode(dsc, LV_LABEL_LONG_WRAP);
|
||||||
|
|
||||||
lv_obj_t * email_icn = lv_label_create(panel1);
|
lv_obj_t * email_icn = lv_label_create(panel1);
|
||||||
@@ -325,14 +330,14 @@ static void profile_create(lv_obj_t * parent)
|
|||||||
|
|
||||||
static lv_coord_t grid_2_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
static lv_coord_t grid_2_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
||||||
static lv_coord_t grid_2_row_dsc[] = {
|
static lv_coord_t grid_2_row_dsc[] = {
|
||||||
LV_GRID_CONTENT, /*Title*/
|
LV_GRID_CONTENT, /*Title*/
|
||||||
5, /*Separator*/
|
5, /*Separator*/
|
||||||
LV_GRID_CONTENT, /*Box title*/
|
LV_GRID_CONTENT, /*Box title*/
|
||||||
30, /*Boxes*/
|
30, /*Boxes*/
|
||||||
5, /*Separator*/
|
5, /*Separator*/
|
||||||
LV_GRID_CONTENT, /*Box title*/
|
LV_GRID_CONTENT, /*Box title*/
|
||||||
30, /*Boxes*/
|
30, /*Boxes*/
|
||||||
LV_GRID_TEMPLATE_LAST
|
LV_GRID_TEMPLATE_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -382,27 +387,28 @@ static void profile_create(lv_obj_t * parent)
|
|||||||
/*Create the top panel*/
|
/*Create the top panel*/
|
||||||
static lv_coord_t grid_1_col_dsc[] = {LV_GRID_CONTENT, 1, LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
static lv_coord_t grid_1_col_dsc[] = {LV_GRID_CONTENT, 1, LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
||||||
static lv_coord_t grid_1_row_dsc[] = {
|
static lv_coord_t grid_1_row_dsc[] = {
|
||||||
LV_GRID_CONTENT, /*Name*/
|
LV_GRID_CONTENT, /*Name*/
|
||||||
LV_GRID_CONTENT, /*Description*/
|
LV_GRID_CONTENT, /*Description*/
|
||||||
LV_GRID_CONTENT, /*Email*/
|
LV_GRID_CONTENT, /*Email*/
|
||||||
-20,
|
-20,
|
||||||
LV_GRID_CONTENT, /*Phone*/
|
LV_GRID_CONTENT, /*Phone*/
|
||||||
LV_GRID_CONTENT, /*Buttons*/
|
LV_GRID_CONTENT, /*Buttons*/
|
||||||
LV_GRID_TEMPLATE_LAST};
|
LV_GRID_TEMPLATE_LAST
|
||||||
|
};
|
||||||
|
|
||||||
static lv_coord_t grid_2_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
static lv_coord_t grid_2_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
||||||
static lv_coord_t grid_2_row_dsc[] = {
|
static lv_coord_t grid_2_row_dsc[] = {
|
||||||
LV_GRID_CONTENT, /*Title*/
|
LV_GRID_CONTENT, /*Title*/
|
||||||
5, /*Separator*/
|
5, /*Separator*/
|
||||||
LV_GRID_CONTENT, /*Box title*/
|
LV_GRID_CONTENT, /*Box title*/
|
||||||
40, /*Box*/
|
40, /*Box*/
|
||||||
LV_GRID_CONTENT, /*Box title*/
|
LV_GRID_CONTENT, /*Box title*/
|
||||||
40, /*Box*/
|
40, /*Box*/
|
||||||
LV_GRID_CONTENT, /*Box title*/
|
LV_GRID_CONTENT, /*Box title*/
|
||||||
40, /*Box*/
|
40, /*Box*/
|
||||||
LV_GRID_CONTENT, /*Box title*/
|
LV_GRID_CONTENT, /*Box title*/
|
||||||
40, /*Box*/
|
40, /*Box*/
|
||||||
LV_GRID_TEMPLATE_LAST
|
LV_GRID_TEMPLATE_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -454,29 +460,30 @@ static void profile_create(lv_obj_t * parent)
|
|||||||
/*Create the top panel*/
|
/*Create the top panel*/
|
||||||
static lv_coord_t grid_1_col_dsc[] = {LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
static lv_coord_t grid_1_col_dsc[] = {LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
||||||
static lv_coord_t grid_1_row_dsc[] = {LV_GRID_CONTENT, /*Avatar*/
|
static lv_coord_t grid_1_row_dsc[] = {LV_GRID_CONTENT, /*Avatar*/
|
||||||
LV_GRID_CONTENT, /*Name*/
|
LV_GRID_CONTENT, /*Name*/
|
||||||
LV_GRID_CONTENT, /*Description*/
|
LV_GRID_CONTENT, /*Description*/
|
||||||
LV_GRID_CONTENT, /*Email*/
|
LV_GRID_CONTENT, /*Email*/
|
||||||
LV_GRID_CONTENT, /*Phone number*/
|
LV_GRID_CONTENT, /*Phone number*/
|
||||||
LV_GRID_CONTENT, /*Button1*/
|
LV_GRID_CONTENT, /*Button1*/
|
||||||
LV_GRID_CONTENT, /*Button2*/
|
LV_GRID_CONTENT, /*Button2*/
|
||||||
LV_GRID_TEMPLATE_LAST};
|
LV_GRID_TEMPLATE_LAST
|
||||||
|
};
|
||||||
|
|
||||||
lv_obj_set_grid_dsc_array(panel1, grid_1_col_dsc, grid_1_row_dsc);
|
lv_obj_set_grid_dsc_array(panel1, grid_1_col_dsc, grid_1_row_dsc);
|
||||||
|
|
||||||
|
|
||||||
static lv_coord_t grid_2_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
static lv_coord_t grid_2_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
||||||
static lv_coord_t grid_2_row_dsc[] = {
|
static lv_coord_t grid_2_row_dsc[] = {
|
||||||
LV_GRID_CONTENT, /*Title*/
|
LV_GRID_CONTENT, /*Title*/
|
||||||
5, /*Separator*/
|
5, /*Separator*/
|
||||||
LV_GRID_CONTENT, /*Box title*/
|
LV_GRID_CONTENT, /*Box title*/
|
||||||
40, /*Box*/
|
40, /*Box*/
|
||||||
LV_GRID_CONTENT, /*Box title*/
|
LV_GRID_CONTENT, /*Box title*/
|
||||||
40, /*Box*/
|
40, /*Box*/
|
||||||
LV_GRID_CONTENT, /*Box title*/
|
LV_GRID_CONTENT, /*Box title*/
|
||||||
40, /*Box*/
|
40, /*Box*/
|
||||||
LV_GRID_CONTENT, /*Box title*/
|
LV_GRID_CONTENT, /*Box title*/
|
||||||
40, LV_GRID_TEMPLATE_LAST /*Box*/
|
40, LV_GRID_TEMPLATE_LAST /*Box*/
|
||||||
};
|
};
|
||||||
|
|
||||||
lv_obj_set_grid_dsc_array(panel2, grid_2_col_dsc, grid_2_row_dsc);
|
lv_obj_set_grid_dsc_array(panel2, grid_2_col_dsc, grid_2_row_dsc);
|
||||||
@@ -638,7 +645,7 @@ static void analytics_create(lv_obj_t * parent)
|
|||||||
lv_chart_set_next_value(chart2, ser3, lv_rand(10, 80));
|
lv_chart_set_next_value(chart2, ser3, lv_rand(10, 80));
|
||||||
|
|
||||||
lv_meter_scale_t * scale;
|
lv_meter_scale_t * scale;
|
||||||
lv_meter_indicator_t *indic;
|
lv_meter_indicator_t * indic;
|
||||||
meter1 = create_meter_box(parent, "Monthly Target", "Revenue: 63%", "Sales: 44%", "Costs: 58%");
|
meter1 = create_meter_box(parent, "Monthly Target", "Revenue: 63%", "Sales: 44%", "Costs: 58%");
|
||||||
lv_obj_add_flag(lv_obj_get_parent(meter1), LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
lv_obj_add_flag(lv_obj_get_parent(meter1), LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
||||||
scale = lv_meter_add_scale(meter1);
|
scale = lv_meter_add_scale(meter1);
|
||||||
@@ -715,7 +722,8 @@ static void analytics_create(lv_obj_t * parent)
|
|||||||
lv_meter_set_indicator_start_value(meter3, indic, 0);
|
lv_meter_set_indicator_start_value(meter3, indic, 0);
|
||||||
lv_meter_set_indicator_end_value(meter3, indic, 20);
|
lv_meter_set_indicator_end_value(meter3, indic, 20);
|
||||||
|
|
||||||
indic = lv_meter_add_scale_lines(meter3, scale, lv_palette_darken(LV_PALETTE_RED, 3), lv_palette_darken(LV_PALETTE_RED, 3), true, 0);
|
indic = lv_meter_add_scale_lines(meter3, scale, lv_palette_darken(LV_PALETTE_RED, 3), lv_palette_darken(LV_PALETTE_RED,
|
||||||
|
3), true, 0);
|
||||||
lv_meter_set_indicator_start_value(meter3, indic, 0);
|
lv_meter_set_indicator_start_value(meter3, indic, 0);
|
||||||
lv_meter_set_indicator_end_value(meter3, indic, 20);
|
lv_meter_set_indicator_end_value(meter3, indic, 20);
|
||||||
|
|
||||||
@@ -723,7 +731,8 @@ static void analytics_create(lv_obj_t * parent)
|
|||||||
lv_meter_set_indicator_start_value(meter3, indic, 20);
|
lv_meter_set_indicator_start_value(meter3, indic, 20);
|
||||||
lv_meter_set_indicator_end_value(meter3, indic, 40);
|
lv_meter_set_indicator_end_value(meter3, indic, 40);
|
||||||
|
|
||||||
indic = lv_meter_add_scale_lines(meter3, scale, lv_palette_darken(LV_PALETTE_BLUE, 3), lv_palette_darken(LV_PALETTE_BLUE, 3), true, 0);
|
indic = lv_meter_add_scale_lines(meter3, scale, lv_palette_darken(LV_PALETTE_BLUE, 3),
|
||||||
|
lv_palette_darken(LV_PALETTE_BLUE, 3), true, 0);
|
||||||
lv_meter_set_indicator_start_value(meter3, indic, 20);
|
lv_meter_set_indicator_start_value(meter3, indic, 20);
|
||||||
lv_meter_set_indicator_end_value(meter3, indic, 40);
|
lv_meter_set_indicator_end_value(meter3, indic, 40);
|
||||||
|
|
||||||
@@ -731,7 +740,8 @@ static void analytics_create(lv_obj_t * parent)
|
|||||||
lv_meter_set_indicator_start_value(meter3, indic, 40);
|
lv_meter_set_indicator_start_value(meter3, indic, 40);
|
||||||
lv_meter_set_indicator_end_value(meter3, indic, 60);
|
lv_meter_set_indicator_end_value(meter3, indic, 60);
|
||||||
|
|
||||||
indic = lv_meter_add_scale_lines(meter3, scale, lv_palette_darken(LV_PALETTE_GREEN, 3), lv_palette_darken(LV_PALETTE_GREEN, 3), true, 0);
|
indic = lv_meter_add_scale_lines(meter3, scale, lv_palette_darken(LV_PALETTE_GREEN, 3),
|
||||||
|
lv_palette_darken(LV_PALETTE_GREEN, 3), true, 0);
|
||||||
lv_meter_set_indicator_start_value(meter3, indic, 40);
|
lv_meter_set_indicator_start_value(meter3, indic, 40);
|
||||||
lv_meter_set_indicator_end_value(meter3, indic, 60);
|
lv_meter_set_indicator_end_value(meter3, indic, 60);
|
||||||
|
|
||||||
@@ -758,7 +768,8 @@ static void analytics_create(lv_obj_t * parent)
|
|||||||
lv_obj_set_size(meter1, 200, 200);
|
lv_obj_set_size(meter1, 200, 200);
|
||||||
lv_obj_set_size(meter2, 200, 200);
|
lv_obj_set_size(meter2, 200, 200);
|
||||||
lv_obj_set_size(meter3, 200, 200);
|
lv_obj_set_size(meter3, 200, 200);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
lv_coord_t meter_w = lv_obj_get_width(meter1);
|
lv_coord_t meter_w = lv_obj_get_width(meter1);
|
||||||
lv_obj_set_height(meter1, meter_w);
|
lv_obj_set_height(meter1, meter_w);
|
||||||
lv_obj_set_height(meter2, meter_w);
|
lv_obj_set_height(meter2, meter_w);
|
||||||
@@ -836,13 +847,14 @@ void shop_create(lv_obj_t * parent)
|
|||||||
lv_obj_set_grid_cell(amount, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_START, 3, 1);
|
lv_obj_set_grid_cell(amount, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_START, 3, 1);
|
||||||
lv_obj_set_grid_cell(hint, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_START, 4, 1);
|
lv_obj_set_grid_cell(hint, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_START, 4, 1);
|
||||||
lv_obj_set_grid_cell(chart3, LV_GRID_ALIGN_STRETCH, 1, 1, LV_GRID_ALIGN_STRETCH, 0, 5);
|
lv_obj_set_grid_cell(chart3, LV_GRID_ALIGN_STRETCH, 1, 1, LV_GRID_ALIGN_STRETCH, 0, 5);
|
||||||
} else if(disp_size == DISP_MEDIUM) {
|
}
|
||||||
|
else if(disp_size == DISP_MEDIUM) {
|
||||||
static lv_coord_t grid1_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
static lv_coord_t grid1_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
||||||
static lv_coord_t grid1_row_dsc[] = {
|
static lv_coord_t grid1_row_dsc[] = {
|
||||||
LV_GRID_CONTENT, /*Title + Date*/
|
LV_GRID_CONTENT, /*Title + Date*/
|
||||||
LV_GRID_CONTENT, /*Amount + Hint*/
|
LV_GRID_CONTENT, /*Amount + Hint*/
|
||||||
200, /*Chart*/
|
200, /*Chart*/
|
||||||
LV_GRID_TEMPLATE_LAST
|
LV_GRID_TEMPLATE_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
lv_obj_update_layout(panel1);
|
lv_obj_update_layout(panel1);
|
||||||
@@ -855,15 +867,16 @@ void shop_create(lv_obj_t * parent)
|
|||||||
lv_obj_set_grid_cell(amount, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_CENTER, 1, 1);
|
lv_obj_set_grid_cell(amount, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_CENTER, 1, 1);
|
||||||
lv_obj_set_grid_cell(hint, LV_GRID_ALIGN_START, 1, 1, LV_GRID_ALIGN_CENTER, 1, 1);
|
lv_obj_set_grid_cell(hint, LV_GRID_ALIGN_START, 1, 1, LV_GRID_ALIGN_CENTER, 1, 1);
|
||||||
lv_obj_set_grid_cell(chart3, LV_GRID_ALIGN_END, 0, 2, LV_GRID_ALIGN_STRETCH, 2, 1);
|
lv_obj_set_grid_cell(chart3, LV_GRID_ALIGN_END, 0, 2, LV_GRID_ALIGN_STRETCH, 2, 1);
|
||||||
} else if(disp_size == DISP_SMALL) {
|
}
|
||||||
|
else if(disp_size == DISP_SMALL) {
|
||||||
static lv_coord_t grid1_col_dsc[] = {LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
static lv_coord_t grid1_col_dsc[] = {LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
||||||
static lv_coord_t grid1_row_dsc[] = {
|
static lv_coord_t grid1_row_dsc[] = {
|
||||||
LV_GRID_CONTENT, /*Title*/
|
LV_GRID_CONTENT, /*Title*/
|
||||||
LV_GRID_CONTENT, /*Date*/
|
LV_GRID_CONTENT, /*Date*/
|
||||||
LV_GRID_CONTENT, /*Amount*/
|
LV_GRID_CONTENT, /*Amount*/
|
||||||
LV_GRID_CONTENT, /*Hint*/
|
LV_GRID_CONTENT, /*Hint*/
|
||||||
LV_GRID_CONTENT, /*Chart*/
|
LV_GRID_CONTENT, /*Chart*/
|
||||||
LV_GRID_TEMPLATE_LAST
|
LV_GRID_TEMPLATE_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
lv_obj_set_width(chart3, LV_PCT(95));
|
lv_obj_set_width(chart3, LV_PCT(95));
|
||||||
@@ -883,7 +896,8 @@ void shop_create(lv_obj_t * parent)
|
|||||||
if(disp_size == DISP_SMALL) {
|
if(disp_size == DISP_SMALL) {
|
||||||
lv_obj_add_flag(list, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
lv_obj_add_flag(list, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
||||||
lv_obj_set_height(list, LV_PCT(100));
|
lv_obj_set_height(list, LV_PCT(100));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
lv_obj_set_height(list, LV_PCT(100));
|
lv_obj_set_height(list, LV_PCT(100));
|
||||||
lv_obj_set_style_max_height(list, 300, 0);
|
lv_obj_set_style_max_height(list, 300, 0);
|
||||||
}
|
}
|
||||||
@@ -907,7 +921,8 @@ void shop_create(lv_obj_t * parent)
|
|||||||
if(disp_size == DISP_SMALL) {
|
if(disp_size == DISP_SMALL) {
|
||||||
lv_obj_add_flag(notifications, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
lv_obj_add_flag(notifications, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
||||||
lv_obj_set_height(notifications, LV_PCT(100));
|
lv_obj_set_height(notifications, LV_PCT(100));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
lv_obj_set_height(notifications, LV_PCT(100));
|
lv_obj_set_height(notifications, LV_PCT(100));
|
||||||
lv_obj_set_style_max_height(notifications, 300, 0);
|
lv_obj_set_style_max_height(notifications, 300, 0);
|
||||||
}
|
}
|
||||||
@@ -947,8 +962,9 @@ void shop_create(lv_obj_t * parent)
|
|||||||
static void color_changer_create(lv_obj_t * parent)
|
static void color_changer_create(lv_obj_t * parent)
|
||||||
{
|
{
|
||||||
static lv_palette_t palette[] = {
|
static lv_palette_t palette[] = {
|
||||||
LV_PALETTE_BLUE, LV_PALETTE_GREEN, LV_PALETTE_BLUE_GREY, LV_PALETTE_ORANGE,
|
LV_PALETTE_BLUE, LV_PALETTE_GREEN, LV_PALETTE_BLUE_GREY, LV_PALETTE_ORANGE,
|
||||||
LV_PALETTE_RED, LV_PALETTE_PURPLE, LV_PALETTE_TEAL, _LV_PALETTE_LAST };
|
LV_PALETTE_RED, LV_PALETTE_PURPLE, LV_PALETTE_TEAL, _LV_PALETTE_LAST
|
||||||
|
};
|
||||||
|
|
||||||
lv_obj_t * color_cont = lv_obj_create(parent);
|
lv_obj_t * color_cont = lv_obj_create(parent);
|
||||||
lv_obj_remove_style_all(color_cont);
|
lv_obj_remove_style_all(color_cont);
|
||||||
@@ -987,12 +1003,13 @@ static void color_changer_create(lv_obj_t * parent)
|
|||||||
lv_obj_set_style_bg_img_src(btn, LV_SYMBOL_TINT, 0);
|
lv_obj_set_style_bg_img_src(btn, LV_SYMBOL_TINT, 0);
|
||||||
|
|
||||||
if(disp_size == DISP_SMALL) {
|
if(disp_size == DISP_SMALL) {
|
||||||
lv_obj_set_size(btn, LV_DPX(42), LV_DPX(42));
|
lv_obj_set_size(btn, LV_DPX(42), LV_DPX(42));
|
||||||
lv_obj_align(btn, LV_ALIGN_BOTTOM_RIGHT, -LV_DPX(15), -LV_DPX(15));
|
lv_obj_align(btn, LV_ALIGN_BOTTOM_RIGHT, -LV_DPX(15), -LV_DPX(15));
|
||||||
} else {
|
}
|
||||||
lv_obj_set_size(btn, LV_DPX(50), LV_DPX(50));
|
else {
|
||||||
lv_obj_align(btn, LV_ALIGN_BOTTOM_RIGHT, -LV_DPX(15), -LV_DPX(15));
|
lv_obj_set_size(btn, LV_DPX(50), LV_DPX(50));
|
||||||
}
|
lv_obj_align(btn, LV_ALIGN_BOTTOM_RIGHT, -LV_DPX(15), -LV_DPX(15));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void color_changer_anim_cb(void * var, int32_t v)
|
static void color_changer_anim_cb(void * var, int32_t v)
|
||||||
@@ -1005,7 +1022,8 @@ static void color_changer_anim_cb(void * var, int32_t v)
|
|||||||
w = lv_map(v, 0, 256, LV_DPX(52), max_w);
|
w = lv_map(v, 0, 256, LV_DPX(52), max_w);
|
||||||
lv_obj_set_width(obj, w);
|
lv_obj_set_width(obj, w);
|
||||||
lv_obj_align(obj, LV_ALIGN_BOTTOM_RIGHT, - LV_DPX(10), - LV_DPX(10));
|
lv_obj_align(obj, LV_ALIGN_BOTTOM_RIGHT, - LV_DPX(10), - LV_DPX(10));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
w = lv_map(v, 0, 256, LV_DPX(60), max_w);
|
w = lv_map(v, 0, 256, LV_DPX(60), max_w);
|
||||||
lv_obj_set_width(obj, w);
|
lv_obj_set_width(obj, w);
|
||||||
lv_obj_align(obj, LV_ALIGN_BOTTOM_RIGHT, - LV_DPX(10), - LV_DPX(10));
|
lv_obj_align(obj, LV_ALIGN_BOTTOM_RIGHT, - LV_DPX(10), - LV_DPX(10));
|
||||||
@@ -1020,7 +1038,7 @@ static void color_changer_anim_cb(void * var, int32_t v)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void color_changer_event_cb(lv_event_t *e)
|
static void color_changer_event_cb(lv_event_t * e)
|
||||||
{
|
{
|
||||||
if(lv_event_get_code(e) == LV_EVENT_CLICKED) {
|
if(lv_event_get_code(e) == LV_EVENT_CLICKED) {
|
||||||
lv_obj_t * color_cont = lv_event_get_user_data(e);
|
lv_obj_t * color_cont = lv_event_get_user_data(e);
|
||||||
@@ -1032,7 +1050,8 @@ static void color_changer_event_cb(lv_event_t *e)
|
|||||||
lv_anim_set_values(&a, 0, 256);
|
lv_anim_set_values(&a, 0, 256);
|
||||||
lv_anim_set_time(&a, 200);
|
lv_anim_set_time(&a, 200);
|
||||||
lv_anim_start(&a);
|
lv_anim_start(&a);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
lv_anim_t a;
|
lv_anim_t a;
|
||||||
lv_anim_init(&a);
|
lv_anim_init(&a);
|
||||||
lv_anim_set_var(&a, color_cont);
|
lv_anim_set_var(&a, color_cont);
|
||||||
@@ -1065,7 +1084,8 @@ static void color_event_cb(lv_event_t * e)
|
|||||||
lv_palette_t palette_secondary = (*palette_primary) + 3; /*Use another palette as secondary*/
|
lv_palette_t palette_secondary = (*palette_primary) + 3; /*Use another palette as secondary*/
|
||||||
if(palette_secondary >= _LV_PALETTE_LAST) palette_secondary = 0;
|
if(palette_secondary >= _LV_PALETTE_LAST) palette_secondary = 0;
|
||||||
|
|
||||||
lv_theme_default_init(NULL, lv_palette_main(*palette_primary), lv_palette_main(palette_secondary), LV_THEME_DEFAULT_DARK, font_normal);
|
lv_theme_default_init(NULL, lv_palette_main(*palette_primary), lv_palette_main(palette_secondary),
|
||||||
|
LV_THEME_DEFAULT_DARK, font_normal);
|
||||||
|
|
||||||
lv_color_t color = lv_palette_main(*palette_primary);
|
lv_color_t color = lv_palette_main(*palette_primary);
|
||||||
lv_style_set_text_color(&style_icon, color);
|
lv_style_set_text_color(&style_icon, color);
|
||||||
@@ -1074,7 +1094,8 @@ static void color_event_cb(lv_event_t * e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static lv_obj_t * create_meter_box(lv_obj_t * parent, const char * title, const char * text1, const char * text2, const char * text3)
|
static lv_obj_t * create_meter_box(lv_obj_t * parent, const char * title, const char * text1, const char * text2,
|
||||||
|
const char * text3)
|
||||||
{
|
{
|
||||||
lv_obj_t * cont = lv_obj_create(parent);
|
lv_obj_t * cont = lv_obj_create(parent);
|
||||||
lv_obj_set_height(cont, LV_SIZE_CONTENT);
|
lv_obj_set_height(cont, LV_SIZE_CONTENT);
|
||||||
@@ -1114,7 +1135,7 @@ static lv_obj_t * create_meter_box(lv_obj_t * parent, const char * title, const
|
|||||||
lv_label_set_text(label3, text3);
|
lv_label_set_text(label3, text3);
|
||||||
|
|
||||||
if(disp_size == DISP_MEDIUM) {
|
if(disp_size == DISP_MEDIUM) {
|
||||||
static lv_coord_t grid_col_dsc[] = {LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_CONTENT,LV_GRID_FR(8), LV_GRID_TEMPLATE_LAST};
|
static lv_coord_t grid_col_dsc[] = {LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_CONTENT, LV_GRID_FR(8), LV_GRID_TEMPLATE_LAST};
|
||||||
static lv_coord_t grid_row_dsc[] = {LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
static lv_coord_t grid_row_dsc[] = {LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_CONTENT, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
||||||
|
|
||||||
lv_obj_set_grid_dsc_array(cont, grid_col_dsc, grid_row_dsc);
|
lv_obj_set_grid_dsc_array(cont, grid_col_dsc, grid_row_dsc);
|
||||||
@@ -1146,7 +1167,8 @@ static lv_obj_t * create_meter_box(lv_obj_t * parent, const char * title, const
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static lv_obj_t * create_shop_item(lv_obj_t * parent, const void * img_src, const char * name, const char * category, const char * price)
|
static lv_obj_t * create_shop_item(lv_obj_t * parent, const void * img_src, const char * name, const char * category,
|
||||||
|
const char * price)
|
||||||
{
|
{
|
||||||
static lv_coord_t grid_col_dsc[] = {LV_GRID_CONTENT, 5, LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
static lv_coord_t grid_col_dsc[] = {LV_GRID_CONTENT, 5, LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
||||||
static lv_coord_t grid_row_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
static lv_coord_t grid_row_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
||||||
@@ -1257,9 +1279,10 @@ static void slider_event_cb(lv_event_t * e)
|
|||||||
lv_obj_t * obj = lv_event_get_target(e);
|
lv_obj_t * obj = lv_event_get_target(e);
|
||||||
|
|
||||||
if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) {
|
if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) {
|
||||||
lv_coord_t *s = lv_event_get_param(e);
|
lv_coord_t * s = lv_event_get_param(e);
|
||||||
*s = LV_MAX(*s, 60);
|
*s = LV_MAX(*s, 60);
|
||||||
} else if(code == LV_EVENT_DRAW_PART_END) {
|
}
|
||||||
|
else if(code == LV_EVENT_DRAW_PART_END) {
|
||||||
lv_obj_draw_part_dsc_t * dsc = lv_event_get_param(e);
|
lv_obj_draw_part_dsc_t * dsc = lv_event_get_param(e);
|
||||||
if(dsc->part == LV_PART_KNOB && lv_obj_has_state(obj, LV_STATE_PRESSED)) {
|
if(dsc->part == LV_PART_KNOB && lv_obj_has_state(obj, LV_STATE_PRESSED)) {
|
||||||
char buf[8];
|
char buf[8];
|
||||||
@@ -1310,7 +1333,8 @@ static void chart_event_cb(lv_event_t * e)
|
|||||||
if(lv_chart_get_type(obj) == LV_CHART_TYPE_BAR) {
|
if(lv_chart_get_type(obj) == LV_CHART_TYPE_BAR) {
|
||||||
const char * month[] = {"I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII"};
|
const char * month[] = {"I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII"};
|
||||||
lv_snprintf(dsc->text, dsc->text_length, "%s", month[dsc->value]);
|
lv_snprintf(dsc->text, dsc->text_length, "%s", month[dsc->value]);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
const char * month[] = {"Jan", "Febr", "March", "Apr", "May", "Jun", "July", "Aug", "Sept", "Oct", "Nov", "Dec"};
|
const char * month[] = {"Jan", "Febr", "March", "Apr", "May", "Jun", "July", "Aug", "Sept", "Oct", "Nov", "Dec"};
|
||||||
lv_snprintf(dsc->text, dsc->text_length, "%s", month[dsc->value]);
|
lv_snprintf(dsc->text, dsc->text_length, "%s", month[dsc->value]);
|
||||||
}
|
}
|
||||||
@@ -1322,13 +1346,15 @@ static void chart_event_cb(lv_event_t * e)
|
|||||||
/*Add a line mask that keeps the area below the line*/
|
/*Add a line mask that keeps the area below the line*/
|
||||||
if(dsc->p1 && dsc->p2) {
|
if(dsc->p1 && dsc->p2) {
|
||||||
lv_draw_mask_line_param_t line_mask_param;
|
lv_draw_mask_line_param_t line_mask_param;
|
||||||
lv_draw_mask_line_points_init(&line_mask_param, dsc->p1->x, dsc->p1->y, dsc->p2->x, dsc->p2->y, LV_DRAW_MASK_LINE_SIDE_BOTTOM);
|
lv_draw_mask_line_points_init(&line_mask_param, dsc->p1->x, dsc->p1->y, dsc->p2->x, dsc->p2->y,
|
||||||
|
LV_DRAW_MASK_LINE_SIDE_BOTTOM);
|
||||||
int16_t line_mask_id = lv_draw_mask_add(&line_mask_param, NULL);
|
int16_t line_mask_id = lv_draw_mask_add(&line_mask_param, NULL);
|
||||||
|
|
||||||
/*Add a fade effect: transparent bottom covering top*/
|
/*Add a fade effect: transparent bottom covering top*/
|
||||||
lv_coord_t h = lv_obj_get_height(obj);
|
lv_coord_t h = lv_obj_get_height(obj);
|
||||||
lv_draw_mask_fade_param_t fade_mask_param;
|
lv_draw_mask_fade_param_t fade_mask_param;
|
||||||
lv_draw_mask_fade_init(&fade_mask_param, &obj->coords, LV_OPA_COVER, obj->coords.y1 + h / 8, LV_OPA_TRANSP, obj->coords.y2);
|
lv_draw_mask_fade_init(&fade_mask_param, &obj->coords, LV_OPA_COVER, obj->coords.y1 + h / 8, LV_OPA_TRANSP,
|
||||||
|
obj->coords.y2);
|
||||||
int16_t fade_mask_id = lv_draw_mask_add(&fade_mask_param, NULL);
|
int16_t fade_mask_id = lv_draw_mask_add(&fade_mask_param, NULL);
|
||||||
|
|
||||||
/*Draw a rectangle that will be affected by the mask*/
|
/*Draw a rectangle that will be affected by the mask*/
|
||||||
@@ -1361,7 +1387,8 @@ static void chart_event_cb(lv_event_t * e)
|
|||||||
if(lv_chart_get_type(obj) == LV_CHART_TYPE_LINE) {
|
if(lv_chart_get_type(obj) == LV_CHART_TYPE_LINE) {
|
||||||
dsc->rect_dsc->outline_color = lv_color_white();
|
dsc->rect_dsc->outline_color = lv_color_white();
|
||||||
dsc->rect_dsc->outline_width = 2;
|
dsc->rect_dsc->outline_width = 2;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
dsc->rect_dsc->shadow_color = ser->color;
|
dsc->rect_dsc->shadow_color = ser->color;
|
||||||
dsc->rect_dsc->shadow_width = 15;
|
dsc->rect_dsc->shadow_width = 15;
|
||||||
dsc->rect_dsc->shadow_spread = 0;
|
dsc->rect_dsc->shadow_spread = 0;
|
||||||
@@ -1380,11 +1407,13 @@ static void chart_event_cb(lv_event_t * e)
|
|||||||
if(ser == lv_chart_get_series_next(obj, NULL)) {
|
if(ser == lv_chart_get_series_next(obj, NULL)) {
|
||||||
txt_area.x1 = dsc->draw_area->x1 + lv_area_get_width(dsc->draw_area) / 2;
|
txt_area.x1 = dsc->draw_area->x1 + lv_area_get_width(dsc->draw_area) / 2;
|
||||||
txt_area.x2 = txt_area.x1 + text_size.x;
|
txt_area.x2 = txt_area.x1 + text_size.x;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
txt_area.x2 = dsc->draw_area->x1 + lv_area_get_width(dsc->draw_area) / 2;
|
txt_area.x2 = dsc->draw_area->x1 + lv_area_get_width(dsc->draw_area) / 2;
|
||||||
txt_area.x1 = txt_area.x2 - text_size.x;
|
txt_area.x1 = txt_area.x2 - text_size.x;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
txt_area.x1 = dsc->draw_area->x1 + lv_area_get_width(dsc->draw_area) / 2 - text_size.x / 2;
|
txt_area.x1 = dsc->draw_area->x1 + lv_area_get_width(dsc->draw_area) / 2 - text_size.x / 2;
|
||||||
txt_area.x2 = txt_area.x1 + text_size.x;
|
txt_area.x2 = txt_area.x1 + text_size.x;
|
||||||
txt_area.y2 = dsc->draw_area->y1 - LV_DPX(15);
|
txt_area.y2 = dsc->draw_area->y1 - LV_DPX(15);
|
||||||
@@ -1408,7 +1437,8 @@ static void chart_event_cb(lv_event_t * e)
|
|||||||
label_dsc.color = lv_color_white();
|
label_dsc.color = lv_color_white();
|
||||||
label_dsc.font = font_normal;
|
label_dsc.font = font_normal;
|
||||||
lv_draw_label(dsc->draw_ctx, &label_dsc, &txt_area, buf, NULL);
|
lv_draw_label(dsc->draw_ctx, &label_dsc, &txt_area, buf, NULL);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
dsc->rect_dsc->outline_width = 0;
|
dsc->rect_dsc->outline_width = 0;
|
||||||
dsc->rect_dsc->shadow_width = 0;
|
dsc->rect_dsc->shadow_width = 0;
|
||||||
}
|
}
|
||||||
@@ -1455,15 +1485,15 @@ static void shop_chart_event_cb(lv_event_t * e)
|
|||||||
lv_draw_rect(dsc->draw_ctx, &draw_rect_dsc, &a);
|
lv_draw_rect(dsc->draw_ctx, &draw_rect_dsc, &a);
|
||||||
|
|
||||||
a.y1 = a.y2 - 4; /*-4 to overlap the radius*/
|
a.y1 = a.y2 - 4; /*-4 to overlap the radius*/
|
||||||
a.y2 = a.y1 + (clothes[dsc->id] * h) / 100;
|
a.y2 = a.y1 + (clothes[dsc->id] * h) / 100;
|
||||||
draw_rect_dsc.bg_color = lv_palette_main(LV_PALETTE_BLUE);
|
draw_rect_dsc.bg_color = lv_palette_main(LV_PALETTE_BLUE);
|
||||||
draw_rect_dsc.radius = 0;
|
draw_rect_dsc.radius = 0;
|
||||||
lv_draw_rect( dsc->draw_ctx, &draw_rect_dsc, &a);
|
lv_draw_rect(dsc->draw_ctx, &draw_rect_dsc, &a);
|
||||||
|
|
||||||
a.y1 = a.y2;
|
a.y1 = a.y2;
|
||||||
a.y2 = a.y1 + (services[dsc->id] * h) / 100;
|
a.y2 = a.y1 + (services[dsc->id] * h) / 100;
|
||||||
draw_rect_dsc.bg_color = lv_palette_main(LV_PALETTE_GREEN);
|
draw_rect_dsc.bg_color = lv_palette_main(LV_PALETTE_GREEN);
|
||||||
lv_draw_rect( dsc->draw_ctx, &draw_rect_dsc, &a);
|
lv_draw_rect(dsc->draw_ctx, &draw_rect_dsc, &a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1509,7 +1539,8 @@ static void meter2_timer_cb(lv_timer_t * timer)
|
|||||||
if(down1) {
|
if(down1) {
|
||||||
session_desktop -= 137;
|
session_desktop -= 137;
|
||||||
if(session_desktop < 1400) down1 = false;
|
if(session_desktop < 1400) down1 = false;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
session_desktop += 116;
|
session_desktop += 116;
|
||||||
if(session_desktop > 4500) down1 = true;
|
if(session_desktop > 4500) down1 = true;
|
||||||
}
|
}
|
||||||
@@ -1517,7 +1548,8 @@ static void meter2_timer_cb(lv_timer_t * timer)
|
|||||||
if(down2) {
|
if(down2) {
|
||||||
session_tablet -= 3;
|
session_tablet -= 3;
|
||||||
if(session_tablet < 1400) down2 = false;
|
if(session_tablet < 1400) down2 = false;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
session_tablet += 9;
|
session_tablet += 9;
|
||||||
if(session_tablet > 4500) down2 = true;
|
if(session_tablet > 4500) down2 = true;
|
||||||
}
|
}
|
||||||
@@ -1525,7 +1557,8 @@ static void meter2_timer_cb(lv_timer_t * timer)
|
|||||||
if(down3) {
|
if(down3) {
|
||||||
session_mobile -= 57;
|
session_mobile -= 57;
|
||||||
if(session_mobile < 1400) down3 = false;
|
if(session_mobile < 1400) down3 = false;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
session_mobile += 76;
|
session_mobile += 76;
|
||||||
if(session_mobile > 4500) down3 = true;
|
if(session_mobile > 4500) down3 = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ static void sw_event_cb(lv_event_t * e)
|
|||||||
lv_anim_set_exec_cb(&a, anim_x_cb);
|
lv_anim_set_exec_cb(&a, anim_x_cb);
|
||||||
lv_anim_set_path_cb(&a, lv_anim_path_overshoot);
|
lv_anim_set_path_cb(&a, lv_anim_path_overshoot);
|
||||||
lv_anim_start(&a);
|
lv_anim_start(&a);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
lv_anim_t a;
|
lv_anim_t a;
|
||||||
lv_anim_init(&a);
|
lv_anim_init(&a);
|
||||||
lv_anim_set_var(&a, label);
|
lv_anim_set_var(&a, label);
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ static void anim_x_cb(void * var, int32_t v);
|
|||||||
*/
|
*/
|
||||||
void lv_example_anim_3(void)
|
void lv_example_anim_3(void)
|
||||||
{
|
{
|
||||||
static lv_coord_t col_dsc[] = {LV_GRID_FR(1), 200, LV_GRID_FR(1),LV_GRID_TEMPLATE_LAST};
|
static lv_coord_t col_dsc[] = {LV_GRID_FR(1), 200, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
||||||
static lv_coord_t row_dsc[] = {30, 10, 10, LV_GRID_FR(1),LV_GRID_TEMPLATE_LAST};
|
static lv_coord_t row_dsc[] = {30, 10, 10, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
||||||
|
|
||||||
/*Create a container with grid*/
|
/*Create a container with grid*/
|
||||||
lv_obj_t * cont = lv_obj_create(lv_scr_act());
|
lv_obj_t * cont = lv_obj_create(lv_scr_act());
|
||||||
@@ -53,7 +53,7 @@ void lv_example_anim_3(void)
|
|||||||
lv_anim_init(&ginfo.a);
|
lv_anim_init(&ginfo.a);
|
||||||
lv_anim_set_var(&ginfo.a, ginfo.anim_obj);
|
lv_anim_set_var(&ginfo.a, ginfo.anim_obj);
|
||||||
int32_t end = lv_obj_get_style_width(cont, LV_PART_MAIN) -
|
int32_t end = lv_obj_get_style_width(cont, LV_PART_MAIN) -
|
||||||
lv_obj_get_style_width(ginfo.anim_obj, LV_PART_MAIN) - 10;
|
lv_obj_get_style_width(ginfo.anim_obj, LV_PART_MAIN) - 10;
|
||||||
lv_anim_set_values(&ginfo.a, 5, end);
|
lv_anim_set_values(&ginfo.a, 5, end);
|
||||||
lv_anim_set_time(&ginfo.a, 2000);
|
lv_anim_set_time(&ginfo.a, 2000);
|
||||||
lv_anim_set_exec_cb(&ginfo.a, anim_x_cb);
|
lv_anim_set_exec_cb(&ginfo.a, anim_x_cb);
|
||||||
@@ -124,14 +124,14 @@ static void page_obj_init(lv_obj_t * par)
|
|||||||
lv_obj_set_align(ginfo.anim_obj, LV_ALIGN_TOP_LEFT);
|
lv_obj_set_align(ginfo.anim_obj, LV_ALIGN_TOP_LEFT);
|
||||||
lv_obj_clear_flag(ginfo.anim_obj, LV_OBJ_FLAG_SCROLLABLE);
|
lv_obj_clear_flag(ginfo.anim_obj, LV_OBJ_FLAG_SCROLLABLE);
|
||||||
lv_obj_set_style_bg_color(ginfo.anim_obj, lv_palette_main(LV_PALETTE_RED), LV_PART_MAIN);
|
lv_obj_set_style_bg_color(ginfo.anim_obj, lv_palette_main(LV_PALETTE_RED), LV_PART_MAIN);
|
||||||
lv_obj_set_grid_cell(ginfo.anim_obj, LV_GRID_ALIGN_START, 0, 1,LV_GRID_ALIGN_START, 0, 1);
|
lv_obj_set_grid_cell(ginfo.anim_obj, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_START, 0, 1);
|
||||||
|
|
||||||
ginfo.p1_label = lv_label_create(par);
|
ginfo.p1_label = lv_label_create(par);
|
||||||
ginfo.p2_label = lv_label_create(par);
|
ginfo.p2_label = lv_label_create(par);
|
||||||
lv_label_set_text(ginfo.p1_label, "p1:0");
|
lv_label_set_text(ginfo.p1_label, "p1:0");
|
||||||
lv_label_set_text(ginfo.p2_label, "p2:0");
|
lv_label_set_text(ginfo.p2_label, "p2:0");
|
||||||
lv_obj_set_grid_cell(ginfo.p1_label, LV_GRID_ALIGN_START, 0, 1,LV_GRID_ALIGN_START, 1, 1);
|
lv_obj_set_grid_cell(ginfo.p1_label, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_START, 1, 1);
|
||||||
lv_obj_set_grid_cell(ginfo.p2_label, LV_GRID_ALIGN_START, 0, 1,LV_GRID_ALIGN_START, 2, 1);
|
lv_obj_set_grid_cell(ginfo.p2_label, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_START, 2, 1);
|
||||||
|
|
||||||
ginfo.p1_slider = lv_slider_create(par);
|
ginfo.p1_slider = lv_slider_create(par);
|
||||||
ginfo.p2_slider = lv_slider_create(par);
|
ginfo.p2_slider = lv_slider_create(par);
|
||||||
@@ -141,15 +141,15 @@ static void page_obj_init(lv_obj_t * par)
|
|||||||
lv_obj_set_style_pad_all(ginfo.p2_slider, 2, LV_PART_KNOB);
|
lv_obj_set_style_pad_all(ginfo.p2_slider, 2, LV_PART_KNOB);
|
||||||
lv_obj_add_event_cb(ginfo.p1_slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
|
lv_obj_add_event_cb(ginfo.p1_slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
|
||||||
lv_obj_add_event_cb(ginfo.p2_slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
|
lv_obj_add_event_cb(ginfo.p2_slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
|
||||||
lv_obj_set_grid_cell(ginfo.p1_slider, LV_GRID_ALIGN_STRETCH, 1, 1,LV_GRID_ALIGN_START, 1, 1);
|
lv_obj_set_grid_cell(ginfo.p1_slider, LV_GRID_ALIGN_STRETCH, 1, 1, LV_GRID_ALIGN_START, 1, 1);
|
||||||
lv_obj_set_grid_cell(ginfo.p2_slider, LV_GRID_ALIGN_STRETCH, 1, 1,LV_GRID_ALIGN_START, 2, 1);
|
lv_obj_set_grid_cell(ginfo.p2_slider, LV_GRID_ALIGN_STRETCH, 1, 1, LV_GRID_ALIGN_START, 2, 1);
|
||||||
|
|
||||||
ginfo.run_btn = lv_btn_create(par);
|
ginfo.run_btn = lv_btn_create(par);
|
||||||
lv_obj_add_event_cb(ginfo.run_btn, run_btn_event_handler, LV_EVENT_CLICKED, NULL);
|
lv_obj_add_event_cb(ginfo.run_btn, run_btn_event_handler, LV_EVENT_CLICKED, NULL);
|
||||||
lv_obj_t * btn_label = lv_label_create(ginfo.run_btn);
|
lv_obj_t * btn_label = lv_label_create(ginfo.run_btn);
|
||||||
lv_label_set_text(btn_label, LV_SYMBOL_PLAY);
|
lv_label_set_text(btn_label, LV_SYMBOL_PLAY);
|
||||||
lv_obj_center(btn_label);
|
lv_obj_center(btn_label);
|
||||||
lv_obj_set_grid_cell(ginfo.run_btn, LV_GRID_ALIGN_STRETCH, 2, 1,LV_GRID_ALIGN_STRETCH, 1, 2);
|
lv_obj_set_grid_cell(ginfo.run_btn, LV_GRID_ALIGN_STRETCH, 2, 1, LV_GRID_ALIGN_STRETCH, 1, 2);
|
||||||
|
|
||||||
ginfo.chart = lv_chart_create(par);
|
ginfo.chart = lv_chart_create(par);
|
||||||
lv_obj_set_style_pad_all(ginfo.chart, 0, LV_PART_MAIN);
|
lv_obj_set_style_pad_all(ginfo.chart, 0, LV_PART_MAIN);
|
||||||
@@ -159,7 +159,7 @@ static void page_obj_init(lv_obj_t * par)
|
|||||||
lv_chart_set_range(ginfo.chart, LV_CHART_AXIS_PRIMARY_Y, 0, 1024);
|
lv_chart_set_range(ginfo.chart, LV_CHART_AXIS_PRIMARY_Y, 0, 1024);
|
||||||
lv_chart_set_range(ginfo.chart, LV_CHART_AXIS_PRIMARY_X, 0, 1024);
|
lv_chart_set_range(ginfo.chart, LV_CHART_AXIS_PRIMARY_X, 0, 1024);
|
||||||
lv_chart_set_point_count(ginfo.chart, CHART_POINTS_NUM);
|
lv_chart_set_point_count(ginfo.chart, CHART_POINTS_NUM);
|
||||||
lv_obj_set_grid_cell(ginfo.chart, LV_GRID_ALIGN_STRETCH, 0, 3,LV_GRID_ALIGN_STRETCH, 3, 1);
|
lv_obj_set_grid_cell(ginfo.chart, LV_GRID_ALIGN_STRETCH, 0, 3, LV_GRID_ALIGN_STRETCH, 3, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ static void btn_start_event_handler(lv_event_t * e)
|
|||||||
{
|
{
|
||||||
lv_obj_t * btn = lv_event_get_target(e);
|
lv_obj_t * btn = lv_event_get_target(e);
|
||||||
|
|
||||||
if (!anim_timeline) {
|
if(!anim_timeline) {
|
||||||
anim_timeline_create();
|
anim_timeline_create();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ static void btn_start_event_handler(lv_event_t * e)
|
|||||||
static void btn_del_event_handler(lv_event_t * e)
|
static void btn_del_event_handler(lv_event_t * e)
|
||||||
{
|
{
|
||||||
LV_UNUSED(e);
|
LV_UNUSED(e);
|
||||||
if (anim_timeline) {
|
if(anim_timeline) {
|
||||||
lv_anim_timeline_del(anim_timeline);
|
lv_anim_timeline_del(anim_timeline);
|
||||||
anim_timeline = NULL;
|
anim_timeline = NULL;
|
||||||
}
|
}
|
||||||
@@ -114,7 +114,7 @@ static void btn_del_event_handler(lv_event_t * e)
|
|||||||
static void btn_stop_event_handler(lv_event_t * e)
|
static void btn_stop_event_handler(lv_event_t * e)
|
||||||
{
|
{
|
||||||
LV_UNUSED(e);
|
LV_UNUSED(e);
|
||||||
if (anim_timeline) {
|
if(anim_timeline) {
|
||||||
lv_anim_timeline_stop(anim_timeline);
|
lv_anim_timeline_stop(anim_timeline);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -123,7 +123,7 @@ static void slider_prg_event_handler(lv_event_t * e)
|
|||||||
{
|
{
|
||||||
lv_obj_t * slider = lv_event_get_target(e);
|
lv_obj_t * slider = lv_event_get_target(e);
|
||||||
|
|
||||||
if (!anim_timeline) {
|
if(!anim_timeline) {
|
||||||
anim_timeline_create();
|
anim_timeline_create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,20 +7,20 @@ static void event_cb(lv_event_t * e)
|
|||||||
lv_obj_t * label = lv_event_get_user_data(e);
|
lv_obj_t * label = lv_event_get_user_data(e);
|
||||||
|
|
||||||
switch(code) {
|
switch(code) {
|
||||||
case LV_EVENT_PRESSED:
|
case LV_EVENT_PRESSED:
|
||||||
lv_label_set_text(label, "The last button event:\nLV_EVENT_PRESSED");
|
lv_label_set_text(label, "The last button event:\nLV_EVENT_PRESSED");
|
||||||
break;
|
break;
|
||||||
case LV_EVENT_CLICKED:
|
case LV_EVENT_CLICKED:
|
||||||
lv_label_set_text(label, "The last button event:\nLV_EVENT_CLICKED");
|
lv_label_set_text(label, "The last button event:\nLV_EVENT_CLICKED");
|
||||||
break;
|
break;
|
||||||
case LV_EVENT_LONG_PRESSED:
|
case LV_EVENT_LONG_PRESSED:
|
||||||
lv_label_set_text(label, "The last button event:\nLV_EVENT_LONG_PRESSED");
|
lv_label_set_text(label, "The last button event:\nLV_EVENT_LONG_PRESSED");
|
||||||
break;
|
break;
|
||||||
case LV_EVENT_LONG_PRESSED_REPEAT:
|
case LV_EVENT_LONG_PRESSED_REPEAT:
|
||||||
lv_label_set_text(label, "The last button event:\nLV_EVENT_LONG_PRESSED_REPEAT");
|
lv_label_set_text(label, "The last button event:\nLV_EVENT_LONG_PRESSED_REPEAT");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,15 +7,16 @@ static lv_obj_t * label = NULL;
|
|||||||
|
|
||||||
static void timer_cb(lv_timer_t * timer)
|
static void timer_cb(lv_timer_t * timer)
|
||||||
{
|
{
|
||||||
if (n < 3 || n > 32) {
|
if(n < 3 || n > 32) {
|
||||||
n = 3;
|
n = 3;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
static uint32_t old_tick = 0;
|
static uint32_t old_tick = 0;
|
||||||
uint32_t tick = lv_tick_get();
|
uint32_t tick = lv_tick_get();
|
||||||
if (!old_tick) {
|
if(!old_tick) {
|
||||||
old_tick = tick;
|
old_tick = tick;
|
||||||
}
|
}
|
||||||
if (tick - old_tick > 3000) {
|
if(tick - old_tick > 3000) {
|
||||||
n++;
|
n++;
|
||||||
lv_label_set_text_fmt(label, "%d sides", n);
|
lv_label_set_text_fmt(label, "%d sides", n);
|
||||||
old_tick = tick;
|
old_tick = tick;
|
||||||
@@ -35,10 +36,10 @@ static void event_cb(lv_event_t * e)
|
|||||||
lv_point_t points[32];
|
lv_point_t points[32];
|
||||||
int i, r = 150;
|
int i, r = 150;
|
||||||
uint32_t tick = lv_tick_get();
|
uint32_t tick = lv_tick_get();
|
||||||
for (i = 0; i < n; i++) {
|
for(i = 0; i < n; i++) {
|
||||||
int angle = i * 360 / n + ((tick % 36000) / 100);
|
int angle = i * 360 / n + ((tick % 36000) / 100);
|
||||||
lv_coord_t x = 150 + (r * lv_trigo_cos(angle) >> LV_TRIGO_SHIFT), y =
|
lv_coord_t x = 150 + (r * lv_trigo_cos(angle) >> LV_TRIGO_SHIFT), y =
|
||||||
150 + (r * lv_trigo_sin(angle) >> LV_TRIGO_SHIFT);
|
150 + (r * lv_trigo_sin(angle) >> LV_TRIGO_SHIFT);
|
||||||
points[i].x = x;
|
points[i].x = x;
|
||||||
points[i].y = y;
|
points[i].y = y;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ void lv_example_flex_1(void)
|
|||||||
lv_obj_t * label;
|
lv_obj_t * label;
|
||||||
|
|
||||||
/*Add items to the row*/
|
/*Add items to the row*/
|
||||||
obj= lv_btn_create(cont_row);
|
obj = lv_btn_create(cont_row);
|
||||||
lv_obj_set_size(obj, 100, LV_PCT(100));
|
lv_obj_set_size(obj, 100, LV_PCT(100));
|
||||||
|
|
||||||
label = lv_label_create(obj);
|
label = lv_label_create(obj);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ void lv_example_grid_1(void)
|
|||||||
/*Stretch the cell horizontally and vertically too
|
/*Stretch the cell horizontally and vertically too
|
||||||
*Set span to 1 to make the cell 1 column/row sized*/
|
*Set span to 1 to make the cell 1 column/row sized*/
|
||||||
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1,
|
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1,
|
||||||
LV_GRID_ALIGN_STRETCH, row, 1);
|
LV_GRID_ALIGN_STRETCH, row, 1);
|
||||||
|
|
||||||
label = lv_label_create(obj);
|
label = lv_label_create(obj);
|
||||||
lv_label_set_text_fmt(label, "c%d, r%d", col, row);
|
lv_label_set_text_fmt(label, "c%d, r%d", col, row);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ void lv_example_grid_2(void)
|
|||||||
obj = lv_obj_create(cont);
|
obj = lv_obj_create(cont);
|
||||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||||
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_START, 0, 1,
|
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_START, 0, 1,
|
||||||
LV_GRID_ALIGN_START, 0, 1);
|
LV_GRID_ALIGN_START, 0, 1);
|
||||||
label = lv_label_create(obj);
|
label = lv_label_create(obj);
|
||||||
lv_label_set_text(label, "c0, r0");
|
lv_label_set_text(label, "c0, r0");
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ void lv_example_grid_2(void)
|
|||||||
obj = lv_obj_create(cont);
|
obj = lv_obj_create(cont);
|
||||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||||
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_START, 1, 1,
|
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_START, 1, 1,
|
||||||
LV_GRID_ALIGN_CENTER, 0, 1);
|
LV_GRID_ALIGN_CENTER, 0, 1);
|
||||||
label = lv_label_create(obj);
|
label = lv_label_create(obj);
|
||||||
lv_label_set_text(label, "c1, r0");
|
lv_label_set_text(label, "c1, r0");
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ void lv_example_grid_2(void)
|
|||||||
obj = lv_obj_create(cont);
|
obj = lv_obj_create(cont);
|
||||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||||
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_START, 2, 1,
|
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_START, 2, 1,
|
||||||
LV_GRID_ALIGN_END, 0, 1);
|
LV_GRID_ALIGN_END, 0, 1);
|
||||||
label = lv_label_create(obj);
|
label = lv_label_create(obj);
|
||||||
lv_label_set_text(label, "c2, r0");
|
lv_label_set_text(label, "c2, r0");
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ void lv_example_grid_2(void)
|
|||||||
obj = lv_obj_create(cont);
|
obj = lv_obj_create(cont);
|
||||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||||
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, 1, 2,
|
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, 1, 2,
|
||||||
LV_GRID_ALIGN_STRETCH, 1, 1);
|
LV_GRID_ALIGN_STRETCH, 1, 1);
|
||||||
label = lv_label_create(obj);
|
label = lv_label_create(obj);
|
||||||
lv_label_set_text(label, "c1-2, r1");
|
lv_label_set_text(label, "c1-2, r1");
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ void lv_example_grid_2(void)
|
|||||||
obj = lv_obj_create(cont);
|
obj = lv_obj_create(cont);
|
||||||
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||||
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, 0, 1,
|
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, 0, 1,
|
||||||
LV_GRID_ALIGN_STRETCH, 1, 2);
|
LV_GRID_ALIGN_STRETCH, 1, 2);
|
||||||
label = lv_label_create(obj);
|
label = lv_label_create(obj);
|
||||||
lv_label_set_text(label, "c0\nr1-2");
|
lv_label_set_text(label, "c0\nr1-2");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ void lv_example_grid_3(void)
|
|||||||
/*Stretch the cell horizontally and vertically too
|
/*Stretch the cell horizontally and vertically too
|
||||||
*Set span to 1 to make the cell 1 column/row sized*/
|
*Set span to 1 to make the cell 1 column/row sized*/
|
||||||
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1,
|
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1,
|
||||||
LV_GRID_ALIGN_STRETCH, row, 1);
|
LV_GRID_ALIGN_STRETCH, row, 1);
|
||||||
|
|
||||||
label = lv_label_create(obj);
|
label = lv_label_create(obj);
|
||||||
lv_label_set_text_fmt(label, "%d,%d", col, row);
|
lv_label_set_text_fmt(label, "%d,%d", col, row);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ void lv_example_grid_4(void)
|
|||||||
/*Stretch the cell horizontally and vertically too
|
/*Stretch the cell horizontally and vertically too
|
||||||
*Set span to 1 to make the cell 1 column/row sized*/
|
*Set span to 1 to make the cell 1 column/row sized*/
|
||||||
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1,
|
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1,
|
||||||
LV_GRID_ALIGN_STRETCH, row, 1);
|
LV_GRID_ALIGN_STRETCH, row, 1);
|
||||||
|
|
||||||
label = lv_label_create(obj);
|
label = lv_label_create(obj);
|
||||||
lv_label_set_text_fmt(label, "%d,%d", col, row);
|
lv_label_set_text_fmt(label, "%d,%d", col, row);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ void lv_example_grid_5(void)
|
|||||||
|
|
||||||
obj = lv_obj_create(cont);
|
obj = lv_obj_create(cont);
|
||||||
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1,
|
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1,
|
||||||
LV_GRID_ALIGN_STRETCH, row, 1);
|
LV_GRID_ALIGN_STRETCH, row, 1);
|
||||||
label = lv_label_create(obj);
|
label = lv_label_create(obj);
|
||||||
lv_label_set_text_fmt(label, "%d,%d", col, row);
|
lv_label_set_text_fmt(label, "%d,%d", col, row);
|
||||||
lv_obj_center(label);
|
lv_obj_center(label);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ void lv_example_grid_6(void)
|
|||||||
/*Stretch the cell horizontally and vertically too
|
/*Stretch the cell horizontally and vertically too
|
||||||
*Set span to 1 to make the cell 1 column/row sized*/
|
*Set span to 1 to make the cell 1 column/row sized*/
|
||||||
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1,
|
lv_obj_set_grid_cell(obj, LV_GRID_ALIGN_STRETCH, col, 1,
|
||||||
LV_GRID_ALIGN_STRETCH, row, 1);
|
LV_GRID_ALIGN_STRETCH, row, 1);
|
||||||
|
|
||||||
label = lv_label_create(obj);
|
label = lv_label_create(obj);
|
||||||
lv_label_set_text_fmt(label, "%d,%d", col, row);
|
lv_label_set_text_fmt(label, "%d,%d", col, row);
|
||||||
|
|||||||
+1114
-1114
File diff suppressed because it is too large
Load Diff
+331
-331
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,7 @@ void lv_example_rlottie_2(void)
|
|||||||
{
|
{
|
||||||
/*The rlottie library uses STDIO file API, so there is no driver letter for LVGL*/
|
/*The rlottie library uses STDIO file API, so there is no driver letter for LVGL*/
|
||||||
lv_obj_t * lottie = lv_rlottie_create_from_file(lv_scr_act(), 100, 100,
|
lv_obj_t * lottie = lv_rlottie_create_from_file(lv_scr_act(), 100, 100,
|
||||||
"lvgl/examples/libs/rlottie/lv_example_rlottie_approve.json");
|
"lvgl/examples/libs/rlottie/lv_example_rlottie_approve.json");
|
||||||
lv_obj_center(lottie);
|
lv_obj_center(lottie);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -6,12 +6,12 @@
|
|||||||
*/
|
*/
|
||||||
void lv_example_sjpg_1(void)
|
void lv_example_sjpg_1(void)
|
||||||
{
|
{
|
||||||
lv_obj_t * wp;
|
lv_obj_t * wp;
|
||||||
|
|
||||||
wp = lv_img_create(lv_scr_act());
|
wp = lv_img_create(lv_scr_act());
|
||||||
/* Assuming a File system is attached to letter 'A'
|
/* Assuming a File system is attached to letter 'A'
|
||||||
* E.g. set LV_USE_FS_STDIO 'A' in lv_conf.h */
|
* E.g. set LV_USE_FS_STDIO 'A' in lv_conf.h */
|
||||||
lv_img_set_src(wp, "A:lvgl/examples/libs/sjpg/small_image.sjpg");
|
lv_img_set_src(wp, "A:lvgl/examples/libs/sjpg/small_image.sjpg");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,39 +6,41 @@
|
|||||||
|
|
||||||
#if LV_USE_FRAGMENT && LV_BUILD_EXAMPLES
|
#if LV_USE_FRAGMENT && LV_BUILD_EXAMPLES
|
||||||
|
|
||||||
static void sample_fragment_ctor(lv_fragment_t *self, void *args);
|
static void sample_fragment_ctor(lv_fragment_t * self, void * args);
|
||||||
|
|
||||||
static lv_obj_t *sample_fragment_create_obj(lv_fragment_t *self, lv_obj_t *parent);
|
static lv_obj_t * sample_fragment_create_obj(lv_fragment_t * self, lv_obj_t * parent);
|
||||||
|
|
||||||
static lv_obj_t * root = NULL;
|
static lv_obj_t * root = NULL;
|
||||||
|
|
||||||
struct sample_fragment_t {
|
struct sample_fragment_t {
|
||||||
lv_fragment_t base;
|
lv_fragment_t base;
|
||||||
const char *name;
|
const char * name;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const lv_fragment_class_t sample_cls = {
|
static const lv_fragment_class_t sample_cls = {
|
||||||
.constructor_cb = sample_fragment_ctor,
|
.constructor_cb = sample_fragment_ctor,
|
||||||
.create_obj_cb = sample_fragment_create_obj,
|
.create_obj_cb = sample_fragment_create_obj,
|
||||||
.instance_size = sizeof(struct sample_fragment_t)
|
.instance_size = sizeof(struct sample_fragment_t)
|
||||||
};
|
};
|
||||||
|
|
||||||
void lv_example_fragment_1(void)
|
void lv_example_fragment_1(void)
|
||||||
{
|
{
|
||||||
root = lv_obj_create(lv_scr_act());
|
root = lv_obj_create(lv_scr_act());
|
||||||
lv_obj_set_size(root, LV_PCT(100), LV_PCT(100));
|
lv_obj_set_size(root, LV_PCT(100), LV_PCT(100));
|
||||||
lv_fragment_manager_t *manager = lv_fragment_manager_create(NULL);
|
lv_fragment_manager_t * manager = lv_fragment_manager_create(NULL);
|
||||||
lv_fragment_t *fragment = lv_fragment_create(&sample_cls, "Fragment");
|
lv_fragment_t * fragment = lv_fragment_create(&sample_cls, "Fragment");
|
||||||
lv_fragment_manager_replace(manager, fragment, &root);
|
lv_fragment_manager_replace(manager, fragment, &root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void sample_fragment_ctor(lv_fragment_t *self, void *args) {
|
static void sample_fragment_ctor(lv_fragment_t * self, void * args)
|
||||||
|
{
|
||||||
((struct sample_fragment_t *) self)->name = args;
|
((struct sample_fragment_t *) self)->name = args;
|
||||||
}
|
}
|
||||||
|
|
||||||
static lv_obj_t *sample_fragment_create_obj(lv_fragment_t *self, lv_obj_t *parent) {
|
static lv_obj_t * sample_fragment_create_obj(lv_fragment_t * self, lv_obj_t * parent)
|
||||||
lv_obj_t *label = lv_label_create(parent);
|
{
|
||||||
|
lv_obj_t * label = lv_label_create(parent);
|
||||||
lv_obj_set_style_bg_opa(label, LV_OPA_COVER, 0);;
|
lv_obj_set_style_bg_opa(label, LV_OPA_COVER, 0);;
|
||||||
lv_label_set_text_fmt(label, "Hello, %s!", ((struct sample_fragment_t *) self)->name);
|
lv_label_set_text_fmt(label, "Hello, %s!", ((struct sample_fragment_t *) self)->name);
|
||||||
return label;
|
return label;
|
||||||
|
|||||||
@@ -6,34 +6,34 @@
|
|||||||
|
|
||||||
#if LV_USE_FRAGMENT && LV_USE_WIN && LV_BUILD_EXAMPLES
|
#if LV_USE_FRAGMENT && LV_USE_WIN && LV_BUILD_EXAMPLES
|
||||||
|
|
||||||
static void sample_fragment_ctor(lv_fragment_t *self, void *args);
|
static void sample_fragment_ctor(lv_fragment_t * self, void * args);
|
||||||
|
|
||||||
static lv_obj_t *sample_fragment_create_obj(lv_fragment_t *self, lv_obj_t *parent);
|
static lv_obj_t * sample_fragment_create_obj(lv_fragment_t * self, lv_obj_t * parent);
|
||||||
|
|
||||||
static void sample_push_click(lv_event_t *e);
|
static void sample_push_click(lv_event_t * e);
|
||||||
|
|
||||||
static void sample_pop_click(lv_event_t *e);
|
static void sample_pop_click(lv_event_t * e);
|
||||||
|
|
||||||
static void sample_fragment_inc_click(lv_event_t *e);
|
static void sample_fragment_inc_click(lv_event_t * e);
|
||||||
|
|
||||||
typedef struct sample_fragment_t {
|
typedef struct sample_fragment_t {
|
||||||
lv_fragment_t base;
|
lv_fragment_t base;
|
||||||
lv_obj_t *label;
|
lv_obj_t * label;
|
||||||
int depth;
|
int depth;
|
||||||
int counter;
|
int counter;
|
||||||
} sample_fragment_t;
|
} sample_fragment_t;
|
||||||
|
|
||||||
static const lv_fragment_class_t sample_cls = {
|
static const lv_fragment_class_t sample_cls = {
|
||||||
.constructor_cb = sample_fragment_ctor,
|
.constructor_cb = sample_fragment_ctor,
|
||||||
.create_obj_cb = sample_fragment_create_obj,
|
.create_obj_cb = sample_fragment_create_obj,
|
||||||
.instance_size = sizeof(sample_fragment_t)
|
.instance_size = sizeof(sample_fragment_t)
|
||||||
};
|
};
|
||||||
|
|
||||||
static lv_obj_t *container = NULL;
|
static lv_obj_t * container = NULL;
|
||||||
|
|
||||||
void lv_example_fragment_2(void)
|
void lv_example_fragment_2(void)
|
||||||
{
|
{
|
||||||
lv_obj_t *root = lv_obj_create(lv_scr_act());
|
lv_obj_t * root = lv_obj_create(lv_scr_act());
|
||||||
lv_obj_set_size(root, LV_PCT(100), LV_PCT(100));
|
lv_obj_set_size(root, LV_PCT(100), LV_PCT(100));
|
||||||
lv_obj_set_layout(root, LV_LAYOUT_GRID);
|
lv_obj_set_layout(root, LV_LAYOUT_GRID);
|
||||||
static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
||||||
@@ -43,67 +43,72 @@ void lv_example_fragment_2(void)
|
|||||||
lv_obj_remove_style_all(container);
|
lv_obj_remove_style_all(container);
|
||||||
lv_obj_set_grid_cell(container, LV_GRID_ALIGN_STRETCH, 0, 2, LV_GRID_ALIGN_STRETCH, 0, 1);
|
lv_obj_set_grid_cell(container, LV_GRID_ALIGN_STRETCH, 0, 2, LV_GRID_ALIGN_STRETCH, 0, 1);
|
||||||
|
|
||||||
lv_obj_t *push_btn = lv_btn_create(root);
|
lv_obj_t * push_btn = lv_btn_create(root);
|
||||||
lv_obj_t *push_label = lv_label_create(push_btn);
|
lv_obj_t * push_label = lv_label_create(push_btn);
|
||||||
lv_label_set_text(push_label, "Push");
|
lv_label_set_text(push_label, "Push");
|
||||||
|
|
||||||
lv_obj_t *pop_btn = lv_btn_create(root);
|
lv_obj_t * pop_btn = lv_btn_create(root);
|
||||||
lv_obj_t *pop_label = lv_label_create(pop_btn);
|
lv_obj_t * pop_label = lv_label_create(pop_btn);
|
||||||
lv_label_set_text(pop_label, "Pop");
|
lv_label_set_text(pop_label, "Pop");
|
||||||
lv_obj_set_grid_cell(push_btn, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_CENTER, 1, 1);
|
lv_obj_set_grid_cell(push_btn, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_CENTER, 1, 1);
|
||||||
lv_obj_set_grid_cell(pop_btn, LV_GRID_ALIGN_END, 1, 1, LV_GRID_ALIGN_CENTER, 1, 1);
|
lv_obj_set_grid_cell(pop_btn, LV_GRID_ALIGN_END, 1, 1, LV_GRID_ALIGN_CENTER, 1, 1);
|
||||||
|
|
||||||
lv_fragment_manager_t *manager = lv_fragment_manager_create(NULL);
|
lv_fragment_manager_t * manager = lv_fragment_manager_create(NULL);
|
||||||
int depth = 0;
|
int depth = 0;
|
||||||
lv_fragment_t *fragment = lv_fragment_create(&sample_cls, &depth);
|
lv_fragment_t * fragment = lv_fragment_create(&sample_cls, &depth);
|
||||||
lv_fragment_manager_push(manager, fragment, &container);
|
lv_fragment_manager_push(manager, fragment, &container);
|
||||||
lv_obj_add_event_cb(push_btn, sample_push_click, LV_EVENT_CLICKED, manager);
|
lv_obj_add_event_cb(push_btn, sample_push_click, LV_EVENT_CLICKED, manager);
|
||||||
lv_obj_add_event_cb(pop_btn, sample_pop_click, LV_EVENT_CLICKED, manager);
|
lv_obj_add_event_cb(pop_btn, sample_pop_click, LV_EVENT_CLICKED, manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void sample_fragment_ctor(lv_fragment_t *self, void *args) {
|
static void sample_fragment_ctor(lv_fragment_t * self, void * args)
|
||||||
|
{
|
||||||
LV_UNUSED(args);
|
LV_UNUSED(args);
|
||||||
((sample_fragment_t *) self)->depth = *((int *) args);
|
((sample_fragment_t *) self)->depth = *((int *) args);
|
||||||
((sample_fragment_t *) self)->counter = 0;
|
((sample_fragment_t *) self)->counter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static lv_obj_t *sample_fragment_create_obj(lv_fragment_t *self, lv_obj_t *parent) {
|
static lv_obj_t * sample_fragment_create_obj(lv_fragment_t * self, lv_obj_t * parent)
|
||||||
sample_fragment_t *fragment = (sample_fragment_t *) self;
|
{
|
||||||
lv_obj_t *content = lv_obj_create(parent);
|
sample_fragment_t * fragment = (sample_fragment_t *) self;
|
||||||
|
lv_obj_t * content = lv_obj_create(parent);
|
||||||
lv_obj_remove_style_all(content);
|
lv_obj_remove_style_all(content);
|
||||||
lv_obj_set_style_bg_opa(content, LV_OPA_50, 0);
|
lv_obj_set_style_bg_opa(content, LV_OPA_50, 0);
|
||||||
lv_obj_set_style_bg_color(content, lv_palette_main(LV_PALETTE_YELLOW), 0);
|
lv_obj_set_style_bg_color(content, lv_palette_main(LV_PALETTE_YELLOW), 0);
|
||||||
lv_obj_set_size(content, LV_PCT(100), LV_PCT(100));
|
lv_obj_set_size(content, LV_PCT(100), LV_PCT(100));
|
||||||
lv_obj_set_flex_flow(content, LV_FLEX_FLOW_COLUMN);
|
lv_obj_set_flex_flow(content, LV_FLEX_FLOW_COLUMN);
|
||||||
lv_obj_t *depth = lv_label_create(content);
|
lv_obj_t * depth = lv_label_create(content);
|
||||||
lv_label_set_text_fmt(depth, "Depth: %d", fragment->depth);
|
lv_label_set_text_fmt(depth, "Depth: %d", fragment->depth);
|
||||||
lv_obj_t *label = lv_label_create(content);
|
lv_obj_t * label = lv_label_create(content);
|
||||||
fragment->label = label;
|
fragment->label = label;
|
||||||
lv_label_set_text_fmt(label, "The button has been pressed %d times", fragment->counter);
|
lv_label_set_text_fmt(label, "The button has been pressed %d times", fragment->counter);
|
||||||
|
|
||||||
lv_obj_t *inc_btn = lv_btn_create(content);
|
lv_obj_t * inc_btn = lv_btn_create(content);
|
||||||
lv_obj_t *inc_label = lv_label_create(inc_btn);
|
lv_obj_t * inc_label = lv_label_create(inc_btn);
|
||||||
lv_label_set_text(inc_label, "+1");
|
lv_label_set_text(inc_label, "+1");
|
||||||
lv_obj_add_event_cb(inc_btn, sample_fragment_inc_click, LV_EVENT_CLICKED, fragment);
|
lv_obj_add_event_cb(inc_btn, sample_fragment_inc_click, LV_EVENT_CLICKED, fragment);
|
||||||
|
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sample_push_click(lv_event_t *e) {
|
static void sample_push_click(lv_event_t * e)
|
||||||
lv_fragment_manager_t *manager = (lv_fragment_manager_t *) lv_event_get_user_data(e);
|
{
|
||||||
|
lv_fragment_manager_t * manager = (lv_fragment_manager_t *) lv_event_get_user_data(e);
|
||||||
size_t stack_size = lv_fragment_manager_get_stack_size(manager);
|
size_t stack_size = lv_fragment_manager_get_stack_size(manager);
|
||||||
lv_fragment_t *fragment = lv_fragment_create(&sample_cls, &stack_size);
|
lv_fragment_t * fragment = lv_fragment_create(&sample_cls, &stack_size);
|
||||||
lv_fragment_manager_push(manager, fragment, &container);
|
lv_fragment_manager_push(manager, fragment, &container);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sample_pop_click(lv_event_t *e) {
|
static void sample_pop_click(lv_event_t * e)
|
||||||
lv_fragment_manager_t *manager = (lv_fragment_manager_t *) lv_event_get_user_data(e);
|
{
|
||||||
|
lv_fragment_manager_t * manager = (lv_fragment_manager_t *) lv_event_get_user_data(e);
|
||||||
lv_fragment_manager_pop(manager);
|
lv_fragment_manager_pop(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sample_fragment_inc_click(lv_event_t *e) {
|
static void sample_fragment_inc_click(lv_event_t * e)
|
||||||
sample_fragment_t *fragment = (sample_fragment_t *) lv_event_get_user_data(e);
|
{
|
||||||
|
sample_fragment_t * fragment = (sample_fragment_t *) lv_event_get_user_data(e);
|
||||||
fragment->counter++;
|
fragment->counter++;
|
||||||
lv_label_set_text_fmt(fragment->label, "The button has been pressed %d times", fragment->counter);
|
lv_label_set_text_fmt(fragment->label, "The button has been pressed %d times", fragment->counter);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,16 +55,16 @@ void lv_example_gridnav_3(void)
|
|||||||
lv_obj_set_style_bg_color(cont_sub1, lv_palette_lighten(LV_PALETTE_RED, 5), LV_STATE_FOCUSED);
|
lv_obj_set_style_bg_color(cont_sub1, lv_palette_lighten(LV_PALETTE_RED, 5), LV_STATE_FOCUSED);
|
||||||
lv_obj_set_width(label, lv_pct(100));
|
lv_obj_set_width(label, lv_pct(100));
|
||||||
lv_label_set_text(label,
|
lv_label_set_text(label,
|
||||||
"I'm a very long text which is makes my container scrollable. "
|
"I'm a very long text which is makes my container scrollable. "
|
||||||
"As LV_GRIDNAV_FLAG_SCROLL_FIRST is enabled arrow will scroll me first "
|
"As LV_GRIDNAV_FLAG_SCROLL_FIRST is enabled arrow will scroll me first "
|
||||||
"and a new objects will be focused only when an edge is reached with the scrolling.\n\n"
|
"and a new objects will be focused only when an edge is reached with the scrolling.\n\n"
|
||||||
"This is only some placeholder text to be sure the parent will be scrollable. \n\n"
|
"This is only some placeholder text to be sure the parent will be scrollable. \n\n"
|
||||||
"Hello world!\n"
|
"Hello world!\n"
|
||||||
"Hello world!\n"
|
"Hello world!\n"
|
||||||
"Hello world!\n"
|
"Hello world!\n"
|
||||||
"Hello world!\n"
|
"Hello world!\n"
|
||||||
"Hello world!\n"
|
"Hello world!\n"
|
||||||
"Hello world!");
|
"Hello world!");
|
||||||
|
|
||||||
/*Create a third container that can be focused with ENTER and contains an other grid nav*/
|
/*Create a third container that can be focused with ENTER and contains an other grid nav*/
|
||||||
lv_obj_t * cont_sub2 = lv_obj_create(cont_main);
|
lv_obj_t * cont_sub2 = lv_obj_create(cont_main);
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
#include "../../lv_examples.h"
|
#include "../../lv_examples.h"
|
||||||
#if LV_USE_SNAPSHOT && LV_BUILD_EXAMPLES
|
#if LV_USE_SNAPSHOT && LV_BUILD_EXAMPLES
|
||||||
|
|
||||||
static void event_cb(lv_event_t* e)
|
static void event_cb(lv_event_t * e)
|
||||||
{
|
{
|
||||||
lv_obj_t * snapshot_obj = lv_event_get_user_data(e);
|
lv_obj_t * snapshot_obj = lv_event_get_user_data(e);
|
||||||
lv_obj_t * img = lv_event_get_target(e);
|
lv_obj_t * img = lv_event_get_target(e);
|
||||||
|
|
||||||
if(snapshot_obj) {
|
if(snapshot_obj) {
|
||||||
lv_img_dsc_t* snapshot = (void*)lv_img_get_src(snapshot_obj);
|
lv_img_dsc_t * snapshot = (void *)lv_img_get_src(snapshot_obj);
|
||||||
if(snapshot){
|
if(snapshot) {
|
||||||
lv_snapshot_free(snapshot);
|
lv_snapshot_free(snapshot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*Copy this file as "lv_port_disp.c" and set this value to "1" to enable content*/
|
/*Copy this file as "lv_port_disp.c" and set this value to "1" to enable content*/
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
@@ -88,7 +88,8 @@ void lv_port_disp_init(void)
|
|||||||
static lv_disp_draw_buf_t draw_buf_dsc_3;
|
static lv_disp_draw_buf_t draw_buf_dsc_3;
|
||||||
static lv_color_t buf_3_1[MY_DISP_HOR_RES * MY_DISP_VER_RES]; /*A screen sized buffer*/
|
static lv_color_t buf_3_1[MY_DISP_HOR_RES * MY_DISP_VER_RES]; /*A screen sized buffer*/
|
||||||
static lv_color_t buf_3_2[MY_DISP_HOR_RES * MY_DISP_VER_RES]; /*Another screen sized buffer*/
|
static lv_color_t buf_3_2[MY_DISP_HOR_RES * MY_DISP_VER_RES]; /*Another screen sized buffer*/
|
||||||
lv_disp_draw_buf_init(&draw_buf_dsc_3, buf_3_1, buf_3_2, MY_DISP_VER_RES * LV_VER_RES_MAX); /*Initialize the display buffer*/
|
lv_disp_draw_buf_init(&draw_buf_dsc_3, buf_3_1, buf_3_2,
|
||||||
|
MY_DISP_VER_RES * LV_VER_RES_MAX); /*Initialize the display buffer*/
|
||||||
|
|
||||||
/*-----------------------------------
|
/*-----------------------------------
|
||||||
* Register the display in LVGL
|
* Register the display in LVGL
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*Copy this file as "lv_port_disp.h" and set this value to "1" to enable content*/
|
/*Copy this file as "lv_port_disp.h" and set this value to "1" to enable content*/
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
#ifndef LV_PORT_DISP_TEMPL_H
|
#ifndef LV_PORT_DISP_TEMPL_H
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*Copy this file as "lv_port_fs.c" and set this value to "1" to enable content*/
|
/*Copy this file as "lv_port_fs.c" and set this value to "1" to enable content*/
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
@@ -33,7 +33,7 @@ static lv_fs_res_t fs_seek(lv_fs_drv_t * drv, void * file_p, uint32_t pos, lv_fs
|
|||||||
static lv_fs_res_t fs_size(lv_fs_drv_t * drv, void * file_p, uint32_t * size_p);
|
static lv_fs_res_t fs_size(lv_fs_drv_t * drv, void * file_p, uint32_t * size_p);
|
||||||
static lv_fs_res_t fs_tell(lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p);
|
static lv_fs_res_t fs_tell(lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p);
|
||||||
|
|
||||||
static void * fs_dir_open(lv_fs_drv_t * drv, const char *path);
|
static void * fs_dir_open(lv_fs_drv_t * drv, const char * path);
|
||||||
static lv_fs_res_t fs_dir_read(lv_fs_drv_t * drv, void * rddir_p, char * fn);
|
static lv_fs_res_t fs_dir_read(lv_fs_drv_t * drv, void * rddir_p, char * fn);
|
||||||
static lv_fs_res_t fs_dir_close(lv_fs_drv_t * drv, void * rddir_p);
|
static lv_fs_res_t fs_dir_close(lv_fs_drv_t * drv, void * rddir_p);
|
||||||
|
|
||||||
@@ -109,18 +109,15 @@ static void * fs_open(lv_fs_drv_t * drv, const char * path, lv_fs_mode_t mode)
|
|||||||
|
|
||||||
void * f = NULL;
|
void * f = NULL;
|
||||||
|
|
||||||
if(mode == LV_FS_MODE_WR)
|
if(mode == LV_FS_MODE_WR) {
|
||||||
{
|
|
||||||
/*Open a file for write*/
|
/*Open a file for write*/
|
||||||
f = ... /*Add your code here*/
|
f = ... /*Add your code here*/
|
||||||
}
|
}
|
||||||
else if(mode == LV_FS_MODE_RD)
|
else if(mode == LV_FS_MODE_RD) {
|
||||||
{
|
|
||||||
/*Open a file for read*/
|
/*Open a file for read*/
|
||||||
f = ... /*Add your code here*/
|
f = ... /*Add your code here*/
|
||||||
}
|
}
|
||||||
else if(mode == (LV_FS_MODE_WR | LV_FS_MODE_RD))
|
else if(mode == (LV_FS_MODE_WR | LV_FS_MODE_RD)) {
|
||||||
{
|
|
||||||
/*Open a file for read and write*/
|
/*Open a file for read and write*/
|
||||||
f = ... /*Add your code here*/
|
f = ... /*Add your code here*/
|
||||||
}
|
}
|
||||||
@@ -217,12 +214,12 @@ static lv_fs_res_t fs_tell(lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p)
|
|||||||
* @param path path to a directory
|
* @param path path to a directory
|
||||||
* @return pointer to the directory read descriptor or NULL on error
|
* @return pointer to the directory read descriptor or NULL on error
|
||||||
*/
|
*/
|
||||||
static void * fs_dir_open(lv_fs_drv_t * drv, const char *path)
|
static void * fs_dir_open(lv_fs_drv_t * drv, const char * path)
|
||||||
{
|
{
|
||||||
void * dir = NULL;
|
void * dir = NULL;
|
||||||
/*Add your code here*/
|
/*Add your code here*/
|
||||||
dir = ... /*Add your code here*/
|
dir = ... /*Add your code here*/
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -233,7 +230,7 @@ static void * fs_dir_open(lv_fs_drv_t * drv, const char *path)
|
|||||||
* @param fn pointer to a buffer to store the filename
|
* @param fn pointer to a buffer to store the filename
|
||||||
* @return LV_FS_RES_OK: no error or any error from @lv_fs_res_t enum
|
* @return LV_FS_RES_OK: no error or any error from @lv_fs_res_t enum
|
||||||
*/
|
*/
|
||||||
static lv_fs_res_t fs_dir_read(lv_fs_drv_t * drv, void * rddir_p, char *fn)
|
static lv_fs_res_t fs_dir_read(lv_fs_drv_t * drv, void * rddir_p, char * fn)
|
||||||
{
|
{
|
||||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*Copy this file as "lv_port_fs.h" and set this value to "1" to enable content*/
|
/*Copy this file as "lv_port_fs.h" and set this value to "1" to enable content*/
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
#ifndef LV_PORT_FS_TEMPL_H
|
#ifndef LV_PORT_FS_TEMPL_H
|
||||||
@@ -29,7 +29,7 @@ extern "C" {
|
|||||||
/**********************
|
/**********************
|
||||||
* GLOBAL PROTOTYPES
|
* GLOBAL PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
void lv_port_fs_init(void);
|
void lv_port_fs_init(void);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*Copy this file as "lv_port_indev.c" and set this value to "1" to enable content*/
|
/*Copy this file as "lv_port_indev.c" and set this value to "1" to enable content*/
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
@@ -165,8 +165,8 @@ void lv_port_indev_init(void)
|
|||||||
|
|
||||||
/*Assign buttons to points on the screen*/
|
/*Assign buttons to points on the screen*/
|
||||||
static const lv_point_t btn_points[2] = {
|
static const lv_point_t btn_points[2] = {
|
||||||
{10, 10}, /*Button 0 -> x:10; y:10*/
|
{10, 10}, /*Button 0 -> x:10; y:10*/
|
||||||
{40, 100}, /*Button 1 -> x:40; y:100*/
|
{40, 100}, /*Button 1 -> x:40; y:100*/
|
||||||
};
|
};
|
||||||
lv_indev_set_button_points(indev_button, btn_points);
|
lv_indev_set_button_points(indev_button, btn_points);
|
||||||
}
|
}
|
||||||
@@ -195,7 +195,8 @@ static void touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
|
|||||||
if(touchpad_is_pressed()) {
|
if(touchpad_is_pressed()) {
|
||||||
touchpad_get_xy(&last_x, &last_y);
|
touchpad_get_xy(&last_x, &last_y);
|
||||||
data->state = LV_INDEV_STATE_PR;
|
data->state = LV_INDEV_STATE_PR;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
data->state = LV_INDEV_STATE_REL;
|
data->state = LV_INDEV_STATE_REL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,7 +241,8 @@ static void mouse_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
|
|||||||
/*Get whether the mouse button is pressed or released*/
|
/*Get whether the mouse button is pressed or released*/
|
||||||
if(mouse_is_pressed()) {
|
if(mouse_is_pressed()) {
|
||||||
data->state = LV_INDEV_STATE_PR;
|
data->state = LV_INDEV_STATE_PR;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
data->state = LV_INDEV_STATE_REL;
|
data->state = LV_INDEV_STATE_REL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -287,25 +289,26 @@ static void keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
|
|||||||
|
|
||||||
/*Translate the keys to LVGL control characters according to your key definitions*/
|
/*Translate the keys to LVGL control characters according to your key definitions*/
|
||||||
switch(act_key) {
|
switch(act_key) {
|
||||||
case 1:
|
case 1:
|
||||||
act_key = LV_KEY_NEXT;
|
act_key = LV_KEY_NEXT;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
act_key = LV_KEY_PREV;
|
act_key = LV_KEY_PREV;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
act_key = LV_KEY_LEFT;
|
act_key = LV_KEY_LEFT;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
act_key = LV_KEY_RIGHT;
|
act_key = LV_KEY_RIGHT;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
act_key = LV_KEY_ENTER;
|
act_key = LV_KEY_ENTER;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
last_key = act_key;
|
last_key = act_key;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
data->state = LV_INDEV_STATE_REL;
|
data->state = LV_INDEV_STATE_REL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,7 +372,8 @@ static void button_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
|
|||||||
if(btn_act >= 0) {
|
if(btn_act >= 0) {
|
||||||
data->state = LV_INDEV_STATE_PR;
|
data->state = LV_INDEV_STATE_PR;
|
||||||
last_btn = btn_act;
|
last_btn = btn_act;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
data->state = LV_INDEV_STATE_REL;
|
data->state = LV_INDEV_STATE_REL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*Copy this file as "lv_port_indev.h" and set this value to "1" to enable content*/
|
/*Copy this file as "lv_port_indev.h" and set this value to "1" to enable content*/
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
#ifndef LV_PORT_INDEV_TEMPL_H
|
#ifndef LV_PORT_INDEV_TEMPL_H
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ void lv_example_scroll_2(void)
|
|||||||
if(i == 3) {
|
if(i == 3) {
|
||||||
lv_label_set_text_fmt(label, "Panel %"LV_PRIu32"\nno snap", i);
|
lv_label_set_text_fmt(label, "Panel %"LV_PRIu32"\nno snap", i);
|
||||||
lv_obj_clear_flag(btn, LV_OBJ_FLAG_SNAPPABLE);
|
lv_obj_clear_flag(btn, LV_OBJ_FLAG_SNAPPABLE);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
lv_label_set_text_fmt(label, "Panel %"LV_PRIu32, i);
|
lv_label_set_text_fmt(label, "Panel %"LV_PRIu32, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,20 +13,20 @@ void lv_example_scroll_4(void)
|
|||||||
|
|
||||||
lv_obj_t * label = lv_label_create(obj);
|
lv_obj_t * label = lv_label_create(obj);
|
||||||
lv_label_set_text(label,
|
lv_label_set_text(label,
|
||||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n"
|
"Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n"
|
||||||
"Etiam dictum, tortor vestibulum lacinia laoreet, mi neque consectetur neque, vel mattis odio dolor egestas ligula. \n"
|
"Etiam dictum, tortor vestibulum lacinia laoreet, mi neque consectetur neque, vel mattis odio dolor egestas ligula. \n"
|
||||||
"Sed vestibulum sapien nulla, id convallis ex porttitor nec. \n"
|
"Sed vestibulum sapien nulla, id convallis ex porttitor nec. \n"
|
||||||
"Duis et massa eu libero accumsan faucibus a in arcu. \n"
|
"Duis et massa eu libero accumsan faucibus a in arcu. \n"
|
||||||
"Ut pulvinar odio lorem, vel tempus turpis condimentum quis. Nam consectetur condimentum sem in auctor. \n"
|
"Ut pulvinar odio lorem, vel tempus turpis condimentum quis. Nam consectetur condimentum sem in auctor. \n"
|
||||||
"Sed nisl augue, venenatis in blandit et, gravida ac tortor. \n"
|
"Sed nisl augue, venenatis in blandit et, gravida ac tortor. \n"
|
||||||
"Etiam dapibus elementum suscipit. \n"
|
"Etiam dapibus elementum suscipit. \n"
|
||||||
"Proin mollis sollicitudin convallis. \n"
|
"Proin mollis sollicitudin convallis. \n"
|
||||||
"Integer dapibus tempus arcu nec viverra. \n"
|
"Integer dapibus tempus arcu nec viverra. \n"
|
||||||
"Donec molestie nulla enim, eu interdum velit placerat quis. \n"
|
"Donec molestie nulla enim, eu interdum velit placerat quis. \n"
|
||||||
"Donec id efficitur risus, at molestie turpis. \n"
|
"Donec id efficitur risus, at molestie turpis. \n"
|
||||||
"Suspendisse vestibulum consectetur nunc ut commodo. \n"
|
"Suspendisse vestibulum consectetur nunc ut commodo. \n"
|
||||||
"Fusce molestie rhoncus nisi sit amet tincidunt. \n"
|
"Fusce molestie rhoncus nisi sit amet tincidunt. \n"
|
||||||
"Suspendisse a nunc ut magna ornare volutpat.");
|
"Suspendisse a nunc ut magna ornare volutpat.");
|
||||||
|
|
||||||
|
|
||||||
/*Remove the style of scrollbar to have clean start*/
|
/*Remove the style of scrollbar to have clean start*/
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ void lv_example_scroll_5(void)
|
|||||||
lv_obj_center(obj);
|
lv_obj_center(obj);
|
||||||
|
|
||||||
lv_obj_t * label = lv_label_create(obj);
|
lv_obj_t * label = lv_label_create(obj);
|
||||||
lv_label_set_text(label,"میکروکُنترولر (به انگلیسی: Microcontroller) گونهای ریزپردازنده است که دارای حافظهٔ دسترسی تصادفی (RAM) و حافظهٔ فقطخواندنی (ROM)، تایمر، پورتهای ورودی و خروجی (I/O) و درگاه ترتیبی (Serial Port پورت سریال)، درون خود تراشه است، و میتواند به تنهایی ابزارهای دیگر را کنترل کند. به عبارت دیگر یک میکروکنترلر، مدار مجتمع کوچکی است که از یک CPU کوچک و اجزای دیگری مانند تایمر، درگاههای ورودی و خروجی آنالوگ و دیجیتال و حافظه تشکیل شدهاست.");
|
lv_label_set_text(label,
|
||||||
|
"میکروکُنترولر (به انگلیسی: Microcontroller) گونهای ریزپردازنده است که دارای حافظهٔ دسترسی تصادفی (RAM) و حافظهٔ فقطخواندنی (ROM)، تایمر، پورتهای ورودی و خروجی (I/O) و درگاه ترتیبی (Serial Port پورت سریال)، درون خود تراشه است، و میتواند به تنهایی ابزارهای دیگر را کنترل کند. به عبارت دیگر یک میکروکنترلر، مدار مجتمع کوچکی است که از یک CPU کوچک و اجزای دیگری مانند تایمر، درگاههای ورودی و خروجی آنالوگ و دیجیتال و حافظه تشکیل شدهاست.");
|
||||||
lv_obj_set_width(label, 400);
|
lv_obj_set_width(label, 400);
|
||||||
lv_obj_set_style_text_font(label, &lv_font_dejavu_16_persian_hebrew, 0);
|
lv_obj_set_style_text_font(label, &lv_font_dejavu_16_persian_hebrew, 0);
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ static void scroll_event_cb(lv_event_t * e)
|
|||||||
/*If diff_y is out of the circle use the last point of the circle (the radius)*/
|
/*If diff_y is out of the circle use the last point of the circle (the radius)*/
|
||||||
if(diff_y >= r) {
|
if(diff_y >= r) {
|
||||||
x = r;
|
x = r;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/*Use Pythagoras theorem to get x from radius and y*/
|
/*Use Pythagoras theorem to get x from radius and y*/
|
||||||
uint32_t x_sqr = r * r - diff_y * diff_y;
|
uint32_t x_sqr = r * r - diff_y * diff_y;
|
||||||
lv_sqrt_res_t res;
|
lv_sqrt_res_t res;
|
||||||
|
|||||||
@@ -6,26 +6,26 @@
|
|||||||
*/
|
*/
|
||||||
void lv_example_style_1(void)
|
void lv_example_style_1(void)
|
||||||
{
|
{
|
||||||
static lv_style_t style;
|
static lv_style_t style;
|
||||||
lv_style_init(&style);
|
lv_style_init(&style);
|
||||||
lv_style_set_radius(&style, 5);
|
lv_style_set_radius(&style, 5);
|
||||||
|
|
||||||
/*Make a gradient*/
|
/*Make a gradient*/
|
||||||
lv_style_set_width(&style, 150);
|
lv_style_set_width(&style, 150);
|
||||||
lv_style_set_height(&style, LV_SIZE_CONTENT);
|
lv_style_set_height(&style, LV_SIZE_CONTENT);
|
||||||
|
|
||||||
lv_style_set_pad_ver(&style, 20);
|
lv_style_set_pad_ver(&style, 20);
|
||||||
lv_style_set_pad_left(&style, 5);
|
lv_style_set_pad_left(&style, 5);
|
||||||
|
|
||||||
lv_style_set_x(&style, lv_pct(50));
|
lv_style_set_x(&style, lv_pct(50));
|
||||||
lv_style_set_y(&style, 80);
|
lv_style_set_y(&style, 80);
|
||||||
|
|
||||||
/*Create an object with the new style*/
|
/*Create an object with the new style*/
|
||||||
lv_obj_t * obj = lv_obj_create(lv_scr_act());
|
lv_obj_t * obj = lv_obj_create(lv_scr_act());
|
||||||
lv_obj_add_style(obj, &style, 0);
|
lv_obj_add_style(obj, &style, 0);
|
||||||
|
|
||||||
lv_obj_t * label = lv_label_create(obj);
|
lv_obj_t * label = lv_label_create(obj);
|
||||||
lv_label_set_text(label, "Hello");
|
lv_label_set_text(label, "Hello");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ void lv_example_style_12(void)
|
|||||||
lv_obj_add_style(obj, &style, 0);
|
lv_obj_add_style(obj, &style, 0);
|
||||||
|
|
||||||
/*Overwrite the background color locally*/
|
/*Overwrite the background color locally*/
|
||||||
lv_obj_set_style_bg_color(obj,lv_palette_main(LV_PALETTE_ORANGE), LV_PART_MAIN);
|
lv_obj_set_style_bg_color(obj, lv_palette_main(LV_PALETTE_ORANGE), LV_PART_MAIN);
|
||||||
|
|
||||||
lv_obj_center(obj);
|
lv_obj_center(obj);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ void lv_example_style_5(void)
|
|||||||
/*Add a shadow*/
|
/*Add a shadow*/
|
||||||
lv_style_set_shadow_width(&style, 55);
|
lv_style_set_shadow_width(&style, 55);
|
||||||
lv_style_set_shadow_color(&style, lv_palette_main(LV_PALETTE_BLUE));
|
lv_style_set_shadow_color(&style, lv_palette_main(LV_PALETTE_BLUE));
|
||||||
// lv_style_set_shadow_ofs_x(&style, 10);
|
// lv_style_set_shadow_ofs_x(&style, 10);
|
||||||
// lv_style_set_shadow_ofs_y(&style, 20);
|
// lv_style_set_shadow_ofs_y(&style, 20);
|
||||||
|
|
||||||
/*Create an object with the new style*/
|
/*Create an object with the new style*/
|
||||||
lv_obj_t * obj = lv_obj_create(lv_scr_act());
|
lv_obj_t * obj = lv_obj_create(lv_scr_act());
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ void lv_example_style_8(void)
|
|||||||
lv_obj_t * obj = lv_label_create(lv_scr_act());
|
lv_obj_t * obj = lv_label_create(lv_scr_act());
|
||||||
lv_obj_add_style(obj, &style, 0);
|
lv_obj_add_style(obj, &style, 0);
|
||||||
lv_label_set_text(obj, "Text of\n"
|
lv_label_set_text(obj, "Text of\n"
|
||||||
"a label");
|
"a label");
|
||||||
|
|
||||||
lv_obj_center(obj);
|
lv_obj_center(obj);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ LV_IMG_DECLARE(animimg001)
|
|||||||
LV_IMG_DECLARE(animimg002)
|
LV_IMG_DECLARE(animimg002)
|
||||||
LV_IMG_DECLARE(animimg003)
|
LV_IMG_DECLARE(animimg003)
|
||||||
|
|
||||||
static const lv_img_dsc_t* anim_imgs[3] = {
|
static const lv_img_dsc_t * anim_imgs[3] = {
|
||||||
&animimg001,
|
&animimg001,
|
||||||
&animimg002,
|
&animimg002,
|
||||||
&animimg003,
|
&animimg003,
|
||||||
@@ -14,7 +14,7 @@ void lv_example_animimg_1(void)
|
|||||||
{
|
{
|
||||||
lv_obj_t * animimg0 = lv_animimg_create(lv_scr_act());
|
lv_obj_t * animimg0 = lv_animimg_create(lv_scr_act());
|
||||||
lv_obj_center(animimg0);
|
lv_obj_center(animimg0);
|
||||||
lv_animimg_set_src(animimg0, (lv_img_dsc_t**) anim_imgs, 3);
|
lv_animimg_set_src(animimg0, (lv_img_dsc_t **) anim_imgs, 3);
|
||||||
lv_animimg_set_duration(animimg0, 1000);
|
lv_animimg_set_duration(animimg0, 1000);
|
||||||
lv_animimg_set_repeat_count(animimg0, LV_ANIM_REPEAT_INFINITE);
|
lv_animimg_set_repeat_count(animimg0, LV_ANIM_REPEAT_INFINITE);
|
||||||
lv_animimg_start(animimg0);
|
lv_animimg_start(animimg0);
|
||||||
|
|||||||
@@ -4,13 +4,13 @@
|
|||||||
|
|
||||||
void lv_example_arc_1(void)
|
void lv_example_arc_1(void)
|
||||||
{
|
{
|
||||||
/*Create an Arc*/
|
/*Create an Arc*/
|
||||||
lv_obj_t * arc = lv_arc_create(lv_scr_act());
|
lv_obj_t * arc = lv_arc_create(lv_scr_act());
|
||||||
lv_obj_set_size(arc, 150, 150);
|
lv_obj_set_size(arc, 150, 150);
|
||||||
lv_arc_set_rotation(arc, 135);
|
lv_arc_set_rotation(arc, 135);
|
||||||
lv_arc_set_bg_angles(arc, 0, 270);
|
lv_arc_set_bg_angles(arc, 0, 270);
|
||||||
lv_arc_set_value(arc, 40);
|
lv_arc_set_value(arc, 40);
|
||||||
lv_obj_center(arc);
|
lv_obj_center(arc);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -12,23 +12,23 @@ static void set_angle(void * obj, int32_t v)
|
|||||||
*/
|
*/
|
||||||
void lv_example_arc_2(void)
|
void lv_example_arc_2(void)
|
||||||
{
|
{
|
||||||
/*Create an Arc*/
|
/*Create an Arc*/
|
||||||
lv_obj_t * arc = lv_arc_create(lv_scr_act());
|
lv_obj_t * arc = lv_arc_create(lv_scr_act());
|
||||||
lv_arc_set_rotation(arc, 270);
|
lv_arc_set_rotation(arc, 270);
|
||||||
lv_arc_set_bg_angles(arc, 0, 360);
|
lv_arc_set_bg_angles(arc, 0, 360);
|
||||||
lv_obj_remove_style(arc, NULL, LV_PART_KNOB); /*Be sure the knob is not displayed*/
|
lv_obj_remove_style(arc, NULL, LV_PART_KNOB); /*Be sure the knob is not displayed*/
|
||||||
lv_obj_clear_flag(arc, LV_OBJ_FLAG_CLICKABLE); /*To not allow adjusting by click*/
|
lv_obj_clear_flag(arc, LV_OBJ_FLAG_CLICKABLE); /*To not allow adjusting by click*/
|
||||||
lv_obj_center(arc);
|
lv_obj_center(arc);
|
||||||
|
|
||||||
lv_anim_t a;
|
lv_anim_t a;
|
||||||
lv_anim_init(&a);
|
lv_anim_init(&a);
|
||||||
lv_anim_set_var(&a, arc);
|
lv_anim_set_var(&a, arc);
|
||||||
lv_anim_set_exec_cb(&a, set_angle);
|
lv_anim_set_exec_cb(&a, set_angle);
|
||||||
lv_anim_set_time(&a, 1000);
|
lv_anim_set_time(&a, 1000);
|
||||||
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); /*Just for the demo*/
|
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); /*Just for the demo*/
|
||||||
lv_anim_set_repeat_delay(&a, 500);
|
lv_anim_set_repeat_delay(&a, 500);
|
||||||
lv_anim_set_values(&a, 0, 100);
|
lv_anim_set_values(&a, 0, 100);
|
||||||
lv_anim_start(&a);
|
lv_anim_start(&a);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "../../lv_examples.h"
|
#include "../../lv_examples.h"
|
||||||
#if LV_USE_BAR && LV_BUILD_EXAMPLES
|
#if LV_USE_BAR && LV_BUILD_EXAMPLES
|
||||||
|
|
||||||
static void set_value(void *bar, int32_t v)
|
static void set_value(void * bar, int32_t v)
|
||||||
{
|
{
|
||||||
lv_bar_set_value(bar, v, LV_ANIM_OFF);
|
lv_bar_set_value(bar, v, LV_ANIM_OFF);
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@ static void event_cb(lv_event_t * e)
|
|||||||
lv_obj_draw_part_dsc_t * dsc = lv_event_get_param(e);
|
lv_obj_draw_part_dsc_t * dsc = lv_event_get_param(e);
|
||||||
if(dsc->part != LV_PART_INDICATOR) return;
|
if(dsc->part != LV_PART_INDICATOR) return;
|
||||||
|
|
||||||
lv_obj_t * obj= lv_event_get_target(e);
|
lv_obj_t * obj = lv_event_get_target(e);
|
||||||
|
|
||||||
lv_draw_label_dsc_t label_dsc;
|
lv_draw_label_dsc_t label_dsc;
|
||||||
lv_draw_label_dsc_init(&label_dsc);
|
lv_draw_label_dsc_init(&label_dsc);
|
||||||
@@ -21,7 +21,8 @@ static void event_cb(lv_event_t * e)
|
|||||||
lv_snprintf(buf, sizeof(buf), "%d", (int)lv_bar_get_value(obj));
|
lv_snprintf(buf, sizeof(buf), "%d", (int)lv_bar_get_value(obj));
|
||||||
|
|
||||||
lv_point_t txt_size;
|
lv_point_t txt_size;
|
||||||
lv_txt_get_size(&txt_size, buf, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, LV_COORD_MAX, label_dsc.flag);
|
lv_txt_get_size(&txt_size, buf, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, LV_COORD_MAX,
|
||||||
|
label_dsc.flag);
|
||||||
|
|
||||||
lv_area_t txt_area;
|
lv_area_t txt_area;
|
||||||
/*If the indicator is long enough put the text inside on the right*/
|
/*If the indicator is long enough put the text inside on the right*/
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ void lv_example_btn_3(void)
|
|||||||
{
|
{
|
||||||
/*Properties to transition*/
|
/*Properties to transition*/
|
||||||
static lv_style_prop_t props[] = {
|
static lv_style_prop_t props[] = {
|
||||||
LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_TRANSFORM_HEIGHT, LV_STYLE_TEXT_LETTER_SPACE, 0
|
LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_TRANSFORM_HEIGHT, LV_STYLE_TEXT_LETTER_SPACE, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
/*Transition descriptor when going back to the default state.
|
/*Transition descriptor when going back to the default state.
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ static void event_handler(lv_event_t * e)
|
|||||||
|
|
||||||
static const char * btnm_map[] = {"1", "2", "3", "4", "5", "\n",
|
static const char * btnm_map[] = {"1", "2", "3", "4", "5", "\n",
|
||||||
"6", "7", "8", "9", "0", "\n",
|
"6", "7", "8", "9", "0", "\n",
|
||||||
"Action1", "Action2", ""};
|
"Action1", "Action2", ""
|
||||||
|
};
|
||||||
|
|
||||||
void lv_example_btnmatrix_1(void)
|
void lv_example_btnmatrix_1(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ void lv_example_canvas_2(void)
|
|||||||
/*Create hole on the canvas*/
|
/*Create hole on the canvas*/
|
||||||
uint32_t x;
|
uint32_t x;
|
||||||
uint32_t y;
|
uint32_t y;
|
||||||
for( y = 10; y < 30; y++) {
|
for(y = 10; y < 30; y++) {
|
||||||
for( x = 5; x < 20; x++) {
|
for(x = 5; x < 20; x++) {
|
||||||
lv_canvas_set_px_color(canvas, x, y, c0);
|
lv_canvas_set_px_color(canvas, x, y, c0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user