update lv_drivers (fix) and example
This commit is contained in:
parent
be8c8c84b6
commit
1cebbce19b
3 changed files with 33 additions and 16 deletions
|
@ -38,8 +38,8 @@
|
||||||
* Required for buffered drawing, opacity and anti-aliasing
|
* Required for buffered drawing, opacity and anti-aliasing
|
||||||
* VDB makes the double buffering, you don't need to deal with it!
|
* VDB makes the double buffering, you don't need to deal with it!
|
||||||
* Typical size: ~1/10 screen */
|
* Typical size: ~1/10 screen */
|
||||||
#define LV_VDB_SIZE (0 * LV_HOR_RES) /*Size of VDB in pixel count (1/10 screen size is good for first)*/
|
#define LV_VDB_SIZE (LV_VER_RES * LV_HOR_RES / 2) /*Size of VDB in pixel count (1/10 screen size is good for first)*/
|
||||||
#define LV_VDB_PX_BPP LV_COLOR_SIZE /*Bit-per-pixel of VDB. Useful for monochrome or non-standard color format displays. (Set `disp_drv->vdb_wr` and `disp_drv->vdb_rd` too)*/
|
#define LV_VDB_PX_BPP 1 /*Bit-per-pixel of VDB. Useful for monochrome or non-standard color format displays. (Set `disp_drv->vdb_wr` and `disp_drv->vdb_rd` too)*/
|
||||||
#define LV_VDB_ADR 0 /*Place VDB to a specific address (e.g. in external RAM) (0: allocate automatically into RAM; LV_VDB_ADR_INV: to replace it later with `lv_vdb_set_adr()`)*/
|
#define LV_VDB_ADR 0 /*Place VDB to a specific address (e.g. in external RAM) (0: allocate automatically into RAM; LV_VDB_ADR_INV: to replace it later with `lv_vdb_set_adr()`)*/
|
||||||
|
|
||||||
/* Use two Virtual Display buffers (VDB) parallelize rendering and flushing (optional)
|
/* Use two Virtual Display buffers (VDB) parallelize rendering and flushing (optional)
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
#define LV_INDEV_LONG_PRESS_REP_TIME 100 /*Repeated trigger period in long press [ms] */
|
#define LV_INDEV_LONG_PRESS_REP_TIME 100 /*Repeated trigger period in long press [ms] */
|
||||||
|
|
||||||
/*Color settings*/
|
/*Color settings*/
|
||||||
#define LV_COLOR_DEPTH 16 /*Color depth: 1/8/16/32*/
|
#define LV_COLOR_DEPTH 1 /*Color depth: 1/8/16/32*/
|
||||||
#define LV_COLOR_16_SWAP 0 /*Swap the 2 bytes of RGB565 color. Useful if the display has a 8 bit interface (e.g. SPI)*/
|
#define LV_COLOR_16_SWAP 0 /*Swap the 2 bytes of RGB565 color. Useful if the display has a 8 bit interface (e.g. SPI)*/
|
||||||
#define LV_COLOR_SCREEN_TRANSP 0 /*1: Enable screen transparency. Useful for OSD or other overlapping GUIs. Requires ARGB8888 colors*/
|
#define LV_COLOR_SCREEN_TRANSP 0 /*1: Enable screen transparency. Useful for OSD or other overlapping GUIs. Requires ARGB8888 colors*/
|
||||||
#define LV_COLOR_TRANSP LV_COLOR_LIME /*Images pixels with this color will not be drawn (with chroma keying)*/
|
#define LV_COLOR_TRANSP LV_COLOR_LIME /*Images pixels with this color will not be drawn (with chroma keying)*/
|
||||||
|
|
|
@ -63,30 +63,45 @@ static void ssd1306_task(void *pvParameters)
|
||||||
vTaskDelay(SECOND);
|
vTaskDelay(SECOND);
|
||||||
ssd1306_set_whole_display_lighting(&dev, false);
|
ssd1306_set_whole_display_lighting(&dev, false);
|
||||||
|
|
||||||
|
//Set a style for the obj
|
||||||
|
lv_style_copy(&style, &lv_style_transp);
|
||||||
|
style.text.font = &lv_font_dejavu_10; /*Unicode and symbol fonts already assigned by the library*/
|
||||||
|
style.text.color.full = 1;
|
||||||
|
style.text.opa = 255;
|
||||||
|
|
||||||
|
style.body.main_color.full = 0;
|
||||||
|
style.body.grad_color.full = 0;
|
||||||
|
style.body.shadow.color.full = 0;
|
||||||
|
style.body.border.color.full = 0;
|
||||||
|
style.body.empty = 1;
|
||||||
|
|
||||||
|
style.image.color.full = 1;
|
||||||
|
style.image.intense = 255;
|
||||||
|
style.image.opa = 255;
|
||||||
|
|
||||||
|
style.line.color.full = 1;
|
||||||
|
style.line.opa = 255;
|
||||||
|
style.line.width = 1;
|
||||||
|
style.line.rounded = false;
|
||||||
|
|
||||||
//Create main screen obj
|
//Create main screen obj
|
||||||
lv_obj_t * scr = lv_obj_create(NULL, NULL);
|
lv_obj_t * scr = lv_obj_create(NULL, NULL);
|
||||||
lv_scr_load(scr);
|
lv_scr_load(scr);
|
||||||
|
lv_obj_set_style(scr, &style);
|
||||||
|
|
||||||
//Create a simple label
|
//Create a simple label
|
||||||
label = lv_label_create(lv_scr_act(), NULL);
|
label = lv_label_create(lv_scr_act(), NULL);
|
||||||
|
lv_obj_set_style(label, &style);
|
||||||
|
|
||||||
lv_obj_align(label, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 0, 0);
|
lv_obj_align(label, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 0, 0);
|
||||||
lv_label_set_long_mode(label, LV_LABEL_LONG_BREAK);
|
lv_label_set_long_mode(label, LV_LABEL_LONG_BREAK);
|
||||||
lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
|
lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
|
||||||
lv_label_set_text(label, "lvgl work with esp-open-rtos");
|
lv_label_set_text(label, "lvgl work with esp-open-rtos");
|
||||||
lv_obj_set_width(label, LV_HOR_RES);
|
lv_obj_set_width(label, LV_HOR_RES);
|
||||||
|
|
||||||
//Set a style for the obj
|
|
||||||
lv_style_copy(&style, &lv_style_plain);
|
|
||||||
style.text.font = &lv_font_dejavu_10; /*Unicode and symbol fonts already assigned by the library*/
|
|
||||||
lv_label_set_style(label, &style);
|
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
/*draw system call */
|
/*draw system call */
|
||||||
lv_task_handler();
|
lv_task_handler();
|
||||||
if(ssd1306_need_redraw())
|
|
||||||
{
|
|
||||||
ssd1306_load_frame_buffer(&dev);
|
|
||||||
}
|
|
||||||
vTaskDelay(1);
|
vTaskDelay(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,6 +189,7 @@ void user_init(void)
|
||||||
printf("%s: failed to init SSD1306 lcd\n", __func__);
|
printf("%s: failed to init SSD1306 lcd\n", __func__);
|
||||||
vTaskDelay(SECOND);
|
vTaskDelay(SECOND);
|
||||||
}
|
}
|
||||||
|
|
||||||
ssd1306_set_whole_display_lighting(&dev, true);
|
ssd1306_set_whole_display_lighting(&dev, true);
|
||||||
|
|
||||||
/*inverse screen (180°) */
|
/*inverse screen (180°) */
|
||||||
|
@ -186,12 +202,13 @@ void user_init(void)
|
||||||
lv_disp_drv_init(&disp_drv);
|
lv_disp_drv_init(&disp_drv);
|
||||||
/*Set up the functions to access to your display*/
|
/*Set up the functions to access to your display*/
|
||||||
disp_drv.disp_flush = ssd1306_flush; /*Used in buffered mode (LV_VDB_SIZE != 0 in lv_conf.h)*/
|
disp_drv.disp_flush = ssd1306_flush; /*Used in buffered mode (LV_VDB_SIZE != 0 in lv_conf.h)*/
|
||||||
disp_drv.disp_fill = ssd1306_fill;//ex_disp_fill; /*Used in unbuffered mode (LV_VDB_SIZE == 0 in lv_conf.h)*/
|
disp_drv.disp_fill = NULL;//ex_disp_fill; /*Used in unbuffered mode (LV_VDB_SIZE == 0 in lv_conf.h)*/
|
||||||
disp_drv.disp_map = ssd1306_map;//ex_disp_map; /*Used in unbuffered mode (LV_VDB_SIZE == 0 in lv_conf.h)*/
|
disp_drv.disp_map = NULL;//ex_disp_map; /*Used in unbuffered mode (LV_VDB_SIZE == 0 in lv_conf.h)*/
|
||||||
|
disp_drv.vdb_wr = ssd1306_vdb_wr;
|
||||||
lv_disp_drv_register(&disp_drv);
|
lv_disp_drv_register(&disp_drv);
|
||||||
|
|
||||||
/* Create user interface task */
|
/* Create user interface task */
|
||||||
xTaskCreate(ssd1306_task, "ssd1306_task", 256, NULL, 2, NULL);
|
xTaskCreate(ssd1306_task, "ssd1306_task", 512, NULL, 2, NULL);
|
||||||
|
|
||||||
font_timer_handle = xTimerCreate("font_timer", 5 * SECOND, pdTRUE, NULL, font_timer);
|
font_timer_handle = xTimerCreate("font_timer", 5 * SECOND, pdTRUE, NULL, font_timer);
|
||||||
xTimerStart(font_timer_handle, 0);
|
xTimerStart(font_timer_handle, 0);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit eafd24d14e3c914b870e9575e5ec33d06280d313
|
Subproject commit 8fe0804ceb875193a37106a2e25d07c106650a86
|
Loading…
Add table
Add a link
Reference in a new issue