Skip to content

Conversation

wdfk-prog
Copy link
Contributor

@wdfk-prog wdfk-prog commented Sep 20, 2025

  • 新增支持非阻塞模式下的CAN消息发送,包括软件环形缓冲区管理和动态内存分配选项。
  • 完善相关注释和错误处理。
  • 更新示例代码以展示阻塞与非阻塞发送的使用方式,并修正部分结构体字段命名与宏定义

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

[

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

你的解决方案是什么 (what is your solution)

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

  • BSP:
  • .config:
  • action:

]

当前拉取/合并请求的状态 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/ALL_BSP_COMPILE.json 详细请参考链接BSP自查

Copy link

📌 Code Review Assignment

🏷️ Tag: bsp_stm32

Reviewers: @Liang1795 @hamburger-os @wdfk-prog

Changed Files (Click to expand)
  • bsp/stm32/libraries/HAL_Drivers/drivers/drv_can.c

🏷️ Tag: components

Reviewers: @Maihuanyi

Changed Files (Click to expand)
  • components/drivers/can/Kconfig
  • components/drivers/can/dev_can.c
  • components/drivers/include/drivers/dev_can.h

🏷️ Tag: components_driver_can

Reviewers: @wdfk-prog

Changed Files (Click to expand)
  • components/drivers/can/Kconfig
  • components/drivers/can/dev_can.c

📊 Current Review Status (Last Updated: 2025-09-20 15:03 CST)


📝 Review Instructions

  1. 维护者可以通过单击此处来刷新审查状态: 🔄 刷新状态
    Maintainers can refresh the review status by clicking here: 🔄 Refresh Status

  2. 确认审核通过后评论 LGTM/lgtm
    Comment LGTM/lgtm after confirming approval

  3. PR合并前需至少一位维护者确认
    PR must be confirmed by at least one maintainer before merging

ℹ️ 刷新CI状态操作需要具备仓库写入权限。
ℹ️ Refresh CI status operation requires repository Write permission.

@Rbb666 Rbb666 requested a review from Copilot September 21, 2025 01:30
Copy link
Contributor

@Copilot 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 implements a non-blocking send mechanism for the RT-Thread CAN driver framework, enhancing the existing blocking-only transmission capabilities. The implementation adds support for ISR-safe message transmission through software ring buffers and dynamic memory allocation options.

  • Added non-blocking CAN message transmission with software ring buffer management
  • Enhanced API documentation and example code with bilingual (English/Chinese) comments
  • Introduced new configuration options for buffer sizing and memory allocation strategies

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 10 comments.

File Description
components/drivers/include/drivers/dev_can.h Added non-blocking flag to rt_can_msg struct, new ring buffer fields to device struct, and comprehensive API documentation
components/drivers/can/dev_can.c Implemented core non-blocking transmission logic, enhanced error handling, and added ISR-safe buffer management
components/drivers/can/Kconfig Added configuration options for non-blocking buffer size and dynamic allocation
bsp/stm32/libraries/HAL_Drivers/drivers/drv_can.c Implemented STM32-specific non-blocking send function and updated ops structure

@Rbb666 Rbb666 closed this Sep 25, 2025
@Rbb666 Rbb666 reopened this Sep 25, 2025
Copy link

github-actions bot commented Sep 25, 2025

📌 Code Review Assignment

🏷️ Tag: bsp_stm32

Reviewers: Liang1795 hamburger-os wdfk-prog

Changed Files (Click to expand)
  • bsp/stm32/libraries/HAL_Drivers/drivers/drv_can.c

🏷️ Tag: components

Reviewers: Maihuanyi

Changed Files (Click to expand)
  • components/drivers/can/Kconfig
  • components/drivers/can/dev_can.c
  • components/drivers/include/drivers/dev_can.h

🏷️ Tag: components_driver_can

Reviewers: wdfk-prog

Changed Files (Click to expand)
  • components/drivers/can/Kconfig
  • components/drivers/can/dev_can.c

📊 Current Review Status (Last Updated: 2025-09-27 09:42 CST)

  • Liang1795 Pending Review
  • Maihuanyi Pending Review
  • hamburger-os Pending Review
  • wdfk-prog Pending Review

📝 Review Instructions

  1. 维护者可以通过单击此处来刷新审查状态: 🔄 刷新状态
    Maintainers can refresh the review status by clicking here: 🔄 Refresh Status

  2. 确认审核通过后评论 LGTM/lgtm
    Comment LGTM/lgtm after confirming approval

  3. PR合并前需至少一位维护者确认
    PR must be confirmed by at least one maintainer before merging

ℹ️ 刷新CI状态操作需要具备仓库写入权限。
ℹ️ Refresh CI status operation requires repository Write permission.

@wdfk-prog wdfk-prog force-pushed the can branch 2 times, most recently from d1c21da to 0c568ff Compare September 25, 2025 06:07
Copy link
Contributor

@illustriousness illustriousness left a comment

Choose a reason for hiding this comment

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

目前我使用can的大部分场景都是非阻塞发送 支持作者
不过 我在想以下两种情况哪个更好一点

  1. 在设备打开的时候就选择阻塞或者非阻塞
  2. 作者目前的想法:发送can消息设置标志位

@wdfk-prog
Copy link
Contributor Author

目前我使用can的大部分场景都是非阻塞发送 支持作者 不过 我在想以下两种情况哪个更好一点

  1. 在设备打开的时候就选择阻塞或者非阻塞
  2. 作者目前的想法:发送can消息设置标志位
  • 方案1的话,不够灵活.

@Rbb666
Copy link
Member

Rbb666 commented Sep 26, 2025

@unicornx 汪老师,涉及到 doxygen 部分可以帮忙review下吗?

…er functionality

- Added support for non-blocking mode CAN message sending, including software ring buffer management and dynamic memory allocation options.
- Improved related comments and error handling.
- Updated example code to demonstrate the usage of both blocking and non-blocking sending modes, and corrected some structure field naming and macro definitions.
Copy link
Contributor

@unicornx unicornx left a comment

Choose a reason for hiding this comment

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

我只看了 doxygen 注释部分,LGTM。

@Rbb666 Rbb666 merged commit 11156de into RT-Thread:master Sep 28, 2025
68 of 69 checks passed
@wdfk-prog wdfk-prog deleted the can branch September 29, 2025 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants