-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[fix] drivers: spi: refactor SPI bit operations into independent conf… #11102
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
base: master
Are you sure you want to change the base?
Conversation
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
📌 Code Review Assignment🏷️ Tag: componentsReviewers: Maihuanyi Changed Files (Click to expand)
🏷️ Tag: components_driver_spiReviewers: Liang1795 wdfk-prog Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2025-12-29 14:35 CST)
📝 Review Instructions
|
2980689 to
8e0c6f3
Compare
There was a problem hiding this 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 refactors the SPI bit-bang operations into an independent configuration option to provide better modularity. Previously, users who only wanted the bit operations (RT_USING_SPI_BITOPS) were forced to include the full soft SPI implementation (dev_soft_spi.c), causing conflicts when implementing custom SPI drivers.
Key Changes:
- Introduced
RT_USING_SPI_BITOPSas an independent configuration option for bit-bang operation functions - Made
RT_USING_SOFT_SPIdepend onRT_USING_SPI_BITOPSthrough a select statement to maintain backward compatibility - Reorganized build script to compile
dev_spi_bit_ops.cindependently fromdev_soft_spi.c
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| components/drivers/spi/Kconfig | Added new RT_USING_SPI_BITOPS configuration option with dependencies |
| components/drivers/spi/SConscript | Separated build conditions for bit operations and soft SPI implementation |
| components/drivers/spi/dev_soft_spi.c | Fixed error message to reference correct menuconfig path (SPI instead of I2C) |
| config RT_USING_SPI_BITOPS | ||
| bool "Use Software SPI bit-bang operations" | ||
| default n |
Copilot
AI
Dec 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR title should follow RT-Thread format with lowercase prefix: [module][subsystem] Description. The current title uses [fix] drivers: spi: format which doesn't match the standard.
Suggested title format: [spi] Refactor SPI bit operations into independent configuration option or [drivers][spi] Refactor SPI bit operations into independent configuration option
PR 标题应遵循 RT-Thread 格式,使用小写前缀:[模块][子系统] 描述。当前标题使用 [fix] drivers: spi: 格式,不符合标准。
建议标题格式:[spi] Refactor SPI bit operations into independent configuration option 或 [drivers][spi] Refactor SPI bit operations into independent configuration option
…iguration - Add RT_USING_SPI_BITOPS as a separate configurable option - Make RT_USING_SOFT_SPI depend on RT_USING_SPI_BITOPS - Adjust build order in SConscript for proper com Signed-off-by: Runcheng Lu <runcheng.lu@hpmicro.com>
8e0c6f3 to
a10ecee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
…iguration
将 SPI 位操作重构为独立配置选项
拉取/合并请求描述:(PR description)
并确认并列出已经在什么情况或板卡上进行了测试。
And confirm in which case or board has been tested. -->
HPM6800EVK
为什么提交这份PR (why to submit this PR)
当用户只需要RT_USING_SPI_BITOPS时,想自己弄一个drv_soft_spi,但是会强加进来dev_soft_spi,导致有两份soft spi。
你的解决方案是什么 (what is your solution)
1、RT_USING_SPI_BITOPS 作为独立可配置选项
2、保留原先配置不动,当使能RT_USING_SOFT_SPI 会使能RT_USING_SPI_BITOPS