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

sensor框架软件包 Kconfig 配置模板 #1773

Open
kurisaW opened this issue Sep 6, 2024 · 1 comment
Open

sensor框架软件包 Kconfig 配置模板 #1773

kurisaW opened this issue Sep 6, 2024 · 1 comment

Comments

@kurisaW
Copy link
Contributor

kurisaW commented Sep 6, 2024

如果是sensor_v2版本,仿照如下修改

    config PKG_PACKAGES_NAME_USING_SENSOR_V2
        bool "Enable sensor_v2 divce framework"
        depends on RT_VER_NUM >= 0x50001
        select RT_USING_SENSOR
        select RT_USING_SENSOR_V2
        default n

如果是sensor_v1版本,仿照如下修改

    config PKG_PACKAGES_NAME_USING_SENSOR_V1
        bool "Enable sensor_v1 divce framework"
        select RT_USING_SENSOR
        default n

在packages索引仓库修改完成后,需要同步在具体的软件包仓库中的sconscript文件中修改如下内容

if GetDepend('PKG_PACKAGES_NAME_USING_SENSOR_V2'):
    src += ['sensor_packages.c']

或者:

if GetDepend('PKG_PACKAGES_NAME_USING_SENSOR_V1'):
    src += ['sensor_packages.c']

ps:这里的sensor_packages.c文件是已经适配了sensor框架的驱动文件

示范说明:比如说AP3216C使用的是SENSOR_V2:

那么在packages仓库中AP3216目录下修改Kconfig:

    config PKG_AP3216C_USING_SENSOR_V2
        bool "Enable sensor_v2 divce framework"
        depends on RT_VER_NUM >= 0x50001
        select RT_USING_SENSOR
        select RT_USING_SENSOR_V2
        default n

同时在AP3216C软件包仓库修改sconscript文件:

if GetDepend('PKG_AP3216C_USING_SENSOR_V2'):
    src += ['sensor_lsc_ap3216c.c']

可参考该PR:

@kurisaW kurisaW changed the title sensor框架软件包配置模板 sensor框架软件包 Kconfig 配置模板 Sep 11, 2024
@kurisaW
Copy link
Contributor Author

kurisaW commented Nov 9, 2024

此外如果该软件包提供了除基础驱动文件之外,还提供了sensor驱动的示例文件,需要做如下修改:

1.在该软件包仓库,比如说PACKAGES_NAME软件包下的sconscript文件中新增一个宏:PKG_USING_PACKAGES_NAME_SENSOR_SAMPLE

if GetDepend('PKG_USING_PACKAGES_NAME_SENSOR_SAMPLE'):
    src += ['xxx_sensor_sample.c']

ps:xxx_sensor_sample.c为sensor驱动的示例文件

2.修改packages仓库下,对应的软件包索引,找到属于该软件包的Kconfig,修改如下:

    config PKG_PACKAGES_NAME_USING_SENSOR_V1
        bool "Enable sensor_v1 divce framework"
        select RT_USING_SENSOR
        default n
        if PKG_PACKAGES_NAME_USING_SENSOR_V1
           config PKG_USING_PACKAGES_NAME_SENSOR_SAMPLE
               bool "Enable sensor_v1 sample for xxx packages"
               default n
        endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant