NXP MCU 技术william hill官网
直播中

王健

7年用户 919经验值
私信 关注
[问答]

esp-matter如何为按钮配置GPIO?

我只是在尝试 esp-matter 的按钮示例。我想检查连接了哪个 PIN,但不幸的是我无法从源代码中弄清楚。下面提到的 app_driver_switch_init() 函数应该初始化按钮,将通过调用 button_driver_get_config() 拉入配置,但这个函数无处可寻。我只在链接器脚本中找到了一些引用,它似乎是静态链接的。

代码:全选
app_driver_handle_t app_driver_switch_init()
{
    /* Initialize button */
    button_config_t config = button_driver_get_config();
    button_handle_t handle = iot_button_create(&config);
    iot_button_register_cb(handle, BUTTON_PRESS_DOWN, app_driver_button_toggle_cb, NULL);

    /* Other initializations */
#if CONFIG_ENABLE_CHIP_SHELL
    app_driver_register_commands();
#endif // CONFIG_ENABLE_CHIP_SHELL
    client::set_command_callback(app_driver_client_command_callback, app_driver_client_group_command_callback, NULL);

    return (app_driver_handle_t)handle;
}

代码:全选
button_driver_get_config                          esp-idf/device/libdevice.a(device.c.obj)
                                                  esp-idf/main/libmain.a(app_driver.cpp.obj)


--> 链接到 libdevice.a


代码:全选
.literal.button_driver_get_config
                0x00000000400d0804        0x0 esp-idf/device/libdevice.a(device.c.obj)
                                          0x4 (size before relaxing)


--> 是这个值吗?


更多回帖

发帖
×
20
完善资料,
赚取积分