summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRbb666 <[email protected]>2023-04-04 13:15:43 +0800
committerMan, Jianting (Meco) <[email protected]>2023-04-04 09:03:56 -0400
commit8a52e65013d1abb7cfc032409000533000ccd0c2 (patch)
treeb216ab2c4403d310e474fff148307ccb72027805
parent72037b635347958232f3de877e1ebc2d352467a8 (diff)
[Infineon]Add lvgl support
-rw-r--r--bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/SConscript16
-rw-r--r--bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/demo/SConscript17
-rw-r--r--bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/demo/lv_demo.c17
-rw-r--r--bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/lv_conf.h35
-rw-r--r--bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/lv_port_disp.c58
-rw-r--r--bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/lv_port_indev.c15
-rw-r--r--bsp/Infineon/psoc6-evaluationkit-062S2/board/Kconfig20
7 files changed, 178 insertions, 0 deletions
diff --git a/bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/SConscript b/bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/SConscript
new file mode 100644
index 0000000000..79d9772177
--- /dev/null
+++ b/bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/SConscript
@@ -0,0 +1,16 @@
+from building import *
+import os
+
+cwd = GetCurrentDir()
+group = []
+src = Glob('*.c')
+CPPPATH = [cwd]
+
+list = os.listdir(cwd)
+for d in list:
+ path = os.path.join(cwd, d)
+ if os.path.isfile(os.path.join(path, 'SConscript')):
+ group = group + SConscript(os.path.join(d, 'SConscript'))
+
+group = group + DefineGroup('LVGL-port', src, depend = ['BSP_USING_LVGL'], CPPPATH = CPPPATH)
+Return('group')
diff --git a/bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/demo/SConscript b/bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/demo/SConscript
new file mode 100644
index 0000000000..9c1b6d1ebd
--- /dev/null
+++ b/bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/demo/SConscript
@@ -0,0 +1,17 @@
+from building import *
+import os
+
+cwd = GetCurrentDir()
+group = []
+src = Glob('*.c')
+CPPPATH = [cwd]
+
+list = os.listdir(cwd)
+for d in list:
+ path = os.path.join(cwd, d)
+ if os.path.isfile(os.path.join(path, 'SConscript')):
+ group = group + SConscript(os.path.join(d, 'SConscript'))
+
+group = group + DefineGroup('LVGL-demo', src, depend = ['BSP_USING_LVGL', 'BSP_USING_LVGL_DEMO'], CPPPATH = CPPPATH)
+
+Return('group')
diff --git a/bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/demo/lv_demo.c b/bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/demo/lv_demo.c
new file mode 100644
index 0000000000..fd30e46f96
--- /dev/null
+++ b/bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/demo/lv_demo.c
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2006-2023, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2021-10-17 Meco Man First version
+ * 2022-05-10 Meco Man improve rt-thread initialization process
+ */
+
+void lv_user_gui_init(void)
+{
+ /* display demo; you may replace with your LVGL application at here */
+ extern void lv_demo_music(void);
+ lv_demo_music();
+}
diff --git a/bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/lv_conf.h b/bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/lv_conf.h
new file mode 100644
index 0000000000..ae1c4a5262
--- /dev/null
+++ b/bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/lv_conf.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2006-2023, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2023-02-22 Rbb666 First version
+ */
+
+#ifndef LV_CONF_H
+#define LV_CONF_H
+
+#include <rtconfig.h>
+
+#define LV_USE_PERF_MONITOR 1
+#define LV_COLOR_DEPTH 16
+
+#ifdef PKG_USING_ILI9341
+ #define LV_HOR_RES_MAX 240
+ #define LV_VER_RES_MAX 320
+ #define LV_COLOR_16_SWAP 1
+ #define LV_DPI_DEF 99
+#endif
+
+#ifdef PKG_USING_LV_MUSIC_DEMO
+/* music player demo */
+#define LV_USE_DEMO_RTT_MUSIC 1
+#define LV_DEMO_RTT_MUSIC_AUTO_PLAY 1
+#define LV_FONT_MONTSERRAT_12 1
+#define LV_FONT_MONTSERRAT_16 1
+#define LV_COLOR_SCREEN_TRANSP 0
+#endif /* PKG_USING_LV_MUSIC_DEMO */
+
+#endif
diff --git a/bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/lv_port_disp.c b/bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/lv_port_disp.c
new file mode 100644
index 0000000000..8d44148d92
--- /dev/null
+++ b/bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/lv_port_disp.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2006-2023, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2022-04-04 Rbb666 The first version
+ */
+#include <lvgl.h>
+
+#ifdef PKG_USING_ILI9341
+ #include "lcd_ili9341.h"
+#endif
+
+#define COLOR_BUFFER (LV_HOR_RES_MAX * LV_VER_RES_MAX)
+
+/*A static or global variable to store the buffers*/
+static lv_disp_draw_buf_t disp_buf;
+
+/*Descriptor of a display driver*/
+static lv_disp_drv_t disp_drv;
+static struct rt_device_graphic_info info;
+
+/*Static or global buffer(s). The second buffer is optional*/
+static lv_color_t buf_1[COLOR_BUFFER];
+
+static void disp_flush(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p)
+{
+#ifdef PKG_USING_ILI9341
+ lcd_fill_array_spi(area->x1, area->y1, area->x2, area->y2, color_p);
+#endif
+ lv_disp_flush_ready(disp_drv);
+}
+
+void lv_port_disp_init(void)
+{
+#ifdef PKG_USING_ILI9341
+ spi_lcd_init(25);
+#endif
+ /*Initialize `disp_buf` with the buffer(s). With only one buffer use NULL instead buf_2 */
+ lv_disp_draw_buf_init(&disp_buf, buf_1, NULL, COLOR_BUFFER);
+
+ lv_disp_drv_init(&disp_drv); /*Basic initialization*/
+
+ /*Set the resolution of the display*/
+ disp_drv.hor_res = LV_HOR_RES_MAX;
+ disp_drv.ver_res = LV_VER_RES_MAX;
+
+ /*Set a display buffer*/
+ disp_drv.draw_buf = &disp_buf;
+
+ /*Used to copy the buffer's content to the display*/
+ disp_drv.flush_cb = disp_flush;
+
+ /*Finally register the driver*/
+ lv_disp_drv_register(&disp_drv);
+}
diff --git a/bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/lv_port_indev.c b/bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/lv_port_indev.c
new file mode 100644
index 0000000000..efb97a82f1
--- /dev/null
+++ b/bsp/Infineon/psoc6-evaluationkit-062S2/applications/lvgl/lv_port_indev.c
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2006-2023, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2022-04-04 Rbb666 The first version
+ */
+#include <lvgl.h>
+#include <rtdevice.h>
+
+void lv_port_indev_init(void)
+{
+}
diff --git a/bsp/Infineon/psoc6-evaluationkit-062S2/board/Kconfig b/bsp/Infineon/psoc6-evaluationkit-062S2/board/Kconfig
index 77e3e6a916..32e0b44073 100644
--- a/bsp/Infineon/psoc6-evaluationkit-062S2/board/Kconfig
+++ b/bsp/Infineon/psoc6-evaluationkit-062S2/board/Kconfig
@@ -257,6 +257,26 @@ menu "On-chip Peripheral Drivers"
bool "Enable TIM2"
default n
endif
+
+ menuconfig BSP_USING_LVGL
+ bool "Enable LVGL for LCD"
+ select PKG_USING_LVGL
+ default n
+ if BSP_USING_LVGL
+ config BSP_USING_LCD_ILI9431
+ bool "Enable LVGL for LCD_ILI9431"
+ select PKG_USING_ILI9341
+ select BSP_USING_SPI
+ select BSP_USING_SPI0
+ default n
+ endif
+
+ if BSP_USING_LVGL
+ config BSP_USING_LVGL_DEMO
+ bool "Enable LVGL demo"
+ select PKG_USING_LV_MUSIC_DEMO
+ default y
+ endif
endmenu
menu "Board extended module Drivers"