[BSP][NS800RT7P65] Add ADC driver support#11437
Conversation
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
NinoC137
left a comment
There was a problem hiding this comment.
review完adc了 但似乎不小心顺手把隔壁ecap的.config也加进去了,他原本没加
|
可以参考https://club.rt-thread.org/ask/article/d273bbcd1f8779bc.html |
|
另外能不能提供运行的截图,谢谢! |
可以,我抽时间做一下 |
|
发现驱动架构需要改一下,主线的BSP里面还有config头文件,我做一下兼容再PR吧。 |
a0e14e1 to
bd7c6bb
Compare
NinoC137
left a comment
There was a problem hiding this comment.
参考adc_config的格式,以及BSP中drv_spi的config实现思路来重构了一下config部分的实现
可能我没有表述清楚,需要把bsp adc的功能关闭。这边你可以不提交.config和rtconfig.h即可。 |
7867bb5 to
ca12815
Compare
|
已检查核实完毕,并进行了对应的编译与运行测试:adc设备挂载、通道使能与读取测试,未使能通道的读取测试、irq接口的接入与功能测试、PPB oversampling的接入与功能测试 |
|
目前可以作为1.0版本并入 后续可以进一步开发与Kconfig结合的配置操作,将部分配置细节丢给Kconfig的menuconfig |
如果能提供一个运行的截图更好,谢谢! |
There was a problem hiding this comment.
Pull request overview
This PR adds ADC driver support for the NS800RT7P65 BSP, integrating the NS800 ADC hardware into RT-Thread’s rt_adc_device framework, and wires the feature into Kconfig, build scripts, CI attachconfig, and board documentation.
本 PR 为 NS800RT7P65 BSP 增加 ADC 驱动支持,将 NS800 ADC 硬件适配到 RT-Thread 的 rt_adc_device 框架,并补齐 Kconfig、构建脚本、CI attachconfig 与板级文档的配套改动。
Changes / 变更点:
- Add
BSP_USING_ADCKconfig option and CI attachconfig entry for ADC builds. / 新增BSP_USING_ADCKconfig 选项,并在 CI attachconfig 中增加 ADC 构建配置。 - Add new NS800 ADC driver implementation (
drv_adc.c/.h) and include it in the HAL driver build. / 新增 NS800 ADC 驱动实现(drv_adc.c/.h),并接入 HAL Drivers 构建。 - Update board README peripheral support list to include ADC0. / 更新板级 README 外设支持列表,标注 ADC0 支持。
Review notes / 审查要点:
- English: There are blocking code issues found in the new ADC driver (tracked via PR comments) that should be fixed before merge.
中文:新增 ADC 驱动中存在阻塞性问题(已通过 PR 行内评论给出),建议修复后再合入。 - English: PR title prefix appears not to follow the repository’s required lowercase
[module][subsystem]-style prefix.
中文:PR 标题前缀看起来不符合仓库要求的小写[模块][子系统]格式。 - English: PR description still contains the template bracket block and lacks the action link; repository workflow may require completing these fields.
中文:PR 描述仍保留模板方括号块且缺少 action 链接,可能不符合仓库合入要求。
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| bsp/novosns/ns800/ns800rt7p65-nssinepad/README_zh.md | Advertises ADC0 as supported on the board. |
| bsp/novosns/ns800/ns800rt7p65-nssinepad/board/Kconfig | Adds BSP_USING_ADC option and selects RT_USING_ADC. |
| bsp/novosns/ns800/ns800rt7p65-nssinepad/.ci/attachconfig/ci.attachconfig.yml | Adds CI attachconfig build variant enabling ADC. |
| bsp/novosns/ns800/libraries/HAL_Drivers/drivers/SConscript | Builds drv_adc.c when BSP_USING_ADC is enabled. |
| bsp/novosns/ns800/libraries/HAL_Drivers/drivers/drv_adc.h | Introduces NS800 ADC driver public definitions and control commands. |
| bsp/novosns/ns800/libraries/HAL_Drivers/drivers/drv_adc.c | Implements ADC init, polling conversion, PPB oversampling, and IRQ callback support. |
| #ifdef __ADC_H__ | ||
| #undef __ADC_H__ | ||
| #endif | ||
| #include "adc.h" | ||
| #ifdef __ADC_H__ | ||
| #undef __ADC_H__ | ||
| #endif |
There was a problem hiding this comment.
已修复,去除了.c文件中的重复include,没有改动头文件。这里的__ADC_H__是rt主线与厂商SDK的头文件声明冲突,之前在群里反馈过一次
| adc->mode = NS800_ADC_MODE_IRQ; | ||
| return ns800_adc_irq_attach(NS800_ADC_INT1, | ||
| adc->active_channel, | ||
| adc_irq_entries[NS800_ADC_INT1].callback, | ||
| adc_irq_entries[NS800_ADC_INT1].user_data); |
ca12815 to
57aa0ba
Compare



拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
为NS800RT7P65进行了ADC及其附属外设(ADC中断、PPB模块)的开发,实现BSP驱动
你的解决方案是什么 (what is your solution)
利用rt-adc设备框架进行适配
请提供验证的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