C
Qt Quick Ultralite interrupt_handler Example
/****************************************************************************** ** ** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Quick Ultralite module. ** ** $QT_BEGIN_LICENSE:COMM$ ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** $QT_END_LICENSE$ ** ******************************************************************************/ // Note: the following headers are written in C, they must be included in .c file to avoid compile errors #include "board.h" #include "fsl_gpio.h" #include "fsl_common.h" #ifdef NXP_FREERTOS #include "FreeRTOSConfig.h" #endif void userButtonCallback(void); void nxpConfig(void) { const gpio_pin_config_t sw_config = { kGPIO_DigitalInput, 0, kGPIO_IntRisingEdge, }; const status_t status = EnableIRQ(BOARD_USER_BUTTON_IRQ); if (status != kStatus_Fail) { GPIO_PinInit(BOARD_USER_BUTTON_GPIO, BOARD_USER_BUTTON_GPIO_PIN, &sw_config); GPIO_PortEnableInterrupts(BOARD_USER_BUTTON_GPIO, 1U << BOARD_USER_BUTTON_GPIO_PIN); } #ifdef NXP_FREERTOS NVIC_SetPriority(BOARD_USER_BUTTON_IRQ, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY); #endif } void BOARD_USER_BUTTON_IRQ_HANDLER(void) { GPIO_PortClearInterruptFlags(BOARD_USER_BUTTON_GPIO, 1U << BOARD_USER_BUTTON_GPIO_PIN); userButtonCallback(); }