feat: 实现设置页面及其功能
This commit is contained in:
+34
-6
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "board_config.h"
|
||||
|
||||
#include "draw/sw/lv_draw_sw.h"
|
||||
#include "driver/spi_master.h"
|
||||
#include "esp_lcd_panel_ops.h"
|
||||
#include "esp_log.h"
|
||||
@@ -31,14 +32,40 @@ static bool notify_flush_ready(esp_lcd_panel_io_handle_t panel_io,
|
||||
static void flush_cb(lv_display_t *disp, const lv_area_t *area, uint8_t *px_map)
|
||||
{
|
||||
esp_lcd_panel_handle_t panel_handle = lv_display_get_user_data(disp);
|
||||
int offsetx1 = area->x1;
|
||||
int offsetx2 = area->x2;
|
||||
int offsety1 = area->y1;
|
||||
int offsety2 = area->y2;
|
||||
lv_draw_sw_rgb565_swap(px_map,
|
||||
const lv_area_t *draw_area = area;
|
||||
uint8_t *draw_buf = px_map;
|
||||
|
||||
static uint8_t rotated_buf[BOARD_LCD_H_RES * BOARD_LVGL_DRAW_BUF_LINES *
|
||||
sizeof(lv_color16_t)];
|
||||
|
||||
lv_display_rotation_t rotation = lv_display_get_rotation(disp);
|
||||
lv_area_t rotated_area;
|
||||
if (rotation != LV_DISPLAY_ROTATION_0) {
|
||||
lv_color_format_t cf = lv_display_get_color_format(disp);
|
||||
rotated_area = *area;
|
||||
lv_display_rotate_area(disp, &rotated_area);
|
||||
|
||||
int32_t src_w = lv_area_get_width(area);
|
||||
int32_t src_h = lv_area_get_height(area);
|
||||
uint32_t src_stride = lv_draw_buf_width_to_stride(src_w, cf);
|
||||
uint32_t dest_stride =
|
||||
lv_draw_buf_width_to_stride(lv_area_get_width(&rotated_area), cf);
|
||||
|
||||
lv_draw_sw_rotate(px_map, rotated_buf, src_w, src_h, src_stride,
|
||||
dest_stride, rotation, cf);
|
||||
|
||||
draw_area = &rotated_area;
|
||||
draw_buf = rotated_buf;
|
||||
}
|
||||
|
||||
int offsetx1 = draw_area->x1;
|
||||
int offsetx2 = draw_area->x2;
|
||||
int offsety1 = draw_area->y1;
|
||||
int offsety2 = draw_area->y2;
|
||||
lv_draw_sw_rgb565_swap(draw_buf,
|
||||
(offsetx2 + 1 - offsetx1) * (offsety2 + 1 - offsety1));
|
||||
esp_lcd_panel_draw_bitmap(panel_handle, offsetx1, offsety1, offsetx2 + 1,
|
||||
offsety2 + 1, px_map);
|
||||
offsety2 + 1, draw_buf);
|
||||
}
|
||||
|
||||
static void increase_lvgl_tick(void *arg)
|
||||
@@ -80,6 +107,7 @@ lv_display_t *lvgl_port_init(esp_lcd_panel_io_handle_t io_handle,
|
||||
|
||||
lv_display_t *display =
|
||||
lv_display_create(BOARD_LCD_H_RES, BOARD_LCD_V_RES);
|
||||
lv_display_set_rotation(display, LV_DISPLAY_ROTATION_270);
|
||||
|
||||
size_t draw_buffer_sz = BOARD_LCD_H_RES * BOARD_LVGL_DRAW_BUF_LINES *
|
||||
sizeof(lv_color16_t);
|
||||
|
||||
Reference in New Issue
Block a user