Skip to content

Conversation

@godmial
Copy link
Contributor

@godmial godmial commented May 22, 2025

拉取/合并请求描述:(PR description)

为什么提交这份PR (why to submit this PR)

gd32470z-lckfb新增官方配套800x480 RGB LCD屏幕的显示驱动与触摸驱动,开发板运行比较稳定。
398901008-d8721920-45dc-4bac-9872-1c8621079597

请提供验证的bsp和config (provide the config and bsp)

  • BSP: gd32470z-lckfb

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • [* ] 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • [*] 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • [*] 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • [*] 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • [*] 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • [*] 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • [*] 代码是高质量的 Code in this PR is of high quality
  • [*] 已经使用formatting 等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification
  • [*] 如果是新增bsp, 已经添加ci检查到.github/workflows/bsp_buildings.yml 详细请参考链接BSP自查

@github-actions github-actions bot added BSP BSP: GD32 BSP related with GD32 labels May 22, 2025
@supperthomas
Copy link
Member

CI问题解决一下,参考https://club.rt-thread.org/ask/article/5c41835bb8ff9b41.html 添加一下yml

@supperthomas supperthomas reopened this May 23, 2025
@supperthomas supperthomas requested a review from Copilot May 23, 2025 01:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds official support for the GD32470Z-LCKFB board’s 800×480 RGB LCD and FT5206 capacitive touch panel, including display drivers, touch drivers, example application, and build configuration updates.

  • Integrated TLI and GPU source files into the GD32F4xx firmware SConscript
  • Added font bitmap array, LCD driver, touch driver, and drawing panel example
  • Updated Kconfig, board README, and top-level SConstruct to enable new features

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
bsp/gd32/arm/libraries/GD32F4xx_Firmware_Library/SConscript Conditionally include TLI and GPU source files
bsp/gd32/arm/gd32470z-lckfb/board/ports/font.h Added ASCII font bitmap array
bsp/gd32/arm/gd32470z-lckfb/board/ports/drv_touch.h Introduced FT5206 touch controller macros and APIs
bsp/gd32/arm/gd32470z-lckfb/board/ports/drv_touch.c Implemented I²C bit-banged touch routines
bsp/gd32/arm/gd32470z-lckfb/board/ports/drv_lcd.h Defined LCD parameters and frame buffer extern
bsp/gd32/arm/gd32470z-lckfb/board/ports/draw_panel.c Added interactive draw panel example
bsp/gd32/arm/gd32470z-lckfb/board/ports/SConscript Build script to compile new drivers and example
bsp/gd32/arm/gd32470z-lckfb/board/ports/README.md Usage instructions for enabling LCD and touch modules
bsp/gd32/arm/gd32470z-lckfb/board/Kconfig Configuration options for LCD, touch, GPU, examples
bsp/gd32/arm/gd32470z-lckfb/SConstruct Top-level inclusion of the new ports SConscript
Comments suppressed due to low confidence (1)

bsp/gd32/arm/gd32470z-lckfb/board/ports/font.h:4

  • [nitpick] The font array asc2_1608 is globally visible. Consider adding 'static' to limit its linkage or moving it to .c if it’s internal, to avoid symbol collisions.
const unsigned char asc2_1608[95][16]={

Comment on lines +23 to +24
#define CT_SDA_IN() gpio_mode_set(SCL_PORT, GPIO_MODE_INPUT, GPIO_PUPD_PULLUP, SDA_PIN); //{GPIOF->MODER&=~(3<<(2*11));GPIOF->MODER|=0<<2*11;} //PF11输入模式
#define CT_SDA_OUT() gpio_mode_set(SCL_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, SDA_PIN); //{GPIOF->MODER&=~(3<<(2*11));GPIOF->MODER|=1<<2*11;} //PF11输出模式
Copy link

Copilot AI May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CT_SDA_IN macro configures SDA_PIN on SCL_PORT instead of SDA_PORT. It should use SDA_PORT to set the correct pin direction.

Suggested change
#define CT_SDA_IN() gpio_mode_set(SCL_PORT, GPIO_MODE_INPUT, GPIO_PUPD_PULLUP, SDA_PIN); //{GPIOF->MODER&=~(3<<(2*11));GPIOF->MODER|=0<<2*11;} //PF11输入模式
#define CT_SDA_OUT() gpio_mode_set(SCL_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, SDA_PIN); //{GPIOF->MODER&=~(3<<(2*11));GPIOF->MODER|=1<<2*11;} //PF11输出模式
#define CT_SDA_IN() gpio_mode_set(SDA_PORT, GPIO_MODE_INPUT, GPIO_PUPD_PULLUP, SDA_PIN); //{GPIOF->MODER&=~(3<<(2*11));GPIOF->MODER|=0<<2*11;} //PF11输入模式
#define CT_SDA_OUT() gpio_mode_set(SDA_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, SDA_PIN); //{GPIOF->MODER&=~(3<<(2*11));GPIOF->MODER|=1<<2*11;} //PF11输出模式

Copilot uses AI. Check for mistakes.
Comment on lines +23 to +24
#define CT_SDA_IN() gpio_mode_set(SCL_PORT, GPIO_MODE_INPUT, GPIO_PUPD_PULLUP, SDA_PIN); //{GPIOF->MODER&=~(3<<(2*11));GPIOF->MODER|=0<<2*11;} //PF11输入模式
#define CT_SDA_OUT() gpio_mode_set(SCL_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, SDA_PIN); //{GPIOF->MODER&=~(3<<(2*11));GPIOF->MODER|=1<<2*11;} //PF11输出模式
Copy link

Copilot AI May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CT_SDA_OUT macro also configures SDA_PIN on SCL_PORT instead of SDA_PORT; update to use SDA_PORT.

Suggested change
#define CT_SDA_IN() gpio_mode_set(SCL_PORT, GPIO_MODE_INPUT, GPIO_PUPD_PULLUP, SDA_PIN); //{GPIOF->MODER&=~(3<<(2*11));GPIOF->MODER|=0<<2*11;} //PF11输入模式
#define CT_SDA_OUT() gpio_mode_set(SCL_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, SDA_PIN); //{GPIOF->MODER&=~(3<<(2*11));GPIOF->MODER|=1<<2*11;} //PF11输出模式
#define CT_SDA_IN() gpio_mode_set(SDA_PORT, GPIO_MODE_INPUT, GPIO_PUPD_PULLUP, SDA_PIN); //{GPIOF->MODER&=~(3<<(2*11));GPIOF->MODER|=0<<2*11;} //PF11输入模式
#define CT_SDA_OUT() gpio_mode_set(SDA_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, SDA_PIN); //{GPIOF->MODER&=~(3<<(2*11));GPIOF->MODER|=1<<2*11;} //PF11输出模式

Copilot uses AI. Check for mistakes.
#define CT_SDA_IN() gpio_mode_set(SCL_PORT, GPIO_MODE_INPUT, GPIO_PUPD_PULLUP, SDA_PIN); //{GPIOF->MODER&=~(3<<(2*11));GPIOF->MODER|=0<<2*11;} //PF11输入模式
#define CT_SDA_OUT() gpio_mode_set(SCL_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, SDA_PIN); //{GPIOF->MODER&=~(3<<(2*11));GPIOF->MODER|=1<<2*11;} //PF11输出模式
// IO操作函数
#define CT_IIC_SCL // PBout(0) //SCL
Copy link

Copilot AI May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CT_IIC_SCL macro is defined as empty, making it a no-op. Either implement it or remove the unused macro to avoid confusion.

Suggested change
#define CT_IIC_SCL // PBout(0) //SCL
#define CT_IIC_SCL SCL_TOGGLE // PBout(0) //SCL

Copilot uses AI. Check for mistakes.
#define FT_CMD_WR 0X70 // 写命令
#define FT_CMD_RD 0X71 // 读命令
// FT5206 部分寄存器定义
#define FT_DEVIDE_MODE 0x00 // FT5206模式控制寄存器
Copy link

Copilot AI May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The macro name FT_DEVIDE_MODE has a typo (‘DEVIDE’); it should be renamed to FT_DEVICE_MODE for clarity.

Suggested change
#define FT_DEVIDE_MODE 0x00 // FT5206模式控制寄存器
#define FT_DEVICE_MODE 0x00 // FT5206模式控制寄存器

Copilot uses AI. Check for mistakes.
return;
}
//如果离开了y轴触摸范围
if (tp_dev.y[contact] <= sy && tp_dev.y[contact] >= ey)
Copy link

Copilot AI May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In letgo_scan the y-axis check uses && but should use || to detect leaving the vertical range (y <= sy OR y >= ey).

Suggested change
if (tp_dev.y[contact] <= sy && tp_dev.y[contact] >= ey)
if (tp_dev.y[contact] <= sy || tp_dev.y[contact] >= ey)

Copilot uses AI. Check for mistakes.
Comment on lines 144 to 146
// 返回从机有无应答
// 1,有应答
// 0,无应答
Copy link

Copilot AI May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment above CT_IIC_Send_Byte describes return values, but the function signature returns void. Update or remove the inaccurate comment.

Suggested change
// 返回从机有无应答
// 1,有应答
// 0,无应答
// 发送一个字节数据到I2C总线

Copilot uses AI. Check for mistakes.
extern uint16_t ltdc_lcd_framebuf0[800][480] __attribute__((at(LCD_FRAME_BUF_ADDR)));
#elif defined(__GNUC__)
// GCC 编译器 (如 RT-Thread 使用的 GCC)
extern uint16_t ltdc_lcd_framebuf0[10][10];
Copy link

Copilot AI May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The frame buffer is declared as [10][10] in the GCC branch, which doesn’t match the LCD dimensions (800×480). It should be declared [800][480].

Suggested change
extern uint16_t ltdc_lcd_framebuf0[10][10];
extern uint16_t ltdc_lcd_framebuf0[LCD_WIDTH][LCD_HEIGHT];

Copilot uses AI. Check for mistakes.
@Rbb666 Rbb666 closed this May 23, 2025
@Rbb666 Rbb666 reopened this May 23, 2025
@kurisaW
Copy link
Member

kurisaW commented May 23, 2025

ci有时候抽风,可能是因为速率问题导致没拿到这里的api,下次遇到这种情况重新触发一下就好了

@Rbb666
Copy link
Member

Rbb666 commented May 23, 2025

@godmial 代码需要格式化下,可以详见ci的报错:https://github.com/RT-Thread/rt-thread/actions/runs/15200966966/job/42754910481?pr=10311

_widget_object_struct button_clear, button_color, button_pixel, button_eraser;


/**********************************************************
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.使用RTT的编程规范修改注释 2.readme文件新增注意事项以及原作者信息

@godmial godmial requested a review from Rbb666 May 24, 2025 01:48
@Rbb666
Copy link
Member

Rbb666 commented May 24, 2025

可以的话作者可以把自己添加到 rtthread/MAINTAINERS 中,这样后续有人改动相关文件,可以由您来负责审核

@godmial
Copy link
Contributor Author

godmial commented May 24, 2025

可以的话作者可以把自己添加到 rtthread/MAINTAINERS 中,这样后续有人改动相关文件,可以由您来负责审核

那太好了

@Rbb666 Rbb666 merged commit 524ae34 into RT-Thread:master May 24, 2025
59 checks passed
@kurisaW
Copy link
Member

kurisaW commented May 26, 2025

@godmial 能否参与到对该BSP:GD32407z-lckfb 的维护?我们最低只接受bsp及其递归目录下的维护申请,如果您有意向重点维护此bsp,可以提个PR修改MAINTAINERS,修改您的信息如下:

tag: bsp_gd32470z-lckfb
path: bsp/gd32/arm/gd32470z-lckfb
owners: Wu Ying Xiang(godmial)<2633967641@qq.com>

同时请遵循MAINTAINERS修改规则,根据tag按字母顺序排序

@godmial
Copy link
Contributor Author

godmial commented May 26, 2025

@godmial 能否参与到对该BSP:GD32407z-lckfb 的维护?我们最低只接受bsp及其递归目录下的维护申请,如果您有意向重点维护此bsp,可以提个PR修改MAINTAINERS,修改您的信息如下:

tag: bsp_gd32470z-lckfb
path: bsp/gd32/arm/gd32470z-lckfb
owners: Wu Ying Xiang(godmial)<2633967641@qq.com>

同时请遵循MAINTAINERS修改规则,根据tag按字母顺序排序

我个人是非常愿意的,但是我并不是本BSP的作者,我需要征求一下BSP作者的同意

@kurisaW
Copy link
Member

kurisaW commented May 26, 2025

@godmial 你可以以协助者的身份来review此bsp相关的PR,审核团不强制要求必须是作为作者来review

@godmial
Copy link
Contributor Author

godmial commented May 26, 2025

@godmial 你可以以协助者的身份来review此bsp相关的PR,审核团不强制要求必须是作为作者来review

目前已经征得BSP作者同意

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BSP: GD32 BSP related with GD32 BSP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants