Conversation
- 在Kconfig中添加BSP_USING_PWM和BSP_USING_HWTIMER配置项 - 修正PWM时钟获取逻辑,使其能正确得到APB1/APB2上的定时器时钟源频率,添加在pwm结构体通道引脚资源配置项 - 修改硬件定时器初始化逻辑,修正定时器中断处理函数,适配GD32F4xx系列 - 在main.c中添加hwtimer_test和pwm_test测试函数 - 修复PWM和硬件定时器的依赖关系配置
- 硬件i2c主机接收驱动采用方案B,但不支持接收小于3字节,现修复该问题 - 增加方案A。
- 在ALL_BSP_COMPILE.json配置文件中新增gd32405rg开发板
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
There was a problem hiding this comment.
Pull request overview
This pull request adds support for the GD32F405RG chip BSP and includes important driver fixes for GD32 hardware I2C, PWM, and hardware timer peripherals.
Changes:
- Adds new BSP for GD32405RG chip with complete board support files, linker scripts, and configuration
- Fixes GD32 hardware I2C driver timing issues that caused IIC read operations to hang, and adds support for both Mode A and Mode B reception schemes
- Refactors and optimizes PWM driver with improved timer clock frequency calculation, better structure design, and support for more hardware timers (TIMER0-13)
- Enhances hardware timer driver with proper GD32F4xx interrupt handler configuration, relocated initialization, and deinit functionality
Reviewed changes
Copilot reviewed 31 out of 36 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| drv_pwm.c | Complete refactoring of PWM driver with optimized structure, improved clock calculation, and support for 14 timers |
| drv_hard_i2c.c | Fixed I2C master receive timing issues and added Mode A/B support with proper ACK/NACK handling |
| drv_hwtimer.c | Added GD32F4xx interrupt handlers, relocated clock/interrupt initialization to init function, implemented deinit |
| gd32405rg/* | New BSP with board files, linker scripts, Kconfig, applications, and build scripts |
| ALL_BSP_COMPILE.json | Added gd32405rg to CI compilation list |
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
你的解决方案是什么 (what is your solution)
请提供验证的bsp和config (provide the config and bsp)
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up