✅ 更新(lvgl):已经正常运行
1. 更新了刷屏的问题,之前不能正常刷屏是因为刷屏的方法不对Q^Q 结束
This commit is contained in:
parent
495e7c5186
commit
3e11ec2120
@ -271,9 +271,9 @@
|
||||
*-----------*/
|
||||
|
||||
/*1: Show CPU usage and FPS count*/
|
||||
#define LV_USE_PERF_MONITOR 0
|
||||
#define LV_USE_PERF_MONITOR 1
|
||||
#if LV_USE_PERF_MONITOR
|
||||
#define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT
|
||||
#define LV_USE_PERF_MONITOR_POS LV_ALIGN_TOP_MID
|
||||
#endif
|
||||
|
||||
/*1: Show the used memory and the memory fragmentation
|
||||
|
||||
@ -19,6 +19,8 @@
|
||||
*/
|
||||
#include "app_task_display.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "esp_freertos_hooks.h"
|
||||
#include "esp_system.h"
|
||||
#include "freertos/task.h"
|
||||
#include "esp_err.h"
|
||||
#include "esp_log.h"
|
||||
@ -27,6 +29,8 @@
|
||||
#include "lv_conf.h"
|
||||
#include "lvgl.h"
|
||||
|
||||
#define LV_TICK_PERIOD_MS 1
|
||||
|
||||
TFT_t lcd_disp_dev;
|
||||
|
||||
TickType_t FillTest(TFT_t* dev, int width, int height)
|
||||
@ -145,8 +149,8 @@ void lv_example_anim_233333(void)
|
||||
lv_anim_t a;
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, obj);
|
||||
lv_anim_set_values(&a, 10, 50);
|
||||
lv_anim_set_time(&a, 1000);
|
||||
lv_anim_set_values(&a, 10, 40);
|
||||
lv_anim_set_time(&a, 500);
|
||||
lv_anim_set_playback_delay(&a, 100);
|
||||
lv_anim_set_playback_time(&a, 300);
|
||||
lv_anim_set_repeat_delay(&a, 500);
|
||||
@ -156,7 +160,7 @@ void lv_example_anim_233333(void)
|
||||
lv_anim_set_exec_cb(&a, anim_size_cb);
|
||||
lv_anim_start(&a);
|
||||
lv_anim_set_exec_cb(&a, anim_x_cb);
|
||||
lv_anim_set_values(&a, 10, 240);
|
||||
lv_anim_set_values(&a, 10, 200);
|
||||
lv_anim_start(&a);
|
||||
}
|
||||
|
||||
@ -166,16 +170,17 @@ static void _lvgl_thread_entry()
|
||||
{
|
||||
vTaskDelay(10);
|
||||
lcdBacklightOn(&lcd_disp_dev);
|
||||
FillTest(&lcd_disp_dev, CONFIG_WIDTH, CONFIG_HEIGHT);
|
||||
// FillTest(&lcd_disp_dev, CONFIG_WIDTH, CONFIG_HEIGHT);
|
||||
lv_init();
|
||||
lv_port_disp_init();
|
||||
lv_port_indev_init();
|
||||
lcdFillScreen(&lcd_disp_dev, WHITE);
|
||||
|
||||
lv_example_anim_233333();
|
||||
|
||||
while (1) {
|
||||
lv_task_handler();
|
||||
vTaskDelay(30);
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,6 +193,12 @@ static void _lvgl_thread_tick_entry()
|
||||
}
|
||||
}
|
||||
|
||||
static void lv_tick_task(void *arg) {
|
||||
(void) arg;
|
||||
|
||||
lv_tick_inc(LV_TICK_PERIOD_MS);
|
||||
}
|
||||
|
||||
uint8_t app_task_display_start()
|
||||
{
|
||||
cst816t_begin(34, 33, 35, 36);
|
||||
@ -200,8 +211,17 @@ uint8_t app_task_display_start()
|
||||
vTaskDelay(100);
|
||||
lcdFillScreen(&lcd_disp_dev, BLACK);
|
||||
vTaskDelay(100);
|
||||
/* Create and start a periodic timer interrupt to call lv_tick_inc */
|
||||
const esp_timer_create_args_t periodic_timer_args = {
|
||||
.callback = &lv_tick_task,
|
||||
.name = "periodic_gui"
|
||||
};
|
||||
esp_timer_handle_t periodic_timer;
|
||||
ESP_ERROR_CHECK(esp_timer_create(&periodic_timer_args, &periodic_timer));
|
||||
ESP_ERROR_CHECK(esp_timer_start_periodic(periodic_timer, LV_TICK_PERIOD_MS * 1000));
|
||||
|
||||
// xTaskCreatePinnedToCore(_display_thread_entry, "dsp test", 4096, NULL, 4, NULL, tskNO_AFFINITY);
|
||||
xTaskCreatePinnedToCore(_lvgl_thread_tick_entry, "lvgl tick test", 9842, NULL, 5, NULL, tskNO_AFFINITY);
|
||||
// xTaskCreatePinnedToCore(_lvgl_thread_tick_entry, "lvgl tick test", 9842, NULL, 16, NULL, tskNO_AFFINITY);
|
||||
xTaskCreatePinnedToCore(_lvgl_thread_entry, "lvgl test", 9842, NULL, 4, NULL, tskNO_AFFINITY);
|
||||
|
||||
#if CONFIG_INVERSION
|
||||
|
||||
@ -36,13 +36,13 @@ static void lcd_fb_flush(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_colo
|
||||
{
|
||||
static uint16_t datas[DISP_BUF_SIZE] = {0};
|
||||
int i = 0, j = 0, index = 0;
|
||||
for ( i = area->x1; i <= area->x2; i++) {
|
||||
for (j = area->y1; j <= area->y2; j++) {
|
||||
datas[index++] = color_p->full;
|
||||
color_p++;
|
||||
}
|
||||
}
|
||||
lcdDrawFillRectData(&lcd_disp_dev, area->x1, area->y1, area->x2, area->y2, datas);
|
||||
// for ( i = area->y1; i <= area->y2; i++) {
|
||||
// for (j = area->x1; j <= area->x2; j++) {
|
||||
// datas[index++] = color_p->full;
|
||||
// color_p++;
|
||||
// }
|
||||
// }
|
||||
lcdDrawFillRectData(&lcd_disp_dev, area->x1, area->y1, area->x2, area->y2, (uint16_t*)color_p);
|
||||
lv_disp_flush_ready(disp_drv);
|
||||
}
|
||||
|
||||
|
||||
@ -1134,13 +1134,15 @@ void lcdDrawFillRectData(TFT_t * dev, uint16_t x1, uint16_t y1, uint16_t x2, uin
|
||||
spi_master_write_command(dev, 0x2B); // set Page(y) address
|
||||
spi_master_write_addr(dev, _y1, _y2);
|
||||
spi_master_write_command(dev, 0x2C); // Memory Write
|
||||
for(int i=_x1;i<=_x2;i++){
|
||||
uint16_t size = _y2-_y1+1;
|
||||
// spi_master_write_colors(dev, data, (x2-x1)*(y2-y1));
|
||||
for(int i=0;i<=y2 - y1;i++){
|
||||
uint16_t size = _x2-_x1;
|
||||
spi_master_write_colors(dev, data, size * 2);
|
||||
data += (x2 - x1);
|
||||
#if 0
|
||||
for(j=y1;j<=y2;j++){
|
||||
for(int j=0;j<=x2-x1;j++){
|
||||
//ESP_LOGD(TAG,"i=%d j=%d",i,j);
|
||||
spi_master_write_data_word(dev, color);
|
||||
spi_master_write_data_word(dev, data[i * (y2 - y1) + j]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user