fix conflicts
This commit is contained in:
18
CHANGELOG.md
18
CHANGELOG.md
@@ -1,15 +1,29 @@
|
||||
# Changelog
|
||||
|
||||
|
||||
## v7.7.0 (06.10.2020)
|
||||
|
||||
### New features
|
||||
- Add PXP GPU support (for NXP MCUs)
|
||||
- Allow max. 16 cell types for table
|
||||
- Add `lv_table_set_text_fmt()`
|
||||
- Use margin on calendar header to set distances and padding to the size of the header.
|
||||
- Use margin on calendar header to set distances and padding to the size of the header
|
||||
- Add `text_sel_bg` style proeprty
|
||||
|
||||
### Bugfixes
|
||||
|
||||
## v7.6.1 (06.10.2020)
|
||||
|
||||
### Bugfixes
|
||||
- Fix BIDI support in dropdown list
|
||||
- Fix copying base dir in `lv_obj_create`
|
||||
- Handle sub pixel rendering in font loader
|
||||
- Fix transitions with style caching
|
||||
- Fix click focus
|
||||
- Fix imgbtn image switching with empty style
|
||||
- Material theme: do not set the text font to allow easy global font change
|
||||
|
||||
|
||||
## v7.6.0 (22.09.2020)
|
||||
|
||||
### New features
|
||||
@@ -18,8 +32,6 @@
|
||||
### Bugfixes
|
||||
- Fix selection of options with non-ASCII letters in dropdown list
|
||||
- Fix font loader to support LV_FONT_FMT_TXT_LARGE
|
||||
- Fix BIDI support in dropdown list
|
||||
- Fix copying base dir in lv_obj_craete
|
||||
|
||||
## v7.5.0 (15.09.2020)
|
||||
|
||||
|
||||
@@ -10,6 +10,14 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined __has_include
|
||||
# if __has_include("lv_conf.h")
|
||||
# ifndef LV_CONF_INCLUDE_SIMPLE
|
||||
# define LV_CONF_INCLUDE_SIMPLE
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*If lv_conf.h is not skipped include it*/
|
||||
#if !defined(LV_CONF_SKIP) && !defined(CONFIG_LV_CONF_SKIP)
|
||||
# if defined(LV_CONF_PATH) /*If there is a path defined for lv_conf.h use it*/
|
||||
|
||||
@@ -1162,14 +1162,14 @@ static void indev_click_focus(lv_indev_proc_t * proc)
|
||||
if(lv_obj_is_protected(indev_obj_act, LV_PROTECT_CLICK_FOCUS) == false &&
|
||||
proc->types.pointer.last_pressed != obj_to_focus) {
|
||||
#if LV_USE_GROUP
|
||||
lv_group_t * g_act = lv_obj_get_group(indev_obj_act);
|
||||
lv_group_t * g_act = lv_obj_get_group(obj_to_focus);
|
||||
lv_group_t * g_prev = proc->types.pointer.last_pressed ? lv_obj_get_group(proc->types.pointer.last_pressed) : NULL;
|
||||
|
||||
/*If both the last and act. obj. are in the same group (or no group but it's also the same) */
|
||||
if(g_act == g_prev) {
|
||||
/*The objects are in a group*/
|
||||
if(g_act) {
|
||||
lv_group_focus_obj(indev_obj_act);
|
||||
lv_group_focus_obj(obj_to_focus);
|
||||
if(indev_reset_check(proc)) return;
|
||||
}
|
||||
/*The object are not in group*/
|
||||
@@ -1218,7 +1218,7 @@ static void indev_click_focus(lv_indev_proc_t * proc)
|
||||
|
||||
/*Focus to the act. in its group*/
|
||||
if(g_act) {
|
||||
lv_group_focus_obj(indev_obj_act);
|
||||
lv_group_focus_obj(obj_to_focus);
|
||||
if(indev_reset_check(proc)) return;
|
||||
}
|
||||
else {
|
||||
@@ -1236,9 +1236,9 @@ static void indev_click_focus(lv_indev_proc_t * proc)
|
||||
if(indev_reset_check(proc)) return;
|
||||
}
|
||||
|
||||
lv_signal_send(indev_obj_act, LV_SIGNAL_FOCUS, NULL);
|
||||
lv_signal_send(obj_to_focus, LV_SIGNAL_FOCUS, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
lv_event_send(indev_obj_act, LV_EVENT_FOCUSED, NULL);
|
||||
lv_event_send(obj_to_focus, LV_EVENT_FOCUSED, NULL);
|
||||
if(indev_reset_check(proc)) return;
|
||||
#endif
|
||||
proc->types.pointer.last_pressed = obj_to_focus;
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
#include <string.h>
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT
|
||||
#include "lv_gpu/lv_gpu_nxp_pxp.h"
|
||||
#include "lv_gpu/lv_gpu_nxp_pxp_osa.h"
|
||||
#include "../lv_gpu/lv_gpu_nxp_pxp.h"
|
||||
#include "../lv_gpu/lv_gpu_nxp_pxp_osa.h"
|
||||
#endif
|
||||
|
||||
#if defined(LV_GC_INCLUDE)
|
||||
@@ -200,9 +200,9 @@ void lv_init(void)
|
||||
#endif
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP && LV_USE_GPU_NXP_PXP_AUTO_INIT
|
||||
if (lv_gpu_nxp_pxp_init(&pxp_default_cfg) != LV_RES_OK) {
|
||||
if(lv_gpu_nxp_pxp_init(&pxp_default_cfg) != LV_RES_OK) {
|
||||
LV_LOG_ERROR("PXP init error. STOP.\n");
|
||||
for ( ; ; ) ;
|
||||
for(; ;) ;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1742,13 +1742,16 @@ void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
|
||||
|
||||
obj->state = new_state;
|
||||
|
||||
if(cmp_res == STYLE_COMPARE_SAME) return;
|
||||
if(cmp_res == STYLE_COMPARE_SAME) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if LV_USE_ANIMATION == 0
|
||||
if(cmp_res == STYLE_COMPARE_DIFF) lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ALL);
|
||||
else if(cmp_res == STYLE_COMPARE_VISUAL_DIFF) lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL);
|
||||
#else
|
||||
|
||||
|
||||
for(part = 0; part < _LV_OBJ_PART_REAL_LAST; part++) {
|
||||
lv_style_list_t * style_list = lv_obj_get_style_list(obj, part);
|
||||
if(style_list == NULL) break; /*No more style lists*/
|
||||
@@ -3523,7 +3526,8 @@ void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint8_t part, lv_draw_label_dsc_
|
||||
draw_dsc->font = lv_obj_get_style_text_font(obj, part);
|
||||
|
||||
if(draw_dsc->sel_start != LV_DRAW_LABEL_NO_TXT_SEL && draw_dsc->sel_end != LV_DRAW_LABEL_NO_TXT_SEL) {
|
||||
draw_dsc->color = lv_obj_get_style_text_sel_color(obj, part);
|
||||
draw_dsc->sel_color = lv_obj_get_style_text_sel_color(obj, part);
|
||||
draw_dsc->sel_bg_color = lv_obj_get_style_text_sel_bg_color(obj, part);
|
||||
}
|
||||
|
||||
#if LV_USE_BIDI
|
||||
@@ -4307,14 +4311,18 @@ static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop,
|
||||
lv_style_list_t * style_list = lv_obj_get_style_list(obj, part);
|
||||
lv_style_t * style_trans = _lv_style_list_get_transition_style(style_list);
|
||||
|
||||
bool cahche_ori = style_list->ignore_cache;
|
||||
|
||||
/*Get the previous and current values*/
|
||||
if((prop & 0xF) < LV_STYLE_ID_COLOR) { /*Int*/
|
||||
style_list->skip_trans = 1;
|
||||
style_list->ignore_cache = 1;
|
||||
obj->state = prev_state;
|
||||
lv_style_int_t int1 = _lv_obj_get_style_int(obj, part, prop);
|
||||
obj->state = new_state;
|
||||
lv_style_int_t int2 = _lv_obj_get_style_int(obj, part, prop);
|
||||
style_list->skip_trans = 0;
|
||||
style_list->ignore_cache = cahche_ori;
|
||||
|
||||
if(int1 == int2) return NULL;
|
||||
obj->state = prev_state;
|
||||
@@ -4339,11 +4347,13 @@ static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop,
|
||||
}
|
||||
else if((prop & 0xF) < LV_STYLE_ID_OPA) { /*Color*/
|
||||
style_list->skip_trans = 1;
|
||||
style_list->ignore_cache = 1;
|
||||
obj->state = prev_state;
|
||||
lv_color_t c1 = _lv_obj_get_style_color(obj, part, prop);
|
||||
obj->state = new_state;
|
||||
lv_color_t c2 = _lv_obj_get_style_color(obj, part, prop);
|
||||
style_list->skip_trans = 0;
|
||||
style_list->ignore_cache = cahche_ori;
|
||||
|
||||
if(c1.full == c2.full) return NULL;
|
||||
obj->state = prev_state;
|
||||
@@ -4359,11 +4369,13 @@ static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop,
|
||||
}
|
||||
else if((prop & 0xF) < LV_STYLE_ID_PTR) { /*Opa*/
|
||||
style_list->skip_trans = 1;
|
||||
style_list->ignore_cache = 1;
|
||||
obj->state = prev_state;
|
||||
lv_opa_t o1 = _lv_obj_get_style_opa(obj, part, prop);
|
||||
obj->state = new_state;
|
||||
lv_opa_t o2 = _lv_obj_get_style_opa(obj, part, prop);
|
||||
style_list->skip_trans = 0;
|
||||
style_list->ignore_cache = cahche_ori;
|
||||
|
||||
if(o1 == o2) return NULL;
|
||||
|
||||
@@ -4381,10 +4393,12 @@ static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop,
|
||||
else { /*Ptr*/
|
||||
obj->state = prev_state;
|
||||
style_list->skip_trans = 1;
|
||||
style_list->ignore_cache = 1;
|
||||
const void * p1 = _lv_obj_get_style_ptr(obj, part, prop);
|
||||
obj->state = new_state;
|
||||
const void * p2 = _lv_obj_get_style_ptr(obj, part, prop);
|
||||
style_list->skip_trans = 0;
|
||||
style_list->ignore_cache = cahche_ori;
|
||||
|
||||
if(memcmp(&p1, &p2, sizeof(const void *)) == 0) return NULL;
|
||||
obj->state = prev_state;
|
||||
@@ -4782,6 +4796,10 @@ static void style_snapshot(lv_obj_t * obj, uint8_t part, style_snapshot_t * shot
|
||||
lv_draw_img_dsc_init(&shot->img);
|
||||
lv_draw_line_dsc_init(&shot->line);
|
||||
|
||||
lv_style_list_t * list = lv_obj_get_style_list(obj, part);
|
||||
bool trans_ori = list->skip_trans;
|
||||
list->skip_trans = 1;
|
||||
|
||||
lv_obj_init_draw_rect_dsc(obj, part, &shot->rect);
|
||||
lv_obj_init_draw_label_dsc(obj, part, &shot->label);
|
||||
lv_obj_init_draw_img_dsc(obj, part, &shot->img);
|
||||
@@ -4813,6 +4831,7 @@ static void style_snapshot(lv_obj_t * obj, uint8_t part, style_snapshot_t * shot
|
||||
shot->border_post = lv_obj_get_style_border_post(obj, part);
|
||||
|
||||
_lv_obj_disable_style_caching(obj, false);
|
||||
list->skip_trans = trans_ori;
|
||||
}
|
||||
|
||||
static style_snapshot_res_t style_snapshot_compare(style_snapshot_t * shot1, style_snapshot_t * shot2)
|
||||
|
||||
@@ -163,6 +163,7 @@ _LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_DECOR, text_decor, lv_text_decor_t, _int, sca
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_BLEND_MODE, text_blend_mode, lv_blend_mode_t, _int, scalar)
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_COLOR, text_color, lv_color_t, _color, nonscalar)
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_SEL_COLOR, text_sel_color, lv_color_t, _color, nonscalar)
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_SEL_BG_COLOR, text_sel_bg_color, lv_color_t, _color, nonscalar)
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_OPA, text_opa, lv_opa_t, _opa, scalar)
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_FONT, text_font, const lv_font_t *, _ptr, scalar)
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_WIDTH, line_width, lv_style_int_t, _int, scalar)
|
||||
|
||||
@@ -159,14 +159,15 @@ enum {
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_FONT, 0x7, LV_STYLE_ID_PTR + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_STR, 0x7, LV_STYLE_ID_PTR + 1, LV_STYLE_ATTR_NONE),
|
||||
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_LETTER_SPACE, 0x8, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_LINE_SPACE, 0x8, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_DECOR, 0x8, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_BLEND_MODE, 0x8, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_COLOR, 0x8, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_SEL_COLOR, 0x8, LV_STYLE_ID_COLOR + 1, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_OPA, 0x8, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_FONT, 0x8, LV_STYLE_ID_PTR + 0, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_LETTER_SPACE, 0x8, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_LINE_SPACE, 0x8, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_DECOR, 0x8, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_BLEND_MODE, 0x8, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_COLOR, 0x8, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_SEL_COLOR, 0x8, LV_STYLE_ID_COLOR + 1, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_SEL_BG_COLOR, 0x8, LV_STYLE_ID_COLOR + 2, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_OPA, 0x8, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_FONT, 0x8, LV_STYLE_ID_PTR + 0, LV_STYLE_ATTR_INHERIT),
|
||||
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_LINE_WIDTH, 0x9, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_LINE_BLEND_MODE, 0x9, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
#include "../lv_core/lv_refr.h"
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
#include "../lv_gpu/lv_gpu_nxp_pxp.h"
|
||||
#include "../lv_gpu/lv_gpu_nxp_pxp.h"
|
||||
#elif LV_USE_GPU_NXP_VG_LITE
|
||||
#include "../lv_gpu/lv_gpu_nxp_vglite.h"
|
||||
#elif LV_USE_GPU_STM32_DMA2D
|
||||
#include "../lv_gpu/lv_gpu_stm32_dma2d.h"
|
||||
#include "../lv_gpu/lv_gpu_stm32_dma2d.h"
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
@@ -343,7 +343,7 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co
|
||||
return;
|
||||
}
|
||||
#elif LV_USE_GPU_NXP_PXP
|
||||
if(lv_area_get_size(draw_area) >= GPU_NXP_PXP_FILL_SIZE_LIMIT) {
|
||||
if(lv_area_get_size(draw_area) >= LV_GPU_NXP_PXP_FILL_SIZE_LIMIT) {
|
||||
lv_gpu_nxp_pxp_fill(disp_buf, disp_w, draw_area, color, opa);
|
||||
return;
|
||||
}
|
||||
@@ -370,7 +370,7 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co
|
||||
else {
|
||||
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
if(lv_area_get_size(draw_area) >= GPU_NXP_PXP_FILL_OPA_SIZE_LIMIT) {
|
||||
if(lv_area_get_size(draw_area) >= LV_GPU_NXP_PXP_FILL_OPA_SIZE_LIMIT) {
|
||||
lv_gpu_nxp_pxp_fill(disp_buf, disp_w, draw_area, color, opa);
|
||||
return;
|
||||
}
|
||||
@@ -757,6 +757,7 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col
|
||||
|
||||
if(opa > LV_OPA_MAX) {
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
<<<<<<< HEAD
|
||||
if (lv_area_get_size(draw_area) >= GPU_NXP_PXP_BLIT_SIZE_LIMIT) {
|
||||
lv_gpu_nxp_pxp_blit(disp_buf_first, disp_w, map_buf_first, map_w, draw_area_w, draw_area_h, opa);
|
||||
return;
|
||||
@@ -791,6 +792,11 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col
|
||||
return;
|
||||
}
|
||||
/* Fall down to SW render in case of error */
|
||||
=======
|
||||
if(lv_area_get_size(draw_area) >= LV_GPU_NXP_PXP_BLIT_SIZE_LIMIT) {
|
||||
lv_gpu_nxp_pxp_blit(disp_buf_first, disp_w, map_buf_first, map_w, draw_area_w, draw_area_h, opa);
|
||||
return;
|
||||
>>>>>>> 4c7a2ae0b7d8f564b22e7774039f6cbe5385926c
|
||||
}
|
||||
#elif LV_USE_GPU_STM32_DMA2D
|
||||
if(lv_area_get_size(draw_area) >= 240) {
|
||||
@@ -808,7 +814,7 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col
|
||||
}
|
||||
else {
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
if (lv_area_get_size(draw_area) >= GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT) {
|
||||
if(lv_area_get_size(draw_area) >= LV_GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT) {
|
||||
lv_gpu_nxp_pxp_blit(disp_buf_first, disp_w, map_buf_first, map_w, draw_area_w, draw_area_h, opa);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
#include "../lv_gpu/lv_gpu_stm32_dma2d.h"
|
||||
#elif LV_USE_GPU_NXP_PXP
|
||||
#include "../lv_gpu/lv_gpu_nxp_pxp.h"
|
||||
#include "../lv_gpu/lv_gpu_nxp_pxp.h"
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
@@ -360,18 +360,19 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
}
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
/* Simple case without masking and transformations */
|
||||
else if (other_mask_cnt == 0 && draw_dsc->angle == 0 && draw_dsc->zoom == LV_IMG_ZOOM_NONE && alpha_byte == false &&
|
||||
else if(other_mask_cnt == 0 && draw_dsc->angle == 0 && draw_dsc->zoom == LV_IMG_ZOOM_NONE && alpha_byte == false &&
|
||||
chroma_key == true && draw_dsc->recolor_opa == LV_OPA_TRANSP) { /* copy with color keying (+ alpha) */
|
||||
lv_gpu_nxp_pxp_enable_color_key();
|
||||
_lv_blend_map(clip_area, map_area, (lv_color_t *)map_p, NULL, LV_DRAW_MASK_RES_FULL_COVER, draw_dsc->opa,
|
||||
draw_dsc->blend_mode);
|
||||
lv_gpu_nxp_pxp_disable_color_key();
|
||||
} else if (other_mask_cnt == 0 && draw_dsc->angle == 0 && draw_dsc->zoom == LV_IMG_ZOOM_NONE && alpha_byte == false &&
|
||||
lv_gpu_nxp_pxp_enable_color_key();
|
||||
_lv_blend_map(clip_area, map_area, (lv_color_t *)map_p, NULL, LV_DRAW_MASK_RES_FULL_COVER, draw_dsc->opa,
|
||||
draw_dsc->blend_mode);
|
||||
lv_gpu_nxp_pxp_disable_color_key();
|
||||
}
|
||||
else if(other_mask_cnt == 0 && draw_dsc->angle == 0 && draw_dsc->zoom == LV_IMG_ZOOM_NONE && alpha_byte == false &&
|
||||
chroma_key == false && draw_dsc->recolor_opa != LV_OPA_TRANSP) { /* copy with recolor (+ alpha) */
|
||||
lv_gpu_nxp_pxp_enable_recolor(draw_dsc->recolor, draw_dsc->recolor_opa);
|
||||
_lv_blend_map(clip_area, map_area, (lv_color_t *)map_p, NULL, LV_DRAW_MASK_RES_FULL_COVER, draw_dsc->opa,
|
||||
draw_dsc->blend_mode);
|
||||
lv_gpu_nxp_pxp_disable_recolor();
|
||||
lv_gpu_nxp_pxp_enable_recolor(draw_dsc->recolor, draw_dsc->recolor_opa);
|
||||
_lv_blend_map(clip_area, map_area, (lv_color_t *)map_p, NULL, LV_DRAW_MASK_RES_FULL_COVER, draw_dsc->opa,
|
||||
draw_dsc->blend_mode);
|
||||
lv_gpu_nxp_pxp_disable_recolor();
|
||||
}
|
||||
#endif
|
||||
/*In the other cases every pixel need to be checked one-by-one*/
|
||||
|
||||
@@ -98,7 +98,8 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc)
|
||||
dsc->font = LV_THEME_DEFAULT_FONT_NORMAL;
|
||||
dsc->sel_start = LV_DRAW_LABEL_NO_TXT_SEL;
|
||||
dsc->sel_end = LV_DRAW_LABEL_NO_TXT_SEL;
|
||||
dsc->sel_color = LV_COLOR_BLUE;
|
||||
dsc->sel_color = LV_COLOR_BLACK;
|
||||
dsc->sel_bg_color = LV_COLOR_BLUE;
|
||||
dsc->bidi_dir = LV_BIDI_DIR_LTR;
|
||||
}
|
||||
|
||||
@@ -234,7 +235,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
||||
|
||||
lv_draw_rect_dsc_t draw_dsc_sel;
|
||||
lv_draw_rect_dsc_init(&draw_dsc_sel);
|
||||
draw_dsc_sel.bg_color = dsc->sel_color;
|
||||
draw_dsc_sel.bg_color = dsc->sel_bg_color;
|
||||
|
||||
int32_t pos_x_start = pos.x;
|
||||
/*Write out all lines*/
|
||||
@@ -320,6 +321,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
||||
sel_coords.x2 = pos.x + letter_w + dsc->letter_space - 1;
|
||||
sel_coords.y2 = pos.y + line_height - 1;
|
||||
lv_draw_rect(&sel_coords, mask, &draw_dsc_sel);
|
||||
color = dsc->sel_color;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ extern "C" {
|
||||
typedef struct {
|
||||
lv_color_t color;
|
||||
lv_color_t sel_color;
|
||||
lv_color_t sel_bg_color;
|
||||
const lv_font_t * font;
|
||||
lv_opa_t opa;
|
||||
lv_style_int_t line_space;
|
||||
|
||||
@@ -512,7 +512,7 @@ static bool lvgl_load_font(lv_fs_file_t * fp, lv_font_t * font)
|
||||
font->line_height = font_header.ascent - font_header.descent;
|
||||
font->get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt;
|
||||
font->get_glyph_bitmap = lv_font_get_bitmap_fmt_txt;
|
||||
font->subpx = LV_FONT_SUBPX_NONE;
|
||||
font->subpx = font_header.subpixels_mode;
|
||||
|
||||
font_dsc->bpp = font_header.bits_per_pixel;
|
||||
font_dsc->kern_scale = font_header.kerning_scale;
|
||||
|
||||
@@ -48,9 +48,6 @@
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/* PXP instance ID */
|
||||
#define PXP_ID PXP
|
||||
|
||||
#if LV_COLOR_16_SWAP
|
||||
#error Color swap not implemented. Disable LV_COLOR_16_SWAP feature.
|
||||
#endif
|
||||
@@ -76,7 +73,8 @@ static void lv_gpu_nxp_pxp_run(void);
|
||||
static void lv_gpu_nxp_pxp_blit_recolor(lv_color_t * dest, lv_coord_t dest_width, const lv_color_t * src,
|
||||
lv_coord_t src_width,
|
||||
lv_coord_t copy_width, lv_coord_t copy_height, lv_opa_t opa, lv_color_t recolor, lv_opa_t recolorOpa);
|
||||
static void lv_gpu_nxp_invalidate_cache(uint32_t address, uint32_t width, uint32_t height, uint32_t stride, uint32_t pxSize);
|
||||
static void lv_gpu_nxp_invalidate_cache(uint32_t address, uint32_t width, uint32_t height, uint32_t stride,
|
||||
uint32_t pxSize);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -135,7 +133,7 @@ void lv_gpu_nxp_pxp_deinit(void)
|
||||
{
|
||||
pxp_cfg.pxp_interrupt_deinit();
|
||||
PXP_DisableInterrupts(PXP, kPXP_CompleteInterruptEnable);
|
||||
PXP_Deinit(PXP_ID);
|
||||
PXP_Deinit(LV_GPU_NXP_PXP_ID);
|
||||
}
|
||||
|
||||
|
||||
@@ -151,8 +149,8 @@ void lv_gpu_nxp_pxp_deinit(void)
|
||||
void lv_gpu_nxp_pxp_fill(lv_color_t * dest_buf, lv_coord_t dest_width, const lv_area_t * fill_area, lv_color_t color,
|
||||
lv_opa_t opa)
|
||||
{
|
||||
PXP_Init(PXP_ID);
|
||||
PXP_EnableCsc1(PXP_ID, false); /* Disable CSC1, it is enabled by default. */
|
||||
PXP_Init(LV_GPU_NXP_PXP_ID);
|
||||
PXP_EnableCsc1(LV_GPU_NXP_PXP_ID, false); /* Disable CSC1, it is enabled by default. */
|
||||
PXP_SetProcessBlockSize(PXP, kPXP_BlockSize16); /* Block size 16x16 for higher performance */
|
||||
|
||||
/* OUT buffer configure */
|
||||
@@ -165,14 +163,15 @@ void lv_gpu_nxp_pxp_fill(lv_color_t * dest_buf, lv_coord_t dest_width, const lv_
|
||||
.width = fill_area->x2 - fill_area->x1 + 1,
|
||||
.height = fill_area->y2 - fill_area->y1 + 1,
|
||||
};
|
||||
lv_gpu_nxp_invalidate_cache(outputConfig.buffer0Addr, outputConfig.width, outputConfig.height, outputConfig.pitchBytes, sizeof(lv_color_t));
|
||||
PXP_SetOutputBufferConfig(PXP_ID, &outputConfig);
|
||||
lv_gpu_nxp_invalidate_cache(outputConfig.buffer0Addr, outputConfig.width, outputConfig.height, outputConfig.pitchBytes,
|
||||
sizeof(lv_color_t));
|
||||
PXP_SetOutputBufferConfig(LV_GPU_NXP_PXP_ID, &outputConfig);
|
||||
|
||||
if(opa > LV_OPA_MAX) {
|
||||
/* Simple color fill without opacity - AS disabled, PS as color generator */
|
||||
PXP_SetAlphaSurfacePosition(PXP_ID, 0xFFFFU, 0xFFFFU, 0U, 0U); /* Disable AS. */
|
||||
PXP_SetProcessSurfacePosition(PXP_ID, 0xFFFFU, 0xFFFFU, 0U, 0U); /* Disable PS. */
|
||||
PXP_SetProcessSurfaceBackGroundColor(PXP_ID, lv_color_to32(color));
|
||||
PXP_SetAlphaSurfacePosition(LV_GPU_NXP_PXP_ID, 0xFFFFU, 0xFFFFU, 0U, 0U); /* Disable AS. */
|
||||
PXP_SetProcessSurfacePosition(LV_GPU_NXP_PXP_ID, 0xFFFFU, 0xFFFFU, 0U, 0U); /* Disable PS. */
|
||||
PXP_SetProcessSurfaceBackGroundColor(LV_GPU_NXP_PXP_ID, lv_color_to32(color));
|
||||
}
|
||||
else {
|
||||
/* Fill with opacity - AS used as source (same as OUT), PS used as color generator, blended together */
|
||||
@@ -184,12 +183,13 @@ void lv_gpu_nxp_pxp_fill(lv_color_t * dest_buf, lv_coord_t dest_width, const lv_
|
||||
asBufferConfig.bufferAddr = (uint32_t)outputConfig.buffer0Addr;
|
||||
asBufferConfig.pitchBytes = outputConfig.pitchBytes;
|
||||
|
||||
PXP_SetAlphaSurfaceBufferConfig(PXP_ID, &asBufferConfig);
|
||||
PXP_SetAlphaSurfacePosition(PXP_ID, 0U, 0U, fill_area->x2 - fill_area->x1 + 1, fill_area->y2 - fill_area->y1 + 1);
|
||||
PXP_SetAlphaSurfaceBufferConfig(LV_GPU_NXP_PXP_ID, &asBufferConfig);
|
||||
PXP_SetAlphaSurfacePosition(LV_GPU_NXP_PXP_ID, 0U, 0U, fill_area->x2 - fill_area->x1 + 1,
|
||||
fill_area->y2 - fill_area->y1 + 1);
|
||||
|
||||
/* Disable PS, use as color generator */
|
||||
PXP_SetProcessSurfacePosition(PXP_ID, 0xFFFFU, 0xFFFFU, 0U, 0U);
|
||||
PXP_SetProcessSurfaceBackGroundColor(PXP_ID, lv_color_to32(color));
|
||||
PXP_SetProcessSurfacePosition(LV_GPU_NXP_PXP_ID, 0xFFFFU, 0xFFFFU, 0U, 0U);
|
||||
PXP_SetProcessSurfaceBackGroundColor(LV_GPU_NXP_PXP_ID, lv_color_to32(color));
|
||||
|
||||
/* Configure Porter-Duff blending - For RGB 565 only! */
|
||||
pdConfig.enable = 1;
|
||||
@@ -203,7 +203,7 @@ void lv_gpu_nxp_pxp_fill(lv_color_t * dest_buf, lv_coord_t dest_width, const lv_
|
||||
pdConfig.dstGlobalAlpha = 255 - opa;
|
||||
pdConfig.srcAlphaMode = kPXP_PorterDuffAlphaStraight; /* don't care */
|
||||
pdConfig.dstAlphaMode = kPXP_PorterDuffAlphaStraight; /* don't care */
|
||||
PXP_SetPorterDuffConfig(PXP_ID, &pdConfig);
|
||||
PXP_SetPorterDuffConfig(LV_GPU_NXP_PXP_ID, &pdConfig);
|
||||
}
|
||||
|
||||
lv_gpu_nxp_pxp_run(); /* Start PXP task */
|
||||
@@ -249,7 +249,7 @@ void lv_gpu_nxp_pxp_blit(lv_color_t * dest, lv_coord_t dest_width, const lv_colo
|
||||
|
||||
if(opa >= LV_OPA_MAX && !colorKeyEnabled) {
|
||||
/* Simple blit, no effect - Disable PS buffer */
|
||||
PXP_SetProcessSurfacePosition(PXP_ID, 0xFFFFU, 0xFFFFU, 0U, 0U);
|
||||
PXP_SetProcessSurfacePosition(LV_GPU_NXP_PXP_ID, 0xFFFFU, 0xFFFFU, 0U, 0U);
|
||||
}
|
||||
else {
|
||||
/* Alpha blending or color keying enabled - PS must be enabled to fetch background pixels
|
||||
@@ -263,24 +263,25 @@ void lv_gpu_nxp_pxp_blit(lv_color_t * dest, lv_coord_t dest_width, const lv_colo
|
||||
.pitchBytes = dest_width * sizeof(lv_color_t)
|
||||
};
|
||||
asBlendConfig.alphaMode = kPXP_AlphaOverride;
|
||||
PXP_SetProcessSurfaceBufferConfig(PXP_ID, &psBufferConfig);
|
||||
PXP_SetProcessSurfacePosition(PXP_ID, 0U, 0U, copy_width - 1, copy_height - 1);
|
||||
PXP_SetProcessSurfaceBufferConfig(LV_GPU_NXP_PXP_ID, &psBufferConfig);
|
||||
PXP_SetProcessSurfacePosition(LV_GPU_NXP_PXP_ID, 0U, 0U, copy_width - 1, copy_height - 1);
|
||||
}
|
||||
|
||||
/* AS buffer - source image */
|
||||
asBufferConfig.pixelFormat = PXP_AS_PIXEL_FORMAT;
|
||||
asBufferConfig.bufferAddr = (uint32_t)src;
|
||||
asBufferConfig.pitchBytes = src_width * sizeof(lv_color_t);
|
||||
PXP_SetAlphaSurfaceBufferConfig(PXP_ID, &asBufferConfig);
|
||||
PXP_SetAlphaSurfacePosition(PXP_ID, 0U, 0U, copy_width - 1U, copy_height - 1U);
|
||||
PXP_SetAlphaSurfaceBlendConfig(PXP_ID, &asBlendConfig);
|
||||
PXP_SetAlphaSurfaceBufferConfig(LV_GPU_NXP_PXP_ID, &asBufferConfig);
|
||||
PXP_SetAlphaSurfacePosition(LV_GPU_NXP_PXP_ID, 0U, 0U, copy_width - 1U, copy_height - 1U);
|
||||
PXP_SetAlphaSurfaceBlendConfig(LV_GPU_NXP_PXP_ID, &asBlendConfig);
|
||||
|
||||
lv_gpu_nxp_invalidate_cache(asBufferConfig.bufferAddr, copy_width, copy_height, asBufferConfig.pitchBytes, sizeof(lv_color_t));
|
||||
lv_gpu_nxp_invalidate_cache(asBufferConfig.bufferAddr, copy_width, copy_height, asBufferConfig.pitchBytes,
|
||||
sizeof(lv_color_t));
|
||||
|
||||
if(colorKeyEnabled) {
|
||||
PXP_SetAlphaSurfaceOverlayColorKey(PXP_ID, colorKey, colorKey);
|
||||
PXP_SetAlphaSurfaceOverlayColorKey(LV_GPU_NXP_PXP_ID, colorKey, colorKey);
|
||||
}
|
||||
PXP_EnableAlphaSurfaceOverlayColorKey(PXP_ID, colorKeyEnabled);
|
||||
PXP_EnableAlphaSurfaceOverlayColorKey(LV_GPU_NXP_PXP_ID, colorKeyEnabled);
|
||||
|
||||
|
||||
/* Output buffer. */
|
||||
@@ -291,9 +292,10 @@ void lv_gpu_nxp_pxp_blit(lv_color_t * dest, lv_coord_t dest_width, const lv_colo
|
||||
outputBufferConfig.pitchBytes = dest_width * sizeof(lv_color_t);
|
||||
outputBufferConfig.width = copy_width;
|
||||
outputBufferConfig.height = copy_height;
|
||||
PXP_SetOutputBufferConfig(PXP_ID, &outputBufferConfig);
|
||||
PXP_SetOutputBufferConfig(LV_GPU_NXP_PXP_ID, &outputBufferConfig);
|
||||
|
||||
lv_gpu_nxp_invalidate_cache(outputBufferConfig.buffer0Addr, outputBufferConfig.width, outputBufferConfig.height, outputBufferConfig.pitchBytes, sizeof(lv_color_t));
|
||||
lv_gpu_nxp_invalidate_cache(outputBufferConfig.buffer0Addr, outputBufferConfig.width, outputBufferConfig.height,
|
||||
outputBufferConfig.pitchBytes, sizeof(lv_color_t));
|
||||
|
||||
lv_gpu_nxp_pxp_run(); /* Start PXP task */
|
||||
}
|
||||
@@ -395,14 +397,15 @@ static void lv_gpu_nxp_pxp_blit_recolor(lv_color_t * dest, lv_coord_t dest_width
|
||||
asBufferConfig.pixelFormat = PXP_AS_PIXEL_FORMAT;
|
||||
asBufferConfig.bufferAddr = (uint32_t)src;
|
||||
asBufferConfig.pitchBytes = src_width * sizeof(lv_color_t);
|
||||
PXP_SetAlphaSurfaceBufferConfig(PXP_ID, &asBufferConfig);
|
||||
PXP_SetAlphaSurfacePosition(PXP_ID, 0U, 0U, copy_width - 1U, copy_height - 1U);
|
||||
PXP_SetAlphaSurfaceBufferConfig(LV_GPU_NXP_PXP_ID, &asBufferConfig);
|
||||
PXP_SetAlphaSurfacePosition(LV_GPU_NXP_PXP_ID, 0U, 0U, copy_width - 1U, copy_height - 1U);
|
||||
|
||||
lv_gpu_nxp_invalidate_cache(asBufferConfig.bufferAddr, copy_width, copy_height, asBufferConfig.pitchBytes, sizeof(lv_color_t));
|
||||
lv_gpu_nxp_invalidate_cache(asBufferConfig.bufferAddr, copy_width, copy_height, asBufferConfig.pitchBytes,
|
||||
sizeof(lv_color_t));
|
||||
|
||||
/* Disable PS buffer, use as color generator */
|
||||
PXP_SetProcessSurfacePosition(PXP_ID, 0xFFFFU, 0xFFFFU, 0U, 0U);
|
||||
PXP_SetProcessSurfaceBackGroundColor(PXP_ID, lv_color_to32(recolor));
|
||||
PXP_SetProcessSurfacePosition(LV_GPU_NXP_PXP_ID, 0xFFFFU, 0xFFFFU, 0U, 0U);
|
||||
PXP_SetProcessSurfaceBackGroundColor(LV_GPU_NXP_PXP_ID, lv_color_to32(recolor));
|
||||
|
||||
/* Output buffer */
|
||||
outputBufferConfig.pixelFormat = (pxp_output_pixel_format_t)PXP_OUT_PIXEL_FORMAT;
|
||||
@@ -412,9 +415,10 @@ static void lv_gpu_nxp_pxp_blit_recolor(lv_color_t * dest, lv_coord_t dest_width
|
||||
outputBufferConfig.pitchBytes = dest_width * sizeof(lv_color_t);
|
||||
outputBufferConfig.width = copy_width;
|
||||
outputBufferConfig.height = copy_height;
|
||||
PXP_SetOutputBufferConfig(PXP_ID, &outputBufferConfig);
|
||||
PXP_SetOutputBufferConfig(LV_GPU_NXP_PXP_ID, &outputBufferConfig);
|
||||
|
||||
lv_gpu_nxp_invalidate_cache(outputBufferConfig.buffer0Addr, outputBufferConfig.width, outputBufferConfig.height, outputBufferConfig.pitchBytes, sizeof(lv_color_t));
|
||||
lv_gpu_nxp_invalidate_cache(outputBufferConfig.buffer0Addr, outputBufferConfig.width, outputBufferConfig.height,
|
||||
outputBufferConfig.pitchBytes, sizeof(lv_color_t));
|
||||
|
||||
pxp_porter_duff_config_t pdConfig;
|
||||
|
||||
@@ -430,7 +434,7 @@ static void lv_gpu_nxp_pxp_blit_recolor(lv_color_t * dest, lv_coord_t dest_width
|
||||
pdConfig.dstGlobalAlpha = 255 - recolorOpa;
|
||||
pdConfig.srcAlphaMode = kPXP_PorterDuffAlphaStraight; /* don't care */
|
||||
pdConfig.dstAlphaMode = kPXP_PorterDuffAlphaStraight; /* don't care */
|
||||
PXP_SetPorterDuffConfig(PXP_ID, &pdConfig);
|
||||
PXP_SetPorterDuffConfig(LV_GPU_NXP_PXP_ID, &pdConfig);
|
||||
|
||||
lv_gpu_nxp_pxp_run(); /* Start PXP task */
|
||||
|
||||
@@ -463,11 +467,13 @@ static void lv_gpu_nxp_pxp_blit_recolor(lv_color_t * dest, lv_coord_t dest_width
|
||||
* @param[in] stride stride in bytes
|
||||
* @param[in] pxSize pixel size in bytes
|
||||
*/
|
||||
static void lv_gpu_nxp_invalidate_cache(uint32_t address, uint32_t width, uint32_t height, uint32_t stride, uint32_t pxSize) {
|
||||
static void lv_gpu_nxp_invalidate_cache(uint32_t address, uint32_t width, uint32_t height, uint32_t stride,
|
||||
uint32_t pxSize)
|
||||
{
|
||||
int y;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
DCACHE_CleanInvalidateByRange(address, width*pxSize);
|
||||
for(y = 0; y < height; y++) {
|
||||
DCACHE_CleanInvalidateByRange(address, width * pxSize);
|
||||
address += stride;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,30 +45,30 @@ extern "C" {
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/* PXP module instance to use */
|
||||
#define PXP_ID PXP
|
||||
/** PXP module instance to use */
|
||||
#define LV_GPU_NXP_PXP_ID PXP
|
||||
|
||||
/* PXP interrupt line ID */
|
||||
#define PXP_IRQ_ID PXP_IRQn
|
||||
/** PXP interrupt line ID */
|
||||
#define LV_GPU_NXP_PXP_IRQ_ID PXP_IRQn
|
||||
|
||||
/* Minimum area for image copy with 100% opacity to be handled by PXP */
|
||||
#ifndef GPU_NXP_PXP_BLIT_SIZE_LIMIT
|
||||
#define GPU_NXP_PXP_BLIT_SIZE_LIMIT 1
|
||||
#ifndef LV_GPU_NXP_PXP_BLIT_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) for image copy with 100% opacity to be handled by PXP */
|
||||
#define LV_GPU_NXP_PXP_BLIT_SIZE_LIMIT 32
|
||||
#endif
|
||||
|
||||
/* Minimum area for image copy with transparency to be handled by PXP */
|
||||
#ifndef GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT
|
||||
#define GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT 16
|
||||
#ifndef LV_GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) for image copy with transparency to be handled by PXP */
|
||||
#define LV_GPU_NXP_PXP_BLIT_OPA_SIZE_LIMIT 16
|
||||
#endif
|
||||
|
||||
/* Minimum area to be filled by PXP with 100% opacity */
|
||||
#ifndef GPU_NXP_PXP_FILL_SIZE_LIMIT
|
||||
#define GPU_NXP_PXP_FILL_SIZE_LIMIT 64
|
||||
#ifndef LV_GPU_NXP_PXP_FILL_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) to be filled by PXP with 100% opacity */
|
||||
#define LV_GPU_NXP_PXP_FILL_SIZE_LIMIT 64
|
||||
#endif
|
||||
|
||||
/* Minimum area to be filled by PXP with transparency */
|
||||
#ifndef GPU_NXP_PXP_FILL_OPA_SIZE_LIMIT
|
||||
#define GPU_NXP_PXP_FILL_OPA_SIZE_LIMIT 32
|
||||
#ifndef LV_GPU_NXP_PXP_FILL_OPA_SIZE_LIMIT
|
||||
/** Minimum area (in pixels) to be filled by PXP with transparency */
|
||||
#define LV_GPU_NXP_PXP_FILL_OPA_SIZE_LIMIT 32
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
@@ -107,7 +107,7 @@ typedef struct {
|
||||
*
|
||||
* @return LV_RES_OK: PXP init ok; LV_RES_INV: init error. See error log for more information.
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_pxp_init(lv_nxp_pxp_cfg_t *cfg);
|
||||
lv_res_t lv_gpu_nxp_pxp_init(lv_nxp_pxp_cfg_t * cfg);
|
||||
|
||||
/**
|
||||
* Disable PXP device. Should be called during display deinit sequence.
|
||||
@@ -123,7 +123,8 @@ void lv_gpu_nxp_pxp_deinit(void);
|
||||
* @param[in] color color
|
||||
* @param[in] opa transparency of the color
|
||||
*/
|
||||
void lv_gpu_nxp_pxp_fill(lv_color_t *dest_buf, lv_coord_t dest_width, const lv_area_t *fill_area, lv_color_t color, lv_opa_t opa);
|
||||
void lv_gpu_nxp_pxp_fill(lv_color_t * dest_buf, lv_coord_t dest_width, const lv_area_t * fill_area, lv_color_t color,
|
||||
lv_opa_t opa);
|
||||
|
||||
|
||||
|
||||
@@ -143,7 +144,8 @@ void lv_gpu_nxp_pxp_fill(lv_color_t *dest_buf, lv_coord_t dest_width, const lv_a
|
||||
* @param[in] copy_h height of area to be copied from src to dest
|
||||
* @param[in] opa opacity of the result
|
||||
*/
|
||||
void lv_gpu_nxp_pxp_blit(lv_color_t * dest, lv_coord_t dest_width, const lv_color_t * src, lv_coord_t src_width, lv_coord_t copy_width, lv_coord_t copy_height, lv_opa_t opa);
|
||||
void lv_gpu_nxp_pxp_blit(lv_color_t * dest, lv_coord_t dest_width, const lv_color_t * src, lv_coord_t src_width,
|
||||
lv_coord_t copy_width, lv_coord_t copy_height, lv_opa_t opa);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -86,8 +86,8 @@ void PXP_IRQHandler(void)
|
||||
BaseType_t taskAwake = pdFALSE;
|
||||
#endif
|
||||
|
||||
if(kPXP_CompleteFlag & PXP_GetStatusFlags(PXP_ID)) {
|
||||
PXP_ClearStatusFlags(PXP_ID, kPXP_CompleteFlag);
|
||||
if(kPXP_CompleteFlag & PXP_GetStatusFlags(LV_GPU_NXP_PXP_ID)) {
|
||||
PXP_ClearStatusFlags(LV_GPU_NXP_PXP_ID, kPXP_CompleteFlag);
|
||||
#if defined(FSL_RTOS_FREE_RTOS)
|
||||
xSemaphoreGiveFromISR(s_pxpIdle, &taskAwake);
|
||||
portYIELD_FROM_ISR(taskAwake);
|
||||
@@ -113,12 +113,12 @@ static lv_res_t _lv_gpu_nxp_pxp_interrupt_init(void)
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
NVIC_SetPriority(PXP_IRQ_ID, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY + 1);
|
||||
NVIC_SetPriority(LV_GPU_NXP_PXP_IRQ_ID, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY + 1);
|
||||
#else
|
||||
s_pxpIdle = true;
|
||||
#endif
|
||||
|
||||
NVIC_EnableIRQ(PXP_IRQ_ID);
|
||||
NVIC_EnableIRQ(LV_GPU_NXP_PXP_IRQ_ID);
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
@@ -128,7 +128,7 @@ static lv_res_t _lv_gpu_nxp_pxp_interrupt_init(void)
|
||||
*/
|
||||
static void _lv_gpu_nxp_pxp_interrupt_deinit(void)
|
||||
{
|
||||
NVIC_DisableIRQ(PXP_IRQ_ID);
|
||||
NVIC_DisableIRQ(LV_GPU_NXP_PXP_IRQ_ID);
|
||||
#if defined(FSL_RTOS_FREE_RTOS)
|
||||
vSemaphoreDelete(s_pxpIdle);
|
||||
#endif
|
||||
@@ -143,8 +143,8 @@ static void _lv_gpu_nxp_pxp_run(void)
|
||||
s_pxpIdle = false;
|
||||
#endif
|
||||
|
||||
PXP_EnableInterrupts(PXP_ID, kPXP_CompleteInterruptEnable);
|
||||
PXP_Start(PXP_ID);
|
||||
PXP_EnableInterrupts(LV_GPU_NXP_PXP_ID, kPXP_CompleteInterruptEnable);
|
||||
PXP_Start(LV_GPU_NXP_PXP_ID);
|
||||
|
||||
#if defined(FSL_RTOS_FREE_RTOS)
|
||||
if(xSemaphoreTake(s_pxpIdle, portMAX_DELAY) != pdTRUE) {
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
#define COLOR_BG_SEC_TEXT (IS_LIGHT ? lv_color_hex(0x31404f) : lv_color_hex(0xa5a8ad))
|
||||
#define COLOR_BG_SEC_TEXT_DIS (IS_LIGHT ? lv_color_hex(0xaaaaaa) : lv_color_hex(0xa5a8ad))
|
||||
|
||||
#define TRANSITION_TIME ((theme.flags & LV_THEME_MATERIAL_FLAG_NO_TRANSITION) ? 0 : 150)
|
||||
#define TRANSITION_TIME 0/*((theme.flags & LV_THEME_MATERIAL_FLAG_NO_TRANSITION) ? 0 : 150)*/
|
||||
#define BORDER_WIDTH LV_DPX(2)
|
||||
#define OUTLINE_WIDTH ((theme.flags & LV_THEME_MATERIAL_FLAG_NO_FOCUS) ? 0 : LV_DPX(2))
|
||||
#define IS_LIGHT (theme.flags & LV_THEME_MATERIAL_FLAG_LIGHT)
|
||||
@@ -204,7 +204,6 @@ static void basic_init(void)
|
||||
lv_style_set_bg_color(&styles->scr, LV_STATE_DEFAULT, COLOR_SCR);
|
||||
lv_style_set_text_color(&styles->scr, LV_STATE_DEFAULT, COLOR_SCR_TEXT);
|
||||
lv_style_set_value_color(&styles->scr, LV_STATE_DEFAULT, COLOR_SCR_TEXT);
|
||||
lv_style_set_text_font(&styles->scr, LV_STATE_DEFAULT, theme.font_normal);
|
||||
lv_style_set_value_font(&styles->scr, LV_STATE_DEFAULT, theme.font_normal);
|
||||
|
||||
style_init_reset(&styles->bg);
|
||||
@@ -217,7 +216,6 @@ static void basic_init(void)
|
||||
lv_style_set_border_color(&styles->bg, LV_STATE_EDITED, theme.color_secondary);
|
||||
lv_style_set_border_width(&styles->bg, LV_STATE_DEFAULT, BORDER_WIDTH);
|
||||
lv_style_set_border_post(&styles->bg, LV_STATE_DEFAULT, true);
|
||||
lv_style_set_text_font(&styles->bg, LV_STATE_DEFAULT, theme.font_normal);
|
||||
lv_style_set_text_color(&styles->bg, LV_STATE_DEFAULT, COLOR_BG_TEXT);
|
||||
lv_style_set_value_font(&styles->bg, LV_STATE_DEFAULT, theme.font_normal);
|
||||
lv_style_set_value_color(&styles->bg, LV_STATE_DEFAULT, COLOR_BG_TEXT);
|
||||
@@ -849,7 +847,6 @@ static void tabview_win_shared_init(void)
|
||||
lv_style_set_border_width(&styles->tabview_btns_bg, LV_STATE_DEFAULT, LV_DPX(5));
|
||||
lv_style_set_border_side(&styles->tabview_btns_bg, LV_STATE_DEFAULT, LV_BORDER_SIDE_BOTTOM);
|
||||
lv_style_set_text_color(&styles->tabview_btns_bg, LV_STATE_DEFAULT, COLOR_SCR_TEXT);
|
||||
lv_style_set_text_font(&styles->tabview_btns_bg, LV_STATE_DEFAULT, theme.font_normal);
|
||||
lv_style_set_image_recolor(&styles->tabview_btns_bg, LV_STATE_DEFAULT, lv_color_hex(0x979a9f));
|
||||
lv_style_set_pad_top(&styles->tabview_btns_bg, LV_STATE_DEFAULT, LV_DPX(7));
|
||||
lv_style_set_pad_left(&styles->tabview_btns_bg, LV_STATE_DEFAULT, LV_DPX(7));
|
||||
@@ -1257,6 +1254,9 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
_lv_style_list_add_style(list, &styles->pad_small);
|
||||
_lv_style_list_add_style(list, &styles->chart_series_bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_CURSOR);
|
||||
_lv_style_list_add_style(list, &styles->chart_series_bg);
|
||||
|
||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES);
|
||||
_lv_style_list_add_style(list, &styles->chart_series);
|
||||
break;
|
||||
|
||||
@@ -51,10 +51,10 @@ static lv_style_list_t * lv_chart_get_style(lv_obj_t * chart, uint8_t part);
|
||||
static void draw_series_bg(lv_obj_t * chart, const lv_area_t * series_area, const lv_area_t * mask);
|
||||
static void draw_series_line(lv_obj_t * chart, const lv_area_t * series_area, const lv_area_t * clip_area);
|
||||
static void draw_series_column(lv_obj_t * chart, const lv_area_t * series_area, const lv_area_t * clip_area);
|
||||
static void draw_cursors(lv_obj_t * chart, const lv_area_t * series_area, const lv_area_t * clip_area);
|
||||
static void draw_axes(lv_obj_t * chart, const lv_area_t * series_area, const lv_area_t * mask);
|
||||
static void invalidate_lines(lv_obj_t * chart, uint16_t i);
|
||||
static void invalidate_columns(lv_obj_t * chart, uint16_t i);
|
||||
static void get_series_area(lv_obj_t * chart, lv_area_t * series_area);
|
||||
static void get_next_axis_label(lv_chart_label_iterator_t * iterator, char * buf);
|
||||
static inline bool is_tick_with_label(uint8_t tick_num, lv_chart_axis_cfg_t * axis);
|
||||
static lv_chart_label_iterator_t create_axis_label_iter(const char * list, uint8_t iterator_dir);
|
||||
@@ -98,6 +98,7 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
}
|
||||
|
||||
_lv_ll_init(&ext->series_ll, sizeof(lv_chart_series_t));
|
||||
_lv_ll_init(&ext->cursors_ll, sizeof(lv_chart_cursor_t));
|
||||
|
||||
uint8_t i;
|
||||
for(i = 0; i < _LV_CHART_AXIS_LAST; i++) {
|
||||
@@ -122,6 +123,7 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
lv_style_list_init(&ext->style_series_bg);
|
||||
lv_style_list_init(&ext->style_series);
|
||||
lv_style_list_init(&ext->style_cursors);
|
||||
|
||||
if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(chart);
|
||||
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(chart);
|
||||
@@ -140,6 +142,7 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
lv_style_list_copy(&ext->style_series, &ext_copy->style_series);
|
||||
lv_style_list_copy(&ext->style_series_bg, &ext_copy->style_series_bg);
|
||||
lv_style_list_copy(&ext->style_cursors, &ext_copy->style_cursors);
|
||||
|
||||
ext->type = ext_copy->type;
|
||||
ext->hdiv_cnt = ext_copy->hdiv_cnt;
|
||||
@@ -204,6 +207,23 @@ lv_chart_series_t * lv_chart_add_series(lv_obj_t * chart, lv_color_t color)
|
||||
return ser;
|
||||
}
|
||||
|
||||
lv_chart_cursor_t * lv_chart_add_cursor(lv_obj_t * chart, lv_color_t color, lv_cursor_direction_t axes)
|
||||
{
|
||||
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
|
||||
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
lv_chart_cursor_t * cursor = _lv_ll_ins_head(&ext->cursors_ll);
|
||||
LV_ASSERT_MEM(cursor);
|
||||
if(cursor == NULL) return NULL;
|
||||
|
||||
cursor->point.x = 0U;
|
||||
cursor->point.y = LV_CHART_POINT_DEF;
|
||||
cursor->color = color;
|
||||
cursor->axes = axes;
|
||||
|
||||
return cursor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the point of a series
|
||||
* @param chart pointer to a chart object
|
||||
@@ -629,6 +649,23 @@ void lv_chart_set_series_axis(lv_obj_t * chart, lv_chart_series_t * ser, lv_char
|
||||
lv_chart_refresh(chart);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the coordinate of the cursor with respect
|
||||
* to the origin of series area of the chart.
|
||||
* @param chart pointer to a chart object.
|
||||
* @param cursor pointer to the cursor.
|
||||
* @param point the new coordinate of cursor relative to the series area
|
||||
*/
|
||||
void lv_chart_set_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * cursor, lv_point_t * point)
|
||||
{
|
||||
LV_ASSERT_NULL(cursor);
|
||||
LV_UNUSED(chart);
|
||||
|
||||
cursor->point.x = point->x;
|
||||
cursor->point.y = point->y;
|
||||
lv_chart_refresh(chart);
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
@@ -702,6 +739,137 @@ lv_chart_axis_t lv_chart_get_series_axis(lv_obj_t * chart, lv_chart_series_t * s
|
||||
|
||||
return ser->y_axis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the coordinate of the cursor with respect
|
||||
* to the origin of series area of the chart.
|
||||
* @param chart pointer to a chart object
|
||||
* @param cursor pointer to cursor
|
||||
* @return coordinate of the cursor as lv_point_t
|
||||
*/
|
||||
lv_point_t lv_chart_get_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * cursor)
|
||||
{
|
||||
LV_ASSERT_NULL(cursor);
|
||||
LV_UNUSED(chart);
|
||||
|
||||
return cursor->point;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the nearest index to an X coordinate
|
||||
* @param chart pointer to a chart object
|
||||
* @param coord the coordination of the point relative to the series area.
|
||||
* @return the found index
|
||||
*/
|
||||
uint16_t lv_chart_get_nearest_index_from_coord(lv_obj_t * chart, lv_coord_t x)
|
||||
{
|
||||
lv_area_t series_area;
|
||||
lv_chart_get_series_area(chart, &series_area);
|
||||
|
||||
lv_coord_t w = lv_area_get_width(&series_area);
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
|
||||
if(x < 0) return 0;
|
||||
if(x > w) return ext->point_cnt - 1;
|
||||
if(ext->type == LV_CHART_TYPE_LINE) return (x * (ext->point_cnt - 1) + w / 2) / w;
|
||||
if(ext->type == LV_CHART_TYPE_COLUMN) return (x * ext->point_cnt) / w;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the x coordinate of the an index with respect
|
||||
* to the origin of series area of the chart.
|
||||
* @param chart pointer to a chart object
|
||||
* @param ser pointer to series
|
||||
* @param id the index.
|
||||
* @return x coordinate of index
|
||||
*/
|
||||
lv_coord_t lv_chart_get_x_from_index(lv_obj_t * chart, lv_chart_series_t * ser, uint16_t id)
|
||||
{
|
||||
LV_ASSERT_NULL(chart);
|
||||
LV_ASSERT_NULL(ser);
|
||||
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
if(id >= ext->point_cnt) {
|
||||
LV_LOG_WARN("Invalid index: %d", id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lv_area_t series_area;
|
||||
lv_chart_get_series_area(chart, &series_area);
|
||||
|
||||
lv_coord_t w = lv_area_get_width(&series_area);
|
||||
|
||||
lv_coord_t x = 0;
|
||||
|
||||
|
||||
if(ext->type & LV_CHART_TYPE_LINE) {
|
||||
x = (w * id) / (ext->point_cnt - 1);
|
||||
} else if(ext->type & LV_CHART_TYPE_COLUMN) {
|
||||
lv_coord_t col_w = w / ((_lv_ll_get_len(&ext->series_ll) + 1) * ext->point_cnt); /* Suppose + 1 series as separator*/
|
||||
lv_chart_series_t * itr_ser = NULL;
|
||||
lv_style_int_t col_space = lv_obj_get_style_pad_inner(chart, LV_CHART_PART_SERIES);
|
||||
|
||||
x = (int32_t)((int32_t)w * id) / ext->point_cnt;
|
||||
x += col_w / 2; /*Start offset*/
|
||||
|
||||
_LV_LL_READ_BACK(ext->series_ll, itr_ser) {
|
||||
if(itr_ser == ser) break;
|
||||
x += col_w;
|
||||
}
|
||||
|
||||
x += (col_w - col_space) / 2;
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the y coordinate of the an index with respect
|
||||
* to the origin of series area of the chart.
|
||||
* @param chart pointer to a chart object
|
||||
* @param ser pointer to series
|
||||
* @param id the index.
|
||||
* @return y coordinate of index
|
||||
*/
|
||||
lv_coord_t lv_chart_get_y_from_index(lv_obj_t * chart, lv_chart_series_t * ser, uint16_t id)
|
||||
{
|
||||
LV_ASSERT_NULL(chart);
|
||||
LV_ASSERT_NULL(ser);
|
||||
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
if(id >= ext->point_cnt) {
|
||||
LV_LOG_WARN("Invalid index: %d", id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lv_area_t series_area;
|
||||
lv_chart_get_series_area(chart, &series_area);
|
||||
|
||||
lv_coord_t h = lv_area_get_height(&series_area);
|
||||
|
||||
int32_t y = (int32_t)((int32_t)ser->points[id] - ext->ymin[ser->y_axis]) * h;
|
||||
y = y / (ext->ymax[ser->y_axis] - ext->ymin[ser->y_axis]);
|
||||
y = h - y;
|
||||
|
||||
return (lv_coord_t)y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the series area of a chart.
|
||||
* @param chart pointer to a chart object
|
||||
* @param series_area pointer to an area variable that the result will be put in.
|
||||
*/
|
||||
void lv_chart_get_series_area(lv_obj_t * chart, lv_area_t * series_area)
|
||||
{
|
||||
lv_area_copy(series_area, &chart->coords);
|
||||
series_area->x1 += lv_obj_get_style_pad_left(chart, LV_CHART_PART_BG);
|
||||
series_area->x2 -= lv_obj_get_style_pad_right(chart, LV_CHART_PART_BG);
|
||||
series_area->y1 += lv_obj_get_style_pad_top(chart, LV_CHART_PART_BG);
|
||||
series_area->y2 -= lv_obj_get_style_pad_bottom(chart, LV_CHART_PART_BG);
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
*====================*/
|
||||
@@ -744,7 +912,7 @@ static lv_design_res_t lv_chart_design(lv_obj_t * chart, const lv_area_t * clip_
|
||||
lv_draw_rect(&chart->coords, clip_area, &bg_dsc);
|
||||
|
||||
lv_area_t series_area;
|
||||
get_series_area(chart, &series_area);
|
||||
lv_chart_get_series_area(chart, &series_area);
|
||||
|
||||
draw_series_bg(chart, &series_area, clip_area);
|
||||
draw_axes(chart, &series_area, clip_area);
|
||||
@@ -753,6 +921,7 @@ static lv_design_res_t lv_chart_design(lv_obj_t * chart, const lv_area_t * clip_
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
if(ext->type & LV_CHART_TYPE_LINE) draw_series_line(chart, &series_area, clip_area);
|
||||
if(ext->type & LV_CHART_TYPE_COLUMN) draw_series_column(chart, &series_area, clip_area);
|
||||
draw_cursors(chart, &series_area, clip_area);
|
||||
|
||||
}
|
||||
return LV_DESIGN_RES_OK;
|
||||
@@ -794,6 +963,7 @@ static lv_res_t lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param
|
||||
_lv_ll_clear(&ext->series_ll);
|
||||
|
||||
lv_obj_clean_style_list(chart, LV_CHART_PART_SERIES);
|
||||
lv_obj_clean_style_list(chart, LV_CHART_PART_CURSOR);
|
||||
lv_obj_clean_style_list(chart, LV_CHART_PART_SERIES_BG);
|
||||
}
|
||||
|
||||
@@ -824,6 +994,9 @@ static lv_style_list_t * lv_chart_get_style(lv_obj_t * chart, uint8_t part)
|
||||
case LV_CHART_PART_SERIES:
|
||||
style_dsc_p = &ext->style_series;
|
||||
break;
|
||||
case LV_CHART_PART_CURSOR:
|
||||
style_dsc_p = &ext->style_cursors;
|
||||
break;
|
||||
default:
|
||||
style_dsc_p = NULL;
|
||||
}
|
||||
@@ -1120,6 +1293,94 @@ static void draw_series_column(lv_obj_t * chart, const lv_area_t * series_area,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the cursors as lines on a chart
|
||||
* @param chart pointer to chart object
|
||||
* @param clip_area the object will be drawn only in this area
|
||||
*/
|
||||
static void draw_cursors(lv_obj_t * chart, const lv_area_t * series_area, const lv_area_t * clip_area)
|
||||
{
|
||||
lv_area_t series_mask;
|
||||
bool mask_ret = _lv_area_intersect(&series_mask, series_area, clip_area);
|
||||
if(mask_ret == false) return;
|
||||
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
if(_lv_ll_is_empty(&ext->cursors_ll)) return;
|
||||
|
||||
lv_point_t p1;
|
||||
lv_point_t p2;
|
||||
lv_chart_cursor_t * cursor;
|
||||
|
||||
lv_draw_line_dsc_t line_dsc;
|
||||
lv_draw_line_dsc_init(&line_dsc);
|
||||
lv_obj_init_draw_line_dsc(chart, LV_CHART_PART_CURSOR, &line_dsc);
|
||||
|
||||
lv_draw_rect_dsc_t point_dsc;
|
||||
lv_draw_rect_dsc_init(&point_dsc);
|
||||
point_dsc.bg_opa = line_dsc.opa;
|
||||
point_dsc.radius = LV_RADIUS_CIRCLE;
|
||||
|
||||
lv_coord_t point_radius = lv_obj_get_style_size(chart, LV_CHART_PART_CURSOR);
|
||||
|
||||
/*Do not bother with line ending is the point will over it*/
|
||||
if(point_radius > line_dsc.width / 2) line_dsc.raw_end = 1;
|
||||
|
||||
/*Go through all cursor lines*/
|
||||
_LV_LL_READ_BACK(ext->cursors_ll, cursor) {
|
||||
line_dsc.color = cursor->color;
|
||||
point_dsc.bg_color = cursor->color;
|
||||
|
||||
if(cursor->axes & LV_CHART_CURSOR_RIGHT) {
|
||||
p1.x = series_area->x1 + cursor->point.x;
|
||||
p1.y = series_area->y1 + cursor->point.y;
|
||||
p2.x = series_area->x2;
|
||||
p2.y = p1.y;
|
||||
lv_draw_line(&p1, &p2, &series_mask, &line_dsc);
|
||||
}
|
||||
|
||||
if(cursor->axes & LV_CHART_CURSOR_UP) {
|
||||
|
||||
p1.x = series_area->x1 + cursor->point.x;
|
||||
p1.y = series_area->y1;
|
||||
p2.x = p1.x;
|
||||
p2.y = series_area->y1 + cursor->point.y;
|
||||
lv_draw_line(&p1, &p2, &series_mask, &line_dsc);
|
||||
}
|
||||
|
||||
if(cursor->axes & LV_CHART_CURSOR_LEFT) {
|
||||
p1.x = series_area->x1;
|
||||
p1.y = series_area->y1 + cursor->point.y;
|
||||
p2.x = p1.x + cursor->point.x;
|
||||
p2.y = p1.y;
|
||||
lv_draw_line(&p1, &p2, &series_mask, &line_dsc);
|
||||
}
|
||||
|
||||
if(cursor->axes & LV_CHART_CURSOR_DOWN) {
|
||||
|
||||
p1.x = series_area->x1 + cursor->point.x;
|
||||
p1.y = series_area->y1 + cursor->point.y;
|
||||
p2.x = p1.x;
|
||||
p2.y = series_area->y2;
|
||||
lv_draw_line(&p1, &p2, &series_mask, &line_dsc);
|
||||
}
|
||||
|
||||
if(point_radius) {
|
||||
lv_area_t point_area;
|
||||
|
||||
point_area.x1 = series_area->x1 + cursor->point.x - point_radius;
|
||||
point_area.x2 = series_area->x1 + cursor->point.x + point_radius;
|
||||
|
||||
point_area.y1 = series_area->y1 + cursor->point.y - point_radius;
|
||||
point_area.y2 = series_area->y1 + cursor->point.y + point_radius;
|
||||
|
||||
/*Don't limit to `series_mask` to get full circles on the ends*/
|
||||
lv_draw_rect(&point_area, clip_area, &point_dsc);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create iterator for newline-separated list
|
||||
* @param list pointer to newline-separated labels list
|
||||
@@ -1498,7 +1759,7 @@ static void invalidate_lines(lv_obj_t * chart, uint16_t i)
|
||||
if(i >= ext->point_cnt) return;
|
||||
|
||||
lv_area_t series_area;
|
||||
get_series_area(chart, &series_area);
|
||||
lv_chart_get_series_area(chart, &series_area);
|
||||
|
||||
lv_coord_t w = lv_area_get_width(&series_area);
|
||||
lv_coord_t x_ofs = series_area.x1;
|
||||
@@ -1535,7 +1796,7 @@ static void invalidate_columns(lv_obj_t * chart, uint16_t i)
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
|
||||
lv_area_t series_area;
|
||||
get_series_area(chart, &series_area);
|
||||
lv_chart_get_series_area(chart, &series_area);
|
||||
|
||||
lv_area_t col_a;
|
||||
lv_coord_t w = lv_area_get_width(&series_area);
|
||||
@@ -1553,13 +1814,4 @@ static void invalidate_columns(lv_obj_t * chart, uint16_t i)
|
||||
_lv_inv_area(lv_obj_get_disp(chart), &col_a);
|
||||
}
|
||||
|
||||
static void get_series_area(lv_obj_t * chart, lv_area_t * series_area)
|
||||
{
|
||||
lv_area_copy(series_area, &chart->coords);
|
||||
series_area->x1 += lv_obj_get_style_pad_left(chart, LV_CHART_PART_BG);
|
||||
series_area->x2 -= lv_obj_get_style_pad_right(chart, LV_CHART_PART_BG);
|
||||
series_area->y1 += lv_obj_get_style_pad_top(chart, LV_CHART_PART_BG);
|
||||
series_area->y2 -= lv_obj_get_style_pad_bottom(chart, LV_CHART_PART_BG);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -61,6 +61,15 @@ enum {
|
||||
};
|
||||
typedef uint8_t lv_chart_axis_t;
|
||||
|
||||
enum {
|
||||
LV_CHART_CURSOR_NONE = 0x00,
|
||||
LV_CHART_CURSOR_RIGHT = 0x01,
|
||||
LV_CHART_CURSOR_UP = 0x02,
|
||||
LV_CHART_CURSOR_LEFT = 0x04,
|
||||
LV_CHART_CURSOR_DOWN = 0x08
|
||||
};
|
||||
typedef uint8_t lv_cursor_direction_t;
|
||||
|
||||
typedef struct {
|
||||
lv_coord_t * points;
|
||||
lv_color_t color;
|
||||
@@ -69,6 +78,12 @@ typedef struct {
|
||||
lv_chart_axis_t y_axis : 1;
|
||||
} lv_chart_series_t;
|
||||
|
||||
typedef struct {
|
||||
lv_point_t point;
|
||||
lv_color_t color;
|
||||
lv_cursor_direction_t axes : 4;
|
||||
} lv_chart_cursor_t;
|
||||
|
||||
/** Data of axis */
|
||||
enum {
|
||||
LV_CHART_AXIS_SKIP_LAST_TICK = 0x00, /**< don't draw the last tick */
|
||||
@@ -90,6 +105,7 @@ typedef struct {
|
||||
/*No inherited ext*/ /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
lv_ll_t series_ll; /*Linked list for the data line pointers (stores lv_chart_series_t)*/
|
||||
lv_ll_t cursors_ll; /*Linked list for the cursor pointers (stores lv_chart_cursor_t)*/
|
||||
lv_coord_t ymin[_LV_CHART_AXIS_LAST]; /*y min values for both axis (used to scale the data)*/
|
||||
lv_coord_t ymax[_LV_CHART_AXIS_LAST]; /*y max values for both axis (used to scale the data)*/
|
||||
uint8_t hdiv_cnt; /*Number of horizontal division lines*/
|
||||
@@ -97,6 +113,7 @@ typedef struct {
|
||||
uint16_t point_cnt; /*Point number in a data line*/
|
||||
lv_style_list_t style_series_bg;
|
||||
lv_style_list_t style_series;
|
||||
lv_style_list_t style_cursors;
|
||||
lv_chart_type_t type; /*Line, column or point chart (from 'lv_chart_type_t')*/
|
||||
lv_chart_axis_cfg_t y_axis;
|
||||
lv_chart_axis_cfg_t x_axis;
|
||||
@@ -108,7 +125,8 @@ typedef struct {
|
||||
enum {
|
||||
LV_CHART_PART_BG = LV_OBJ_PART_MAIN,
|
||||
LV_CHART_PART_SERIES_BG = _LV_OBJ_PART_VIRTUAL_LAST,
|
||||
LV_CHART_PART_SERIES
|
||||
LV_CHART_PART_SERIES,
|
||||
LV_CHART_PART_CURSOR
|
||||
};
|
||||
|
||||
/**********************
|
||||
@@ -136,6 +154,15 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, const lv_obj_t * copy);
|
||||
*/
|
||||
lv_chart_series_t * lv_chart_add_series(lv_obj_t * chart, lv_color_t color);
|
||||
|
||||
/**
|
||||
* Add a cursor with a given color
|
||||
* @param chart pointer to chart object
|
||||
* @param color color of the cursor
|
||||
* @param dir direction of the cursor. `LV_CHART_CURSOR_RIGHT/LEFT/TOP/DOWN`. OR-ed vaéues are possible
|
||||
* @return pointer to the created cursor
|
||||
*/
|
||||
lv_chart_cursor_t * lv_chart_add_cursor(lv_obj_t * chart, lv_color_t color, lv_cursor_direction_t dir);
|
||||
|
||||
/**
|
||||
* Clear the point of a series
|
||||
* @param chart pointer to a chart object
|
||||
@@ -307,6 +334,16 @@ void lv_chart_set_point_id(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t
|
||||
*/
|
||||
void lv_chart_set_series_axis(lv_obj_t * chart, lv_chart_series_t * ser, lv_chart_axis_t axis);
|
||||
|
||||
/**
|
||||
* Set the coordinate of the cursor with respect
|
||||
* to the origin of series area of the chart.
|
||||
* @param chart pointer to a chart object.
|
||||
* @param cursor pointer to the cursor.
|
||||
* @param point the new coordinate of cursor relative to the series area
|
||||
*/
|
||||
void lv_chart_set_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * cursor, lv_point_t * point);
|
||||
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
@@ -349,6 +386,50 @@ lv_coord_t lv_chart_get_point_id(lv_obj_t * chart, lv_chart_series_t * ser, uint
|
||||
*/
|
||||
lv_chart_axis_t lv_chart_get_series_axis(lv_obj_t * chart, lv_chart_series_t * ser);
|
||||
|
||||
/**
|
||||
* Get an individual point y value in the chart series directly based on index
|
||||
* @param chart pointer to a chart object
|
||||
* @param series_area pointer to an area variable that the result will put in.
|
||||
*/
|
||||
void lv_chart_get_series_area(lv_obj_t * chart, lv_area_t * series_area);
|
||||
|
||||
/**
|
||||
* Get the coordinate of the cursor with respect
|
||||
* to the origin of series area of the chart.
|
||||
* @param chart pointer to a chart object
|
||||
* @param cursor pointer to cursor
|
||||
* @return coordinate of the cursor as lv_point_t
|
||||
*/
|
||||
lv_point_t lv_chart_get_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * cursor);
|
||||
|
||||
/**
|
||||
* Get the nearest index to an X coordinate
|
||||
* @param chart pointer to a chart object
|
||||
* @param coord the coordination of the point relative to the series area.
|
||||
* @return the found index
|
||||
*/
|
||||
uint16_t lv_chart_get_nearest_index_from_coord(lv_obj_t * chart, lv_coord_t x);
|
||||
|
||||
/**
|
||||
* Get the x coordinate of the an index with respect
|
||||
* to the origin of series area of the chart.
|
||||
* @param chart pointer to a chart object
|
||||
* @param ser pointer to series
|
||||
* @param id the index.
|
||||
* @return x coordinate of index
|
||||
*/
|
||||
lv_coord_t lv_chart_get_x_from_index(lv_obj_t * chart, lv_chart_series_t * ser, uint16_t id);
|
||||
|
||||
/**
|
||||
* Get the y coordinate of the an index with respect
|
||||
* to the origin of series area of the chart.
|
||||
* @param chart pointer to a chart object
|
||||
* @param ser pointer to series
|
||||
* @param id the index.
|
||||
* @return y coordinate of index
|
||||
*/
|
||||
lv_coord_t lv_chart_get_y_from_index(lv_obj_t * chart, lv_chart_series_t * ser, uint16_t id);
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
*====================*/
|
||||
|
||||
@@ -468,6 +468,9 @@ static lv_res_t lv_imgbtn_signal(lv_obj_t * imgbtn, lv_signal_t sign, void * par
|
||||
imgbtn->ext_draw_pad = LV_MATH_MAX(imgbtn->ext_draw_pad, top);
|
||||
imgbtn->ext_draw_pad = LV_MATH_MAX(imgbtn->ext_draw_pad, bottom);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_PRESSED || sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESS_LOST) {
|
||||
refr_img(imgbtn);
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CLEANUP) {
|
||||
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
|
||||
}
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "lvgl/lvgl.h"
|
||||
#include "../../lvgl.h"
|
||||
#if LV_BUILD_TEST
|
||||
#include "../lv_test_assert.h"
|
||||
#include "lvgl/src/lv_font/lv_font_fmt_txt.h"
|
||||
#include "lvgl/src/lv_font/lv_font.h"
|
||||
#include "lvgl/src/lv_font/lv_font_loader.h"
|
||||
#include "../src/lv_font/lv_font_fmt_txt.h"
|
||||
#include "../src/lv_font/lv_font.h"
|
||||
#include "../src/lv_font/lv_font_loader.h"
|
||||
|
||||
#include "lv_test_font_loader.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "lvgl/lvgl.h"
|
||||
#include "../../lvgl.h"
|
||||
|
||||
/*******************************************************************************
|
||||
* Size: 8 px
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "lvgl/lvgl.h"
|
||||
#include "../../lvgl.h"
|
||||
|
||||
/*******************************************************************************
|
||||
* Size: 8 px
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "lvgl/lvgl.h"
|
||||
#include "../../lvgl.h"
|
||||
|
||||
/*******************************************************************************
|
||||
* Size: 20 px
|
||||
|
||||
Reference in New Issue
Block a user