add lvgl for xiuos

This commit is contained in:
Wang_Weigen 2022-01-11 17:11:17 +08:00
parent 37c247f4d7
commit c6458f1f1d
8 changed files with 65 additions and 35 deletions

View File

@ -12,11 +12,21 @@
#include "lv_demo_calendar.h"
#include <transform.h>
extern void lv_example_chart_2(void);
extern void lv_example_img_1(void);
extern void lv_example_img_2(void);
extern void lv_example_img_3(void);
extern void lv_example_img_4(void);
extern void lv_example_line_1(void);
extern void lv_example_aoteman(void);
void* lvgl_thread(void *parameter)
{
/* display demo; you may replace with your LVGL application at here */
lv_demo_calendar();
// lv_demo_calendar();
// lv_example_img_1();
// lv_example_chart_2();
// lv_example_line_1();
lv_example_aoteman();
/* handle the tasks of LVGL */
while(1)
{
@ -29,7 +39,7 @@ pthread_t lvgl_task;
static int lvgl_demo_init(void)
{
pthread_attr_t attr;
attr.schedparam.sched_priority = 20;
attr.schedparam.sched_priority = 25;
attr.stacksize = 4096;
PrivTaskCreate(&lvgl_task, &attr, lvgl_thread, NULL);

View File

@ -18,7 +18,7 @@ static void event_handler(lv_event_t * e)
void lv_demo_calendar(void)
{
lv_obj_t * calendar = lv_calendar_create(lv_scr_act());
lv_obj_set_size(calendar, 240, 240);
lv_obj_set_size(calendar, 320, 240);
lv_obj_align(calendar, LV_ALIGN_CENTER, 0, 0);
lv_obj_add_event_cb(calendar, event_handler, LV_EVENT_ALL, NULL);
@ -35,7 +35,7 @@ void lv_demo_calendar(void)
highlighted_days[1].month = 02;
highlighted_days[1].day = 11;
highlighted_days[2].year = 2022;
highlighted_days[2].year = 2021;
highlighted_days[2].month = 02;
highlighted_days[2].day = 22;
@ -46,5 +46,5 @@ void lv_demo_calendar(void)
#elif LV_USE_CALENDAR_HEADER_ARROW
lv_calendar_header_arrow_create(calendar);
#endif
lv_calendar_set_showed_date(calendar, 2021, 10);
// lv_calendar_set_showed_date(calendar, 2021, 10);
}

View File

@ -14,7 +14,8 @@ extern void lv_port_indev_init(void);
#if LV_USE_LOG && LV_LOG_PRINTF
static void lv_rt_log(const char *buf)
{
LOG_I(buf);
printf(buf);
printf("\n");
}
#endif
@ -23,12 +24,12 @@ int lv_port_init(void)
#if LV_USE_LOG && LV_LOG_PRINTF
lv_log_register_print_cb(lv_rt_log);
#endif
lv_init();
#ifndef PKG_USING_LVGL_DISP_DEVICE
lv_port_disp_init();
#endif
#ifndef PKG_USING_LVGL_INDEV_DEVICE
lv_port_indev_init();
#endif

View File

@ -154,7 +154,7 @@ typedef struct
uint16 y_pos;
uint16 width;
uint16 height;
uint8 font_size;
uint8 font_size;
uint8 *addr;
uint16 font_color;
uint16 back_color;
@ -162,18 +162,24 @@ typedef struct
typedef struct
{
uint16 x_pos;
uint16 y_pos;
uint16 pixel_color;
uint16 x_startpos;
uint16 x_endpos;
uint16 y_startpos;
uint16 y_endpos;
void* pixel_color;
}LcdPixelParam;
typedef struct
{
char type; // 0:write string;1:write dot
LcdPixelParam pixel_info;
LcdStringParam string_info;
LcdPixelParam pixel_info;
}LcdWriteParam;
#define PRIV_SYSTICK_GET (CurrentTicksGain())
#define PRIV_LCD_DEV "/dev/lcd_dev"
#define MY_DISP_HOR_RES BSP_LCD_Y_MAX
#define MY_DISP_VER_RES BSP_LCD_X_MAX
/**********************mutex**************************/
int PrivMutexCreate(pthread_mutex_t *p_mutex, const pthread_mutexattr_t *attr);

View File

@ -239,6 +239,14 @@ static void DrvLcdSetPixel(uint16_t x, uint16_t y, uint16_t color)
DrvLcdDataHalfWord(&color, 1);
}
static void DrvLcdSetPixelDot(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2,void* color)
{
uint32 size = 0;
size = (x2- x1 + 1)*(y2 - y1 + 1);
DrvLcdSetArea(x1, y1, x2, y2);
DrvLcdDataHalfWord(color, size);
}
void LcdShowChar(uint16 x,uint16 y,uint8 num,uint8 size,uint16 color,uint16 back_color)
{
uint8 temp,t1,t;
@ -460,7 +468,7 @@ static uint32 LcdWrite(void *dev, struct BusBlockWriteParam *write_param)
return -ERROR;
}
LcdWriteParam * show = (LcdWriteParam *)write_param->buffer;
KPrintf("DEBUG TYPE %d X:%d Y:%d color %d\n",show->pixel_info.x_pos, show->pixel_info.y_pos, show->pixel_info.pixel_color);
// KPrintf("DEBUG TYPE %d X1:%d X2:%d Y1:%d Y2:%d\n",show->type,show->pixel_info.x_startpos, show->pixel_info.x_endpos,show->pixel_info.y_startpos, show->pixel_info.y_endpos);
if(0 == show->type) //output string
{
LcdShowString(show->string_info.x_pos,show->string_info.y_pos,show->string_info.width,show->string_info.height,show->string_info.font_size,show->string_info.addr,show->string_info.font_color,show->string_info.back_color);
@ -468,7 +476,8 @@ static uint32 LcdWrite(void *dev, struct BusBlockWriteParam *write_param)
}
else if(1 == show->type) //output dot
{
DrvLcdSetPixel(show->pixel_info.x_pos, show->pixel_info.y_pos, show->pixel_info.pixel_color);
// DrvLcdSetPixel(show->pixel_info.x_pos, show->pixel_info.y_pos, show->pixel_info.pixel_color);
DrvLcdSetPixelDot(show->pixel_info.x_startpos,show->pixel_info.y_startpos, show->pixel_info.x_endpos, show->pixel_info.y_endpos,show->pixel_info.pixel_color);
return EOK;
}
else

View File

@ -349,11 +349,11 @@ static void* BigMemMalloc(struct DynamicBuddyMemory *dynamic_buddy, x_size_t siz
}
/* best-fit method */
for (node = dynamic_buddy->mm_freenode_list[ndx].next;
(ndx < MEM_LINKNRS ) && (node->size < allocsize);
node = node->next) {
ndx++;
};
for (node = dynamic_buddy->mm_freenode_list[ndx].next;
(ndx < MEM_LINKNRS ) && (node->size < allocsize);
node = node->next) {
ndx++;
};
/* get the best-fit freeNode */
if (node && (node->size >= allocsize)) {
struct DynamicFreeNode *remainder;
@ -1167,7 +1167,7 @@ void MemoryInfo(uint32 *total_memory, uint32 *used_memory, uint32 *max_used_memo
#ifdef TOOL_SHELL
#include <shell.h>
void ShowBuddy(void);
void ShowBuddy();
void ShowMemory(void);
/**
* This function will list the statistic information about memory.
@ -1206,16 +1206,18 @@ void ShowBuddy(void)
lock = CriticalAreaLock();
KPrintf("\n\033[41;1mlist memory information\033[0m\n", __func__);
for(int level = 0; level < MEM_LINKNRS; level++) {
KPrintf("\n %s level [%d],memory size[2^%d] \n",__func__, level,level +6);
KPrintf("%s level [%d],memory size[2^%d] \n",__func__, level,level +6);
for (debug = &ByteManager.dynamic_buddy_manager.mm_freenode_list[level]; ; ) {
if(debug->size > 0)
KPrintf(" [current node %x,next node %x, size %u, flag %x]\n",debug, debug->next,debug->size,debug->flag);
else
KPrintf(" [listhead node %x,next node %x]\n",debug, debug->next);
if(debug->next)
{
debug = debug->next;
if(debug->size == 0)
if(debug->size > 0)
KPrintf(" [current node %x,next node %x, size %u, flag %x]\n",debug, debug->next,debug->size,debug->flag);
else
KPrintf(" \n");
}
if(debug->size == 0 || NONE == debug->next)
break;
};
}

View File

@ -240,8 +240,8 @@ KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/knowing/tensorflow
endif
ifeq ($(CONFIG_LIB_LV),y)
KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/lib/lvgl_new #
KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/lib/lvgl_new/examples/porting #
KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/lib/lvgl #
KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/lib/lvgl/examples/porting #
endif

View File

@ -57,24 +57,26 @@ typedef struct
uint16 y_pos;
uint16 width;
uint16 height;
uint8 font_size;
uint8 *addr;
uint8 font_size;
uint8 *addr;
uint16 font_color;
uint16 back_color;
}LcdStringParam;
typedef struct
{
uint16 x_pos;
uint16 y_pos;
uint16 pixel_color;
uint16 x_startpos;
uint16 x_endpos;
uint16 y_startpos;
uint16 y_endpos;
void* pixel_color;
}LcdPixelParam;
typedef struct
{
char type;
LcdPixelParam pixel_info;
LcdStringParam string_info;
LcdPixelParam pixel_info;
}LcdWriteParam;
struct LcdDevDone