Skip to content
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

drivers: merge the software i2c driver #9886

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

kurisaW
Copy link
Contributor

@kurisaW kurisaW commented Jan 8, 2025

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

[

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

Ps:主线已经将软件i2c驱动合并到drivers中,因此各大bsp下的软件i2c驱动没有存在的必要,删除进一步减少代码体量

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

Ps:目前主线的软件i2c驱动已经合并到drivers中,用户可以通过env配置软件i2c,同时删除各bsp中的软件i2c驱动,这个pr作为一个模板,后续等夏令营同学把其他bsp的软件i2c驱动删除

image

另外对于有些bsp中可能依赖已经配置好的软件i2c设备,比如说HMI-Board的Arduino配置使能,并且对于不同的厂商pin驱动的取值可能有所不同(比如瑞萨pin引脚类型获取为hex,ST引脚类型为int),可以参考如下方法保留并重写配置信息,并且仅当用户主动使能RT_USING_I2C,对应的配置项才会显示;同样当用户使能之前存在对软件i2c设备依赖的项目时也需要自动选中:

        config RT_USING_I2C
        bool 
        default n
        if RT_USING_I2C
            config RT_USING_SOFT_I2C
            bool "Enable soft I2C BUS"
            default n
            if RT_USING_SOFT_I2C
                menuconfig RT_USING_SOFT_I2C0
                    bool "Enable I2C0 Bus (software simulation)"
                    default n
                    if RT_USING_SOFT_I2C0
                        comment "Please refer to the 'bsp_io.h' file to configure the pins"
                        config RT_SOFT_I2C0_SCL_PIN
                            hex "i2c0 scl pin number (hex)"
                            range 0x0000 0xFFFF
                            default 0x202
                        config RT_SOFT_I2C0_SDA_PIN
                            hex "i2c0 sda pin number (hex)"
                            range 0x0000 0xFFFF
                            default 0x203
                        config RT_SOFT_I2C0_BUS_NAME
                            string "Bus name"
                            default "i2c0"
                        config RT_SOFT_I2C0_TIMING_DELAY
                            int "Timing delay (us)"
                            range 0 32767
                            default 10
                        config RT_SOFT_I2C0_TIMING_TIMEOUT
                            int "Timing timeout (tick)"
                            range 0 32767
                            default 10
                    endif
            endif
        endif

请提供验证的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/workflows/bsp_buildings.yml 详细请参考链接BSP自查

@kurisaW kurisaW requested a review from Rbb666 as a code owner January 8, 2025 09:05
@kurisaW kurisaW changed the title [drivers] merge the software i2c driver drivers: merge the software i2c driver Jan 8, 2025
@supperthomas
Copy link
Member

最好加个ci.attachconfig.yml 文件,参考链接:
https://club.rt-thread.org/ask/article/5c41835bb8ff9b41.html

@mysterywolf
Copy link
Member

请按照涛哥的建议把attachmentyml加上

@kurisaW
Copy link
Contributor Author

kurisaW commented Jan 9, 2025

已添加attachmentyml,然后目前瑞萨系列的bsp都是默认保持最小体量代码,只保留uart以及pin驱动的底层驱动库,所以其他的暂时没加上去,如果要将其他外设都加入该检查,需要在bsp中生成对应的驱动库

@mysterywolf mysterywolf merged commit 1b76ecc into RT-Thread:master Jan 9, 2025
46 checks passed
@kurisaW kurisaW deleted the drivers-fix branch January 9, 2025 03:55
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.

3 participants