LVGL LV_DPI_DEF 配置

一、参考

可以参考此地址:http://www.4k8k.xyz/article/qq_26106317/120610353

二、具体配置

#define LV_DISP_DEF_REFR_PERIOD     30      /*[ms] 刷新周期*/
#define LV_INDEV_DEF_READ_PERIOD    300      /*[ms] 输入设备读取周期*/

/*Use a custom tick source that tells the elapsed time in milliseconds.
 *It removes the need to manually update the tick with `lv_tick_inc()`)*/
 /* 时钟源提供器,如果LV_TICK_CUSTOM==1,那么你就不用lv_tick_inc()提供时钟了 */
#define LV_TICK_CUSTOM     0
#if LV_TICK_CUSTOM
/* ↓ 这里可以指定时钟源提供器,例如STM32的HAL库的HAL_GetTick() */
#define LV_TICK_CUSTOM_INCLUDE  "stm32f4xx_hal.h"     /*Header for the system time function*/
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (HAL_GetTick()) 
#endif   /*LV_TICK_CUSTOM*/
 /* 
  * LV_DPI_DEF 注意这里,虽然LVGL的作者说这个没这么重要,但他会严重影响到LVGL的动画效果
  * 你应该进行DPI的手动计算,例如128x128分辨率1.44英寸的屏幕,那么 DPI = ((√128*128) / 1.44) ≈ 89
  */
#define LV_DPI_DEF                  89     /*[px/inch]*/
/********************** * MACROS **********************/ lv_disp_drv_t *lv_port_disp_init() { static lv_disp_draw_buf_t draw_buf_dsc_3; static lv_color_t buf_3_1[LVGL_HOR_RES * LVGL_VER_RES]; /*A screen sized buffer*/ static lv_color_t buf_3_2[LVGL_HOR_RES * LVGL_VER_RES]; /*Another screen sized buffer*/ lv_disp_draw_buf_init(&draw_buf_dsc_3, buf_3_1, buf_3_2, LVGL_VER_RES * LVGL_HOR_RES); /*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 = LVGL_HOR_RES; disp_drv.ver_res = LVGL_VER_RES; disp_drv.physical_hor_res = LVGL_HOR_RES; disp_drv.physical_ver_res = LVGL_VER_RES; disp_drv.screen_transp = LV_COLOR_SCREEN_TRANSP; disp_drv.dpi = LV_DPI_DEF; disp_drv.color_chroma_key = LV_COLOR_CHROMA_KEY; /*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_3; #if ROTATE_SCREEN disp_drv.rotated = 1; disp_drv.sw_rotate = 1; #endif /*Required for Example 3)*/ disp_drv.full_refresh = 0; /* 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); return &disp_drv; } 把他转成lv_display_create的函数。
最新发布
03-14
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值