Skip to content

feat[stm32][i2c]: Add H7 hard I2C config and I2C4 entries#11252

Merged
Rbb666 merged 1 commit intoRT-Thread:masterfrom
wdfk-prog:pr/02a-stm32-hard-i2c-mode-scaffold-v3
Mar 15, 2026
Merged

feat[stm32][i2c]: Add H7 hard I2C config and I2C4 entries#11252
Rbb666 merged 1 commit intoRT-Thread:masterfrom
wdfk-prog:pr/02a-stm32-hard-i2c-mode-scaffold-v3

Conversation

@wdfk-prog
Copy link
Contributor

@wdfk-prog wdfk-prog commented Mar 14, 2026

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

为 STM32 HAL_Drivers 补全硬件 I2C 配置支持。

当前代码中,H7 系列缺少独立的 i2c_hard_config.h 配置文件,同时 F4 配置中也缺少 I2C4 的硬件 I2C 与 DMA 相关配置项。这会导致部分 BSP 在启用硬件 I2C4 或适配 H7 系列硬件 I2C 时,缺少统一的配置入口,不利于后续 BSP 适配和功能启用。

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

本 PR 做了以下修改:

  1. bsp/stm32/libraries/HAL_Drivers/drivers/config/h7/ 下新增 i2c_hard_config.h

    • 为 STM32H7 系列补充 I2C1 ~ I2C4 的硬件 I2C 总线配置;
    • 补充 I2C1 ~ I2C4 的 TX/RX DMA 配置宏;
    • 与现有 HAL_Drivers 配置风格保持一致,便于 BSP 直接启用和复用。
  2. 更新 bsp/stm32/libraries/HAL_Drivers/drivers/config/f4/i2c_hard_config.h

    • 新增 I2C4_BUS_CONFIG
    • 新增 I2C4_TX_DMA_CONFIGI2C4_RX_DMA_CONFIG
    • 补充对应 change log。
  3. 更新 bsp/stm32/libraries/HAL_Drivers/drivers/drv_config.h

    • 在 STM32H7 配置分支中新增:
      #include "h7/i2c_hard_config.h"
    • 使 H7 平台可正确包含硬件 I2C 配置头文件。

该修改主要是对 STM32 硬件 I2C 配置的补全,不改变已有接口行为,属于功能增强和平台支持完善。

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

  • BSP:

    • 暂未提供实际验证 BSP,建议至少在一个 STM32H7 BSP 和一个使用 I2C4 的 STM32F4 BSP 上完成编译验证。
    • 可参考示例:
      • bsp/stm32/stm32h750-artpi
      • bsp/stm32/stm32f429-st-discovery(如该 BSP 已支持 I2C4,可按实际验证板卡填写)
  • .config:

    • BSP_USING_HARD_I2C4
    • BSP_I2C4_TX_USING_DMA
    • BSP_I2C4_RX_USING_DMA
    • H7 平台按实际验证情况补充:
      • BSP_USING_HARD_I2C1
      • BSP_USING_HARD_I2C2
      • BSP_USING_HARD_I2C3
      • BSP_USING_HARD_I2C4
  • action:

    • 暂未提供 action 链接,请在提交后补充你自己仓库对应 PR branch 的 CI / action 编译通过链接。
  • [components][I2C] 添加I2C配置结构体 #9087

@github-actions
Copy link

👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread!

为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。
To ensure your code complies with RT-Thread's coding style, please run the code formatting workflow by following the steps below (If the formatting of CI fails to run).


🛠 操作步骤 | Steps

  1. 前往 Actions 页面 | Go to the Actions page
    点击进入工作流 → | Click to open workflow →

  2. 点击 Run workflow | Click Run workflow

  • 设置需排除的文件/目录(目录请以"/"结尾)
    Set files/directories to exclude (directories should end with "/")
  • 将目标分支设置为 \ Set the target branch to:pr/02a-stm32-hard-i2c-mode-scaffold-v3
  • 设置PR number为 \ Set the PR number to:11252
  1. 等待工作流完成 | Wait for the workflow to complete
    格式化后的代码将自动推送至你的分支。
    The formatted code will be automatically pushed to your branch.

完成后,提交将自动更新至 pr/02a-stm32-hard-i2c-mode-scaffold-v3 分支,关联的 Pull Request 也会同步更新。
Once completed, commits will be pushed to the pr/02a-stm32-hard-i2c-mode-scaffold-v3 branch automatically, and the related Pull Request will be updated.

如有问题欢迎联系我们,再次感谢您的贡献!💐
If you have any questions, feel free to reach out. Thanks again for your contribution!

@github-actions github-actions bot added BSP: STM32 BSP related with ST/STM32 BSP labels Mar 14, 2026
@github-actions
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/config/f4/i2c_hard_config.h
  • bsp/stm32/libraries/HAL_Drivers/drivers/config/h7/i2c_hard_config.h
  • bsp/stm32/libraries/HAL_Drivers/drivers/drv_config.h

📊 Current Review Status (Last Updated: 2026-03-14 16:17 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 merged commit e10d364 into RT-Thread:master Mar 15, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BSP: STM32 BSP related with ST/STM32 BSP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants