Web前端最全LVGL学习 stm32f407-board-lvgl v8,web前端开发课程安排

文末

我一直觉得技术面试不是考试,考前背背题,发给你一张考卷,答完交卷等通知。

首先,技术面试是一个 认识自己 的过程,知道自己和外面世界的差距。

更重要的是,技术面试是一个双向了解的过程,要让对方发现你的闪光点,同时也要 试图去找到对方的闪光点,因为他以后可能就是你的同事或者领导,所以,面试官问你有什么问题的时候,不要说没有了,要去试图了解他的工作内容、了解这个团队的氛围。

前端面试题汇总

JavaScript

开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】

性能

linux

前端资料汇总


修改disp代码



/**
* @file lv_port_disp_templ.c
*
*/

/*Copy this file as “lv_port_disp.c” and set this value to “1” to enable content*/
#if 1

/*********************
* INCLUDES
*********************/
#include “lv_port_disp.h”
#include <stdbool.h>
#include “lcd.h”
/*********************
* DEFINES
*********************/
//#ifndef MY_DISP_HOR_RES
// #warning Please define or replace the macro MY_DISP_HOR_RES with the actual screen width, default value 320 is used for now.
// #define MY_DISP_HOR_RES 320
//#endif

//#ifndef MY_DISP_VER_RES
// #warning Please define or replace the macro MY_DISP_HOR_RES with the actual screen height, default value 240 is used for now.
// #define MY_DISP_VER_RES 240
//#endif

/**********************
* TYPEDEFS
**********************/

/**********************
* STATIC PROTOTYPES
**********************/
static void disp_init(void);

static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p);
//static void gpu_fill(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width,
// const lv_area_t * fill_area, lv_color_t color);

/**********************
* STATIC VARIABLES
**********************/

/**********************
* MACROS
**********************/

/**********************
* GLOBAL FUNCTIONS
**********************/

void lv_port_disp_init(void)
{
/*-------------------------
* Initialize your display
* -----------------------*/
// disp_init();

/\*-----------------------------

* Create a buffer for drawing
*----------------------------*/

/\*\*

* LVGL requires a buffer where it internally draws the widgets.
* Later this buffer will passed to your display driver’s flush\_cb to copy its content to your display.
* The buffer has to be greater than 1 display row
*
* There are 3 buffering configurations:
* 1. Create ONE buffer:
* LVGL will draw the display’s content here and writes it to your display
*
* 2. Create TWO buffer:
* LVGL will draw the display’s content to a buffer and writes it your display.
* You should use DMA to write the buffer’s content to the display.
* It will enable LVGL to draw the next part of the screen to the other buffer while
* the data is being sent form the first buffer. It makes rendering and flushing parallel.
*
* 3. Double buffering
* Set 2 screens sized buffers and set disp_drv.full_refresh = 1.
* This way LVGL will always provide the whole rendered screen in flush\_cb
* and you only need to change the frame buffer’s address.
*/

/\* Example for 1) \*/
static lv\_disp\_draw\_buf\_t draw_buf_dsc_1;
static lv\_color\_t buf_1[LV_HOR_RES_MAX \* 10];                          /\*A buffer for 10 rows\*/
lv\_disp\_draw\_buf\_init(&draw_buf_dsc_1, buf_1, NULL, LV_HOR_RES_MAX \* 10);   /\*Initialize the display buffer\*/

/\*-----------------------------------

* Register the display in LVGL
*----------------------------------*/

static lv\_disp\_drv\_t disp_drv;                         /\*Descriptor of a display driver\*/
lv\_disp\_drv\_init(&disp_drv);                    /\*Basic initialization\*/

/\*Set up the functions to access to your display\*/

/\*Set the resolution of the display\*/
disp_drv.hor_res = lcddev.width;
disp_drv.ver_res = lcddev.height;

/\*Used to copy the buffer's content to the display\*/
disp_drv.flush_cb = disp_flush;

/\*Set a display buffer\*/
disp_drv.draw_buf = &draw_buf_dsc_1;

/\*Required for Example 3)\*/
//disp\_drv.full\_refresh = 1

/\* Fill a memory array with a color if you have GPU.

* Note that, in lv_conf.h you can enable GPUs that has built-in support in LVGL.
* But if you have a different GPU you can use with this callback.*/
//disp_drv.gpu_fill_cb = gpu_fill;

/\*Finally register the driver\*/
lv\_disp\_drv\_register(&disp_drv);

}

/**********************
* STATIC FUNCTIONS
**********************/

/*Initialize your display and the required peripherals.*/
//static void disp_init(void)
//{
// /*You code here*/
//}

volatile bool disp_flush_enabled = true;

/* Enable updating the screen (the flushing process) when disp_flush() is called by LVGL
*/
void disp_enable_update(void)
{
disp_flush_enabled = true;
}

/* Disable updating the screen (the flushing process) when disp_flush() is called by LVGL
*/
void disp_disable_update(void)
{
disp_flush_enabled = false;
}

/*Flush the content of the internal buffer the specific area on the display
*You can use DMA or any hardware acceleration to do this operation in the background but
*‘lv_disp_flush_ready()’ has to be called when finished.*/
static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
{

LCD\_Color\_Fill(area->x1,area->y1,area->x2,area->y2,(u16\*)color_p);
lv\_disp\_flush\_ready(disp_drv);

}

#else /*Enable this file at the top*/

/*This dummy typedef exists purely to silence -Wpedantic.*/
typedef int keep_pedantic_happy;
#endif


基本上只要修改disp\_flush函数,不同的屏幕显示接口移植


修改indev代码,配置好触摸屏驱动



/**
* @file lv_port_indev_templ.c
*
*/

/*Copy this file as “lv_port_indev.c” and set this value to “1” to enable content*/
#if 1

/*********************
* INCLUDES
*********************/
#include “lv_port_indev.h”
#include “…/lvgl.h”
#include “touch.h”
/*********************
* DEFINES
*********************/

/**********************
* TYPEDEFS
**********************/

/**********************
* STATIC PROTOTYPES
**********************/

static void touchpad_init(void);
static void touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
static bool touchpad_is_pressed(void);
static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y);

/**********************
* STATIC VARIABLES
**********************/
lv_indev_t * indev_touchpad;

static int32_t encoder_diff;
static lv_indev_state_t encoder_state;

/**********************
* MACROS
**********************/

/**********************
* GLOBAL FUNCTIONS
**********************/

void lv_port_indev_init(void)
{
static lv_indev_drv_t indev_drv;

/\*------------------

* Touchpad
* -----------------*/

/\*Initialize your touchpad if you have\*/
touchpad\_init();

/\*Register a touchpad input device\*/
lv\_indev\_drv\_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = touchpad_read;
indev_touchpad = lv\_indev\_drv\_register(&indev_drv);

/*------------------
* Touchpad
* -----------------*/

/*Initialize your touchpad*/
static void touchpad_init(void)
{
/*Your code comes here*/
tp_dev.init();
if (0 == (tp_dev.touchtype & 0x80))
{
TP_Adjust();
TP_Save_Adjdata();
}
}

/*Will be called by the library to read the touchpad*/
static void touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static lv_coord_t last_x = 0;
static lv_coord_t last_y = 0;

/\*Save the pressed coordinates and the state\*/
if(touchpad\_is\_pressed()) 

{
touchpad_get_xy(&last_x, &last_y);
data->state = LV_INDEV_STATE_PR;
}
else {
data->state = LV_INDEV_STATE_REL;
}

/\*Set the last pressed coordinates\*/
data->point.x = last_x;
data->point.y = last_y;

}

/*Return true is the touchpad is pressed*/
static bool touchpad_is_pressed(void)
{

if(tp_dev.sta & TP_PRES_DOWN)
  return true;
return false;

}

/*Get the x and y coordinates if the touchpad is pressed*/
static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y)
{
(*x) = tp_dev.x[0];
(*y) = tp_dev.y[0];
}
#else /*Enable this file at the top*/

/*This dummy typedef exists purely to silence -Wpedantic.*/
typedef int keep_pedantic_happy;
#endif


10. 注意:移植 LVGL 必须开启 C99 模式  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/bad9786e6a7e4e7fb8e123b881fa4dd3.jpeg#pic_center)




### 最后

![](https://img-blog.csdnimg.cn/img_convert/b72191d48f1fb907e7fe70b32c82fd83.webp?x-oss-process=image/format,png)

![](https://img-blog.csdnimg.cn/img_convert/c84bf0fb2120c5260a27cc5e5d1dcb29.webp?x-oss-process=image/format,png)

**资料过多,篇幅有限**

**[开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】](https://bbs.csdn.net/topics/618166371)**

>自古成功在尝试。不尝试永远都不会成功。勇敢的尝试是成功的一半。



GL 必须开启 C99 模式  
 ![在这里插入图片描述](https://img-blog.csdnimg.cn/bad9786e6a7e4e7fb8e123b881fa4dd3.jpeg#pic_center)




### 最后

[外链图片转存中...(img-B85GpiC7-1715173388040)]

[外链图片转存中...(img-oGbwgMLy-1715173388040)]

**资料过多,篇幅有限**

**[开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】](https://bbs.csdn.net/topics/618166371)**

>自古成功在尝试。不尝试永远都不会成功。勇敢的尝试是成功的一半。



  • 15
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值