Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync from master #6981

Merged
merged 23 commits into from
Feb 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
feed84b
fix rt_kprint 64bit error
zhkag Feb 20, 2023
ff58949
update rtdevice.h add lcd
XYZ-20240101 Feb 18, 2023
aaba21c
[fix]避免字符设备特殊控制指令和通用控制指令冲突
JonasWen Feb 21, 2023
1533b88
[arduino][lpc55s69] : 对接RTduino
Z8MAN8 Feb 22, 2023
b3b8c23
[spi] rt_spi_configure 增加对cs_pin处理
liYony Feb 23, 2023
52cb2f0
[lwIP] apply AF_UNIX feature (#6954)
Guozhanxin Feb 23, 2023
6d4764a
serial_v2 rt_device_write/read return data type as rt_ssize_t
JonasWen Feb 23, 2023
96a636f
[Renesas]Add tft-lcd lvgl support
Rbb666 Feb 22, 2023
08c2a65
[rtduino][lpc55s69] 修正RTduino框架下的引脚错误 (#6963)
kurisaW Feb 23, 2023
382e9bc
[rt-smart] handling kernel from accessing unmapped user stack (#6957)
polarvid Feb 24, 2023
7bf6648
[serial]增加at32的serial_v2驱动
JonasWen Feb 23, 2023
a5c62b9
[bsp/at32] add support usb driver (#6968)
sheltonyu Feb 25, 2023
022760c
[Infineon]Fix scb5 can't use bug
Rbb666 Feb 24, 2023
faddfec
[rtduino][lpc55s69] update (#6972)
Z8MAN8 Feb 25, 2023
7763183
[rtduino][lpc55s69] 纠正uart引脚错误并使能相关依赖项 (#6976)
kurisaW Feb 25, 2023
e50a7e3
🐞 fix(components/drivers/tty/pty.c): fix ptmx not init (#6970)
xqyjlj Feb 25, 2023
4c1c6ef
解决关中断时进行了调度操作
zhkag Feb 24, 2023
d3553e7
fixed fstat/stat/readlink syscall.
geniusgogo Feb 24, 2023
53afeda
fix inet_ioctlsocket set O_LARGEFILE flag by musl.
geniusgogo Feb 24, 2023
a53367a
fixed O_LARGEFILE not defined ci build error.
geniusgogo Feb 25, 2023
fef2607
[lwp] save virtual addr in shm structure
polarvid Feb 25, 2023
12f0df9
[libcpu/aarch64] stop when no page is free
polarvid Feb 25, 2023
e63e33a
[ch32][bsp] fix warning: rt_size_t to rt_ssize_t
linshire Feb 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Renesas]Add tft-lcd lvgl support
  • Loading branch information
Rbb666 authored and mysterywolf committed Feb 23, 2023
commit 96a636f0b533ecdb6e936ce3ed2641cc77ffe6ba
8 changes: 6 additions & 2 deletions bsp/renesas/libraries/HAL_Drivers/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ if GetDepend(['BSP_USING_I2C', 'BSP_USING_HW_I2C']):
src += ['drv_i2c.c']

if GetDepend(['BSP_USING_SPI']):
src += ['drv_spi.c']
src += ['drv_sci_spi.c']
if GetDepend('BSP_USING_SCI_SPI0') or GetDepend('BSP_USING_SCI_SPI1') \
or GetDepend('BSP_USING_SCI_SPI2') or GetDepend('BSP_USING_SCI_SPI3') \
or GetDepend('BSP_USING_SCI_SPI4') or GetDepend('BSP_USING_SCI_SPI9'): \
src += ['drv_sci_spi.c']
else:
src += ['drv_spi.c']

if GetDepend(['BSP_USING_ADC']):
src += ['drv_adc.c']
Expand Down
34 changes: 32 additions & 2 deletions bsp/renesas/ra6m3-ek/board/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ menu "Hardware Drivers Config"
endif
endif

menuconfig BSP_USING_SPI
bool "Enable SPI BUS"
default n
select RT_USING_SPI
if BSP_USING_SPI
config BSP_USING_SPI0
bool "Enable SPI0 BUS"
default n

config BSP_USING_SPI1
bool "Enable SPI1 BUS"
default n
endif

menuconfig BSP_USING_FS
bool "Enable File System"
select RT_USING_DFS
Expand Down Expand Up @@ -80,11 +94,27 @@ menu "Hardware Drivers Config"
select BSP_USING_GPIO
default n

config BSP_USING_LVGL
config BSP_USING_SPI_LCD
bool "Enable SPI LCD"
select BSP_USING_GPIO
select BSP_USING_SPI
select BSP_USING_SPI0
default n

menuconfig BSP_USING_LVGL
bool "Enable LVGL for LCD"
select BSP_USING_LCD
select PKG_USING_LVGL
default n
if BSP_USING_LVGL
config BSP_USING_LCD_ILI9431
bool "Enable LVGL for LCD_ILI9431"
select BSP_USING_SPI_LCD
default n
config BSP_USING_LCD_RGB
bool "Enable LVGL for LCD_RGB565"
select BSP_USING_LCD
default n
endif

if BSP_USING_LVGL
config BSP_USING_LVGL_DEMO
Expand Down
2 changes: 1 addition & 1 deletion bsp/renesas/ra6m3-ek/board/board.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down
2 changes: 1 addition & 1 deletion bsp/renesas/ra6m3-ek/board/lvgl/demo/lv_demo.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down
21 changes: 16 additions & 5 deletions bsp/renesas/ra6m3-ek/board/lvgl/lv_conf.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-10-18 Meco Man First version
* 2023-02-22 Rbb666 First version
*/

#ifndef LV_CONF_H
#define LV_CONF_H

#include <rtconfig.h>

/* Enable additional color format support */
#define DLG_LVGL_CF 1

Expand All @@ -20,10 +22,19 @@

#define LV_USE_PERF_MONITOR 1
#define LV_COLOR_DEPTH 16
#define LV_HOR_RES_MAX 480
#define LV_VER_RES_MAX 272

#define DLG_LVGL_USE_GPU_RA6M3 0
#ifdef BSP_USING_SPI_LCD
#define LV_HOR_RES_MAX 240
#define LV_VER_RES_MAX 320
#define LV_COLOR_16_SWAP 1
#define LV_DPI_DEF 99
#else
#define LV_HOR_RES_MAX 480
#define LV_VER_RES_MAX 272
#define LV_DPI_DEF 89
#endif

#define DLG_LVGL_USE_GPU_RA6M3 0

#ifdef PKG_USING_LV_MUSIC_DEMO
/* music player demo */
Expand Down
75 changes: 24 additions & 51 deletions bsp/renesas/ra6m3-ek/board/lvgl/lv_port_disp.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
Expand All @@ -8,56 +8,32 @@
* 2021-11-24 Rbb666 The first version
*/
#include <lvgl.h>
#include "lcd_port.h"
#include "hal_data.h"

#if DLG_LVGL_USE_GPU_RA6M3
#include "lv_port_gpu.h"
#endif

#ifdef BSP_USING_SPI_LCD
#include "lcd_ili9341.h"
#else
#include "lcd_port.h"
#endif

#define COLOR_BUFFER (LV_HOR_RES_MAX * LV_VER_RES_MAX / 4)

/*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*/
// 0x1FFE0000 0x20040000
__attribute__((section(".ARM.__at_0x1FFE0000"))) lv_color_t buf_1[COLOR_BUFFER];

static uint8_t lvgl_ready_done = RT_EBUSY;

static rt_device_t device;
static struct rt_device_graphic_info info;
static rt_sem_t trans_done_semphr = RT_NULL;

void _ra_port_display_callback(display_callback_args_t *p_args)
{
if (lvgl_ready_done != RT_EOK)
return;

if (DISPLAY_EVENT_LINE_DETECTION == p_args->event)
{
/* enter interrupt */
rt_interrupt_enter();

lv_disp_flush_ready((lv_disp_drv_t *)&disp_drv);

rt_sem_release(trans_done_semphr);

/* exit interrupt */
rt_interrupt_leave();
}
}

// Wait until Vsync is triggered through callback function
void vsync_wait(void)
{
rt_sem_take(trans_done_semphr, RT_WAITING_FOREVER);
}

#if !DLG_LVGL_USE_GPU_RA6M3
static void color_to16_maybe(lv_color16_t *dst, lv_color_t *src)
{
#if (LV_COLOR_DEPTH == 16)
Expand All @@ -68,9 +44,15 @@ static void color_to16_maybe(lv_color16_t *dst, lv_color_t *src)
dst->ch.red = src->ch.red;
#endif
}
#endif

static void disp_flush(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p)
{
#ifdef BSP_USING_SPI_LCD
lcd_fill_array_spi(area->x1, area->y1, area->x2, area->y2, color_p);
#elif DLG_LVGL_USE_GPU_RA6M3
lv_port_gpu_flush();
#else
int x1, x2, y1, y2;

x1 = area->x1;
Expand Down Expand Up @@ -98,10 +80,6 @@ static void disp_flush(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_
uint32_t y;
long int location = 0;

#if DLG_LVGL_USE_GPU_RA6M3
lv_port_gpu_flush();
#endif

/* color_p is a buffer pointer; the buffer is provided by LVGL */
lv_color16_t *fbp16 = (lv_color16_t *)info.framebuffer;

Expand All @@ -116,12 +94,16 @@ static void disp_flush(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_

color_p += x2 - act_x2;
}

vsync_wait();
#endif
lv_disp_flush_ready(disp_drv);
}

void lv_port_disp_init(void)
{
#ifdef BSP_USING_SPI_LCD
spi_lcd_init();
#else
static rt_device_t device;
/* LCD Device Init */
device = rt_device_find("lcd");
RT_ASSERT(device != RT_NULL);
Expand All @@ -133,22 +115,15 @@ void lv_port_disp_init(void)

RT_ASSERT(info.bits_per_pixel == 8 || info.bits_per_pixel == 16 ||
info.bits_per_pixel == 24 || info.bits_per_pixel == 32);

trans_done_semphr = rt_sem_create("lvgl_sem", 1, RT_IPC_FLAG_PRIO);
if (trans_done_semphr == RT_NULL)
{
rt_kprintf("create transform done semphr failed.\n");
return;
}

#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 = LCD_WIDTH;
disp_drv.ver_res = LCD_HEIGHT;
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;
Expand All @@ -163,6 +138,4 @@ void lv_port_disp_init(void)

/*Finally register the driver*/
lv_disp_drv_register(&disp_drv);

lvgl_ready_done = RT_EOK;
}
3 changes: 1 addition & 2 deletions bsp/renesas/ra6m3-ek/board/lvgl/lv_port_indev.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
Expand All @@ -12,5 +12,4 @@

void lv_port_indev_init(void)
{
static lv_indev_drv_t indev_drv;
}
26 changes: 8 additions & 18 deletions bsp/renesas/ra6m3-ek/board/ports/SConscript
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@

import os
from building import *
import rtconfig

cwd = GetCurrentDir()

src = []

if GetDepend(['BSP_USING_RW007']):
src += Glob('drv_rw007.c')

CPPPATH = [cwd]
LOCAL_CFLAGS = ''

if rtconfig.PLATFORM in ['gcc', 'armclang']:
LOCAL_CFLAGS += ' -std=c99'
elif rtconfig.PLATFORM in ['armcc']:
LOCAL_CFLAGS += ' --c99'
objs = []
cwd = GetCurrentDir()

group = DefineGroup('Drivers', src, depend = [], CPPPATH = CPPPATH, LOCAL_CFLAGS = LOCAL_CFLAGS)
list = os.listdir(cwd)
for item in list:
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
objs = objs + SConscript(os.path.join(item, 'SConscript'))

Return('group')
Return('objs')
2 changes: 1 addition & 1 deletion bsp/renesas/ra6m3-ek/board/ports/gpio_cfg.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down
22 changes: 22 additions & 0 deletions bsp/renesas/ra6m3-ek/board/ports/ili9341/SConscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

from building import *
import rtconfig

cwd = GetCurrentDir()

src = []

if GetDepend(['BSP_USING_SPI_LCD']):
src += Glob('lcd_ili9341.c')

CPPPATH = [cwd]
LOCAL_CFLAGS = ''

if rtconfig.PLATFORM in ['gcc', 'armclang']:
LOCAL_CFLAGS += ' -std=c99'
elif rtconfig.PLATFORM in ['armcc']:
LOCAL_CFLAGS += ' --c99'

group = DefineGroup('ili9341', src, depend = [], CPPPATH = CPPPATH, LOCAL_CFLAGS = LOCAL_CFLAGS)

Return('group')
Loading