#define LV_USE_THEME_MATERIAL 1 /*Flat theme with bold colors and light shadows*/
#define LV_USE_THEME_ZEN 1 /*Peaceful, mainly light theme */
#define LV_USE_THEME_NEMO 1 /*Water-like theme based on the movie 'Finding Nemo'*/
/*==================
* FONT USAGE
*===================*/
/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel.
* The symbols are available via `LV_SYMBOL_...` defines
* More info about fonts: https://docs.littlevgl.com/#Fonts
* To create a new font go to: https://littlevgl.com/ttf-font-to-c-array
*/
/* Robot fonts with bpp = 4
* https://fonts.google.com/specimen/Roboto */
#define LV_FONT_ROBOTO_12 0
#define LV_FONT_ROBOTO_16 1
#define LV_FONT_ROBOTO_22 0
#define LV_FONT_ROBOTO_28 0
/*Pixel perfect monospace font
* http://pelulamu.net/unscii/ */
#define LV_FONT_UNSCII_8 0
/* Optionally declare your custom fonts here.
* You can use these fonts as default font too
* and they will be available globally. E.g.
* #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1)
* LV_FONT_DECLARE(my_font_2)
*/
#define LV_FONT_CUSTOM_DECLARE
/*Always set a default font from the built-in fonts*/
#define LV_FONT_DEFAULT &lv_font_roboto_16
/* Enable it if you have fonts with a lot of characters.
* The limit depends on the font size, font face and bpp
* but with > 10,000 characters if you see issues probably you need to enable it.*/
#define LV_FONT_FMT_TXT_LARGE 0
/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/
typedef void * lv_font_user_data_t;
/*=================
* Text settings
*=================*/
/* Select a character encoding for strings.
* Your IDE or editor should have the same character encoding
* - LV_TXT_ENC_UTF8
* - LV_TXT_ENC_ASCII
* */
#define LV_TXT_ENC LV_TXT_ENC_UTF8
/*Can break (wrap) texts on these chars*/
#define LV_TXT_BREAK_CHARS ' ,.;:-_'
/*===================
* LV_OBJ SETTINGS
*==================*/
/*Declare the type of the user data of object (can be e.g. `void *`, `int`, `struct`)*/
typedef void * lv_obj_user_data_t;
/*1: enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/
#define LV_USE_OBJ_REALIGN 1
/* Enable to make the object clickable on a larger area.
* LV_EXT_CLICK_AREA_OFF or 0: Disable this feature
* LV_EXT_CLICK_AREA_TINY: The extra area can be adjusted horizontally and vertically (0..255 px)
* LV_EXT_CLICK_AREA_FULL: The extra area can be adjusted in all 4 directions (-32k..+32k px)
*/
#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_OFF
/*==================
* LV OBJ X USAGE
*================*/
/*
* Documentation of the object types: https://docs.littlevgl.com/#Object-types
*/
/*Arc (dependencies: -)*/
#define LV_USE_ARC 1
/*Bar (dependencies: -)*/
#define LV_USE_BAR 1
/*Button (dependencies: lv_cont*/
#define LV_USE_BTN 1
#if LV_USE_BTN != 0
/*Enable button-state animations - draw a circle on click (dependencies: LV_USE_ANIMATION)*/
# define LV_BTN_INK_EFFECT 0
#endif
/*Button matrix (dependencies: -)*/
#define LV_USE_BTNM 1
/*Calendar (dependencies: -)*/
#define LV_USE_CALENDAR 1
/*Canvas (dependencies: lv_img)*/
#define LV_USE_CANVAS 1
/*Check box (dependencies: lv_btn, lv_label)*/
#define LV_USE_CB 1
/*Chart (dependencies: -)*/
#define LV_USE_CHART 1
#if LV_USE_CHART
# define LV_CHART_AXIS_TICK_LABEL_MAX_LEN 20
#endif
/*Container (dependencies: -*/
#define LV_USE_CONT 1
/*Drop down list (dependencies: lv_page, lv_label, lv_symbol_def.h)*/
#define LV_USE_DDLIST 1
#if LV_USE_DDLIST != 0
/*Open and close default animation time [ms] (0: no animation)*/
# define LV_DDLIST_DEF_ANIM_TIME 200
#endif
/*Gauge (dependencies:lv_bar, lv_lmeter)*/
#define LV_USE_GAUGE 1
/*Image (dependencies: lv_label*/
#define LV_USE_IMG 1
/*Image Button (dependencies: lv_btn*/
#define LV_USE_IMGBTN 1
#if LV_USE_IMGBTN
/*1: The imgbtn requires left, mid and right parts and the width can be set freely*/
# define LV_IMGBTN_TILED 0
#endif
/*Keyboard (dependencies: lv_btnm)*/
#define LV_USE_KB 1
/*Label (dependencies: -*/
#define LV_USE_LABEL 1
#if LV_USE_LABEL != 0
/*Hor, or ver. scroll speed [px/sec] in 'LV_LABEL_LONG_ROLL/ROLL_CIRC' mode*/
# define LV_LABEL_DEF_SCROLL_SPEED 25
/* Waiting period at beginning/end of animation cycle */
# define LV_LABEL_WAIT_CHAR_COUNT 3
/*Enable selecting text of the label */
# define LV_LABEL_TEXT_SEL 0
/*Store extra some info in labels (12 bytes) to speed up drawing of very long texts*/
# define LV_LABEL_LONG_TXT_HINT 0
#endif
/*LED (dependencies: -)*/
#define LV_USE_LED 1
/*Line (dependencies: -*/
#define LV_USE_LINE 1
/*List (dependencies: lv_page, lv_btn, lv_label, (lv_img optionally for icons ))*/
#define LV_USE_LIST 1
#if LV_USE_LIST != 0
/*Default animation time of focusing to a list element [ms] (0: no animation) */
# define LV_LIST_DEF_ANIM_TIME 100
#endif
/*Line meter (dependencies: *;)*/
#define LV_USE_LMETER 1
/*Message box (dependencies: lv_rect, lv_btnm, lv_label)*/
#define LV_USE_MBOX 1
/*Page (dependencies: lv_cont)*/
#define LV_USE_PAGE 1
#if LV_USE_PAGE != 0
/*Focus default animation time [ms] (0: no animation)*/
# define LV_PAGE_DEF_ANIM_TIME 400
#endif
/*Preload (dependencies: lv_arc, lv_anim)*/
#define LV_USE_PRELOAD 1
#if LV_USE_PRELOAD != 0
# define LV_PRELOAD_DEF_ARC_LENGTH 60 /*[deg]*/
# define LV_PRELOAD_DEF_SPIN_TIME 1000 /*[ms]*/
# define LV_PRELOAD_DEF_ANIM LV_PRELOAD_TYPE_SPINNING_ARC
#endif
/*Roller (dependencies: lv_ddlist)*/
#define LV_USE_ROLLER 1
#if LV_USE_ROLLER != 0
/*Focus animation time [ms] (0: no animation)*/
# define LV_ROLLER_DEF_ANIM_TIME 200
/*Number of extra 'pages' when the roller is infinite*/
# define LV_ROLLER_INF_PAGES 7
#endif
/*Slider (dependencies: lv_bar)*/
#define LV_USE_SLIDER 1
/*Spinbox (dependencies: lv_ta)*/
#define LV_USE_SPINBOX 1
/*Switch (dependencies: lv_slider)*/
#define LV_USE_SW 1
/*Text area (dependencies: lv_label, lv_page)*/
#define LV_USE_TA 1
#if LV_USE_TA != 0
# define LV_TA_DEF_CURSOR_BLINK_TIME 400 /*ms*/
# define LV_TA_DEF_PWD_SHOW_TIME 1500 /*ms*/
#endif
/*Table (dependencies: lv_label)*/
#define LV_USE_TABLE 1
#if LV_USE_TABLE
# define LV_TABLE_COL_MAX 12
#endif
/*Tab (dependencies: lv_page, lv_btnm)*/
#define LV_USE_TABVIEW 1
# if LV_USE_TABVIEW != 0
/*Time of slide animation [ms] (0: no animation)*/
# define LV_TABVIEW_DEF_ANIM_TIME 300
#endif
/*Tileview (dependencies: lv_page) */
#define LV_USE_TILEVIEW 1
#if LV_USE_TILEVIEW
/*Time of slide animation [ms] (0: no animation)*/
# define LV_TILEVIEW_DEF_ANIM_TIME 300
#endif
/*Window (dependencies: lv_cont, lv_btn, lv_label, lv_img, lv_page)*/
#define LV_USE_WIN 1
/*==================
* Non-user section
*==================*/
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/
# define _CRT_SECURE_NO_WARNINGS
#endif
/*--END OF LV_CONF_H--*/
/*Be sure every define has a default value*/
#include 'lvgl/src/lv_conf_checker.h'
#endif /*LV_CONF_H*/
#endif /*End of 'Content enable'*/
主要分辨率要選成自己的屏幕對(duì)于的,并關(guān)閉系統(tǒng)支持~
下面我們對(duì)底層進(jìn)行移植:
主要是lcd驅(qū)動(dòng)及TOUCH驅(qū)動(dòng),我們把LVGL里面porting文件夾里面的temp進(jìn)行修改:
其中:
lv_port_dis.c
/**
* @file lv_port_disp.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 'lcd.h'
/*********************
* DEFINES
*********************/
/**********************
* 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);
#if LV_USE_GPU
static void gpu_blend(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa);
static void gpu_fill(lv_color_t * dest, uint32_t length, lv_color_t color);
#endif
/**********************
* STATIC VARIABLES
**********************/
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
void lv_port_disp_init(void)
{
/*-------------------------
* Initialize your display
* -----------------------*/
disp_init();
/*-----------------------------
* Create a buffer for drawing
*----------------------------*/
/* Example for 1) */
static lv_disp_buf_t disp_buf_1;
static lv_color_t buf1_1[LV_HOR_RES_MAX * 10]; /*A buffer for 10 rows*/
lv_disp_buf_init(&disp_buf_1, buf1_1, NULL, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/
/*-----------------------------------
* Register the display in LittlevGL
*----------------------------------*/
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*/
//適配多個(gè)屏幕
disp_drv.hor_res = lcddev.width;
disp_drv.ver_res = lcddev.height;
上一篇:GD32開(kāi)發(fā)實(shí)戰(zhàn)指南(基礎(chǔ)篇) 第10章 串口通信
下一篇:GD32開(kāi)發(fā)實(shí)戰(zhàn)指南(基礎(chǔ)篇) 第5章 跳動(dòng)的心臟-Systick
設(shè)計(jì)資源 培訓(xùn) 開(kāi)發(fā)板 精華推薦
- 單片機(jī)應(yīng)用編程技巧解析
- 基于89C52的教室智能節(jié)能照明系統(tǒng)設(shè)計(jì)
- 一種新型的雨量光照傳感器的設(shè)計(jì)
- 智能護(hù)眼臺(tái)燈設(shè)計(jì)
- 蓄電池高能脈沖充電系統(tǒng)設(shè)計(jì)
- 基于51單片機(jī)定時(shí)器的電子時(shí)鐘設(shè)計(jì)方案
- 瑞薩電子推出面向單電機(jī)應(yīng)用優(yōu)化的卓越MCU, 涵蓋電動(dòng)工具、家用電器等廣泛應(yīng)用場(chǎng)景
- 基于單片機(jī)的LED自適應(yīng)調(diào)光系統(tǒng)
- 智能小車(chē)主控系統(tǒng)電路設(shè)計(jì)
- 使用 Analog Devices 的 LTC4162IUFD-LAD 的參考設(shè)計(jì)
- AD8531ARZ-REEL 高輸出電流基準(zhǔn)/穩(wěn)壓器的典型應(yīng)用
- [未驗(yàn)證]2通道 24位差分ADC模塊-CS1238
- LTC3859A 演示板、低 IQ、三路輸出、降壓/降壓/升壓同步控制器
- 使用 Analog Devices 的 LTC1867LCGN 的參考設(shè)計(jì)
- EDA實(shí)驗(yàn)四
- 使用 ROHM Semiconductor 的 BA90BC0WT-V5 的參考設(shè)計(jì)
- 使用符合 EN55022 B 類(lèi)(24Vin 和 48Vin,雙輸出)EMC 濾波的 RP40-2415DFR DC/DC 轉(zhuǎn)換器的典型應(yīng)用
- 使用 Diodes Incorporated 的 ZR78L057 的參考設(shè)計(jì)
- NCP6151 雙輸出 4 相 +1/0 相控制器的典型應(yīng)用,具有單 SVID 接口,適用于臺(tái)式機(jī)和筆記本 CPU 應(yīng)用
- 電纜故障測(cè)試儀好不好用?
- 泰海基金攜手韋爾設(shè)8億元子基金,重點(diǎn)關(guān)注半導(dǎo)體產(chǎn)業(yè)鏈
- 意法半導(dǎo)體和 Blues Wireless 合作加快嵌入式蜂窩技術(shù)的應(yīng)用
- 四川“十四五”新基建規(guī)劃出臺(tái),到2025年5G基站數(shù)量25萬(wàn)個(gè)
- 英飛凌推出全新AIROC? CYW20829 低功耗藍(lán)牙片上系統(tǒng)
- 華為HarmonyOS 2所有既定產(chǎn)品正式版上線:超長(zhǎng)名單公布
- Atmosic發(fā)布搭載能量收集技術(shù)的超低功耗藍(lán)牙高級(jí)產(chǎn)品系列
- 比亞迪宣布實(shí)現(xiàn)媲美L4級(jí)智能泊車(chē),承諾為安全兜底
- GW2208:同星智能以太網(wǎng)/CANFD/LIN網(wǎng)關(guān)設(shè)備來(lái)襲
- 在中國(guó)市場(chǎng),恩智浦繼續(xù)“上強(qiáng)度”
- 越疆機(jī)器人正式發(fā)布六足仿生機(jī)器狗
- BMW新世代融合獨(dú)創(chuàng)駕控超級(jí)大腦 重塑智能極致駕趣標(biāo)桿
- 2025年1-5月智能座艙供應(yīng)商裝機(jī)量排行榜:本土勢(shì)力多領(lǐng)域突圍,德賽西威持續(xù)霸榜
- 座艙車(chē)載聲學(xué)裝機(jī)量分析:多數(shù)量揚(yáng)聲器逐漸向下普及
- Lumissil Microsystems推出高側(cè)線性LED驅(qū)動(dòng)器系列 擴(kuò)展汽車(chē)照明產(chǎn)品組合
- Elaphe推出用于高性能電動(dòng)汽車(chē)的Sonic X輪轂電機(jī)平臺(tái)
- Aigtek高壓放大器在軟體機(jī)器人研究中的應(yīng)用
- 自動(dòng)駕駛想上路?先解決這幾步吧
- 日產(chǎn)Leaf車(chē)型即將上市,都有哪些改善?
- 氫燃料電池還沒(méi)涼,仍受巨頭喜愛(ài)
- 新能源車(chē)受補(bǔ)貼退坡影響大,接下來(lái)發(fā)展勢(shì)頭如何?
- 特斯拉電動(dòng)車(chē)最高漲了25.66萬(wàn)元,還賣(mài)的出去嘛?
- 汽車(chē)未來(lái)將開(kāi)啟智能穿戴、居家智能和汽車(chē)智能的無(wú)縫對(duì)接!
- 充電速度快能量密度高 奔馳將開(kāi)發(fā)有機(jī)電池
- 阿里巴巴的自動(dòng)駕駛之路
- Cissoid公司推出電動(dòng)汽車(chē)用三相SiC智能功率模塊
- 博世發(fā)起Project 3F項(xiàng)目研發(fā)容錯(cuò)性自動(dòng)駕駛車(chē) 出故障仍安全移動(dòng)