prepare to support squareline studio

This commit is contained in:
Meco Man 2022-05-05 14:21:21 -04:00 committed by guo
parent 907ee070dd
commit e037b7684e
11 changed files with 124 additions and 30 deletions

View File

@ -5,7 +5,6 @@ cwd = GetCurrentDir()
group = []
src = Glob('*.c')
CPPPATH = [cwd]
CPPDEFINES = []
list = os.listdir(cwd)
for d in list:
@ -13,6 +12,6 @@ for d in list:
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, CPPDEFINES = CPPDEFINES)
group = group + DefineGroup('LVGL-port', src, depend = ['BSP_USING_LVGL'], CPPPATH = CPPPATH)
Return('group')

View File

@ -0,0 +1,10 @@
from building import *
cwd = GetCurrentDir()
group = []
src = Glob('*.c')
CPPPATH = [cwd]
group = group + DefineGroup('LVGL-demo', src, depend = ['BSP_USING_LVGL', 'BSP_USING_LVGL_DEMO'], CPPPATH = CPPPATH)
Return('group')

View File

@ -5,7 +5,7 @@
*
* Change Logs:
* Date Author Notes
* 2021-10-17 Meco Man First version
* 2022-05-05 Meco Man First version
*/
#include <rtthread.h>
#include <lvgl.h>
@ -15,17 +15,17 @@
#include <rtdbg.h>
#ifndef LV_THREAD_STACK_SIZE
#define LV_THREAD_STACK_SIZE 4096
#define LV_THREAD_STACK_SIZE 4096
#endif
#ifndef LV_THREAD_PRIO
#define LV_THREAD_PRIO (RT_THREAD_PRIORITY_MAX * 2 / 8)
#define LV_THREAD_PRIO (RT_THREAD_PRIORITY_MAX * 2 / 8)
#endif
static struct rt_thread lvgl_thread;
static rt_uint8_t lvgl_thread_stack[LV_THREAD_STACK_SIZE];
static void lvgl_entry(void *parameter)
static void lvgl_thread_entry(void *parameter)
{
extern void lv_demo_music(void);
lv_demo_music();
@ -39,11 +39,9 @@ static void lvgl_entry(void *parameter)
static int lvgl_demo_init(void)
{
rt_thread_t tid;
rt_thread_init(&lvgl_thread,
"LVGL",
lvgl_entry,
lvgl_thread_entry,
RT_NULL,
&lvgl_thread_stack[0],
sizeof(lvgl_thread_stack),

View File

@ -11,6 +11,8 @@
#ifndef LV_CONF_H
#define LV_CONF_H
#include <rtconfig.h>
#define LV_USE_PERF_MONITOR 1
#define LV_COLOR_DEPTH 16
@ -22,8 +24,8 @@
#define LV_ATTRIBUTE_MEM_ALIGN_SIZE 64
/* music player demo */
#define LV_HOR_RES_MAX 480
#define LV_VER_RES_MAX 272
#define LV_HOR_RES_MAX LCD_WIDTH
#define LV_VER_RES_MAX LCD_HEIGHT
#define LV_USE_DEMO_RTT_MUSIC 1
#define LV_DEMO_RTT_MUSIC_AUTO_PLAY 1
#define LV_FONT_MONTSERRAT_12 1

View File

@ -15,9 +15,9 @@
#include <drv_log.h>
#if LV_USE_NXP_SOC
#include "fsl_gpio.h"
#include "fsl_elcdif.h"
#include "fsl_cache.h"
#include "fsl_gpio.h"
#include "fsl_elcdif.h"
#include "fsl_cache.h"
#endif
/*A static or global variable to store the buffers*/
@ -26,15 +26,7 @@ static lv_disp_draw_buf_t disp_buf;
static lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/
/* Macros for panel. */
#define LCD_WIDTH LV_HOR_RES_MAX
#define LCD_HEIGHT LV_VER_RES_MAX
#define LCD_FB_BYTE_PER_PIXEL 2
#define LCD_HSW 41
#define LCD_HFP 4
#define LCD_HBP 8
#define LCD_VSW 10
#define LCD_VFP 4
#define LCD_VBP 2
#define LCD_POL_FLAGS \
(kELCDIF_DataEnableActiveHigh | kELCDIF_VsyncActiveLow | kELCDIF_HsyncActiveLow | kELCDIF_DriveDataOnRisingClkEdge)
#define LCD_LCDIF_DATA_BUS kELCDIF_DataBus16Bit
@ -203,8 +195,6 @@ void LCDIF_IRQHandler(void)
void lv_port_disp_init(void)
{
static lv_disp_draw_buf_t disp_buf;
lv_disp_draw_buf_init(&disp_buf, s_frameBuffer[0], s_frameBuffer[1], LCD_WIDTH * LCD_HEIGHT);
/*-------------------------

View File

@ -0,0 +1,15 @@
# RT-Thread building script for bridge
import os
from building import *
cwd = GetCurrentDir()
objs = []
list = os.listdir(cwd)
for d in list:
path = os.path.join(cwd, d)
if os.path.isfile(os.path.join(path, 'SConscript')):
objs = objs + SConscript(os.path.join(d, 'SConscript'))
Return('objs')

View File

@ -0,0 +1,2 @@
This folder is for LVGL Squareline Studio

View File

@ -0,0 +1,10 @@
from building import *
cwd = GetCurrentDir()
group = []
src = Glob('*.c')
CPPPATH = [cwd]
group = group + DefineGroup('LVGL-SquareLine', src, depend = ['BSP_USING_LVGL', 'BSP_USING_LVGL_SQUARELINE'], CPPPATH = CPPPATH)
Return('group')

View File

@ -0,0 +1,54 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-10-17 Meco Man First version
*/
#include <rtthread.h>
#include <lvgl.h>
#include <lv_port_indev.h>
#define DBG_TAG "LVGL.demo"
#define DBG_LVL DBG_INFO
#include <rtdbg.h>
#ifndef LV_THREAD_STACK_SIZE
#define LV_THREAD_STACK_SIZE 4096
#endif
#ifndef LV_THREAD_PRIO
#define LV_THREAD_PRIO (RT_THREAD_PRIORITY_MAX * 2 / 8)
#endif
static struct rt_thread lvgl_thread;
static rt_uint8_t lvgl_thread_stack[LV_THREAD_STACK_SIZE];
static void lvgl_thread_entry(void *parameter)
{
extern void ui_init(void);
ui_init();
while(1)
{
lv_task_handler();
rt_thread_mdelay(5);
}
}
static int lvgl_demo_init(void)
{
rt_thread_init(&lvgl_thread,
"LVGL",
lvgl_thread_entry,
RT_NULL,
&lvgl_thread_stack[0],
sizeof(lvgl_thread_stack),
LV_THREAD_PRIO,
10);
rt_thread_startup(&lvgl_thread);
return 0;
}
INIT_APP_EXPORT(lvgl_demo_init);

View File

@ -38,24 +38,31 @@ menu "Onboard Peripheral Drivers"
config LCD_HFP
int "HFP"
default 4
config LCD_VFP
int "VFP"
default 4
config LCD_HBP
int "HBP"
default 8
config LCD_VBP
int "VBP"
default 2
config LCD_HSW
int "HSW"
default 40
config LCD_VSW
int "VSW"
default 10
config LCD_BL_PIN
int "Backlight ctrl pin"
default 63
config LCD_RST_PIN
int "Reset pin"
default 2
@ -67,9 +74,18 @@ menu "Onboard Peripheral Drivers"
select BSP_USING_CACHE
select BSP_USING_LCD
select PKG_USING_LVGL
select PKG_USING_LV_MUSIC_DEMO
default n
if BSP_USING_LVGL
config BSP_USING_LVGL_DEMO
bool "Enable LVGL demo"
select PKG_USING_LV_MUSIC_DEMO
default n
config BSP_USING_LVGL_SQUARELINE
bool "Support LVGL SuqareLine Studio"
default n
endif
endmenu
menu "On-chip Peripheral Drivers"

View File

@ -15,11 +15,11 @@
#include <rtdbg.h>
#ifndef LV_THREAD_STACK_SIZE
#define LV_THREAD_STACK_SIZE 4096
#define LV_THREAD_STACK_SIZE 4096
#endif
#ifndef LV_THREAD_PRIO
#define LV_THREAD_PRIO (RT_THREAD_PRIORITY_MAX * 2 / 8)
#define LV_THREAD_PRIO (RT_THREAD_PRIORITY_MAX * 2 / 8)
#endif
static struct rt_thread lvgl_thread;
@ -39,8 +39,6 @@ static void lvgl_entry(void *parameter)
static int lvgl_demo_init(void)
{
rt_thread_t tid;
rt_thread_init(&lvgl_thread,
"LVGL",
lvgl_entry,