C

Qt Quick Ultralite interrupt_handler Example

// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
#include "board_config.h"
#include "interrupt_queue.h"

#include <bsp/esp-bsp.h>

static button_handle_t g_btn_handle[BSP_BUTTON_NUM];

extern "C" void mute_btn_handler(void *handle, void *arg)
{
    HWButtonInput::instance().postEventFromInterrupt(0);
}

void ConfigureBoard()
{
    ESP_ERROR_CHECK(bsp_iot_button_create(g_btn_handle, 0, BSP_BUTTON_NUM));
    ESP_ERROR_CHECK(
        iot_button_register_cb(g_btn_handle[BSP_BUTTON_MUTE], BUTTON_PRESS_DOWN, NULL, mute_btn_handler, NULL));
    ESP_ERROR_CHECK(
        iot_button_register_cb(g_btn_handle[BSP_BUTTON_MUTE], BUTTON_PRESS_UP, NULL, mute_btn_handler, NULL));
}