|
| 1 | +/* |
| 2 | + * |
| 3 | + * Copyright (c) 2024 Project CHIP Authors |
| 4 | + * |
| 5 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | + * you may not use this file except in compliance with the License. |
| 7 | + * You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | + |
| 18 | +#pragma once |
| 19 | + |
| 20 | +#include <app/icd/server/ICDServerConfig.h> |
| 21 | + |
| 22 | +#ifdef __cplusplus |
| 23 | +extern "C" { |
| 24 | +#endif |
| 25 | +#if CHIP_CONFIG_ENABLE_ICD_SERVER |
| 26 | +#if SLI_SI91X_MCU_INTERFACE |
| 27 | +#include "sl_si91x_button.h" |
| 28 | +#include "sl_si91x_button_pin_config.h" |
| 29 | +#include "sl_si91x_driver_gpio.h" |
| 30 | +/** |
| 31 | + * @brief invoked when button press event is received when in sleep |
| 32 | + * @param[in] pin_intr GPIO pin interrupt number. |
| 33 | + * @return none. |
| 34 | + * @note this is a callback from the Wiseconnect SDK |
| 35 | + */ |
| 36 | +void gpio_uulp_pin_interrupt_callback(uint32_t pin_intr); |
| 37 | +#endif // SLI_SI91X_MCU_INTERFACE |
| 38 | +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER |
| 39 | +#ifdef __cplusplus |
| 40 | +} |
| 41 | +#endif |
| 42 | + |
| 43 | +namespace chip { |
| 44 | +namespace DeviceLayer { |
| 45 | +namespace Silabs { |
| 46 | +namespace SiWxPlatformInterface { |
| 47 | + |
| 48 | +#if CHIP_CONFIG_ENABLE_ICD_SERVER |
| 49 | +#if SLI_SI91X_MCU_INTERFACE |
| 50 | +/** |
| 51 | + * @brief Required to invoke button press event during sleep as falling edge is not detected |
| 52 | + * @param[in] none. |
| 53 | + * @note flow is GPIO wakeup due to BTN0 press -> check button state in idle task required as the GPIO interrupt is not |
| 54 | + * detected during sleep for BUTTON RELEASED |
| 55 | + */ |
| 56 | +inline void sl_si91x_btn_event_handler() |
| 57 | +{ |
| 58 | + sl_button_on_change(SL_BUTTON_BTN0_NUMBER, |
| 59 | + (sl_si91x_gpio_get_uulp_npss_pin(SL_BUTTON_BTN0_PIN) == LOW) ? BUTTON_PRESSED : BUTTON_RELEASED); |
| 60 | +} |
| 61 | + |
| 62 | +/** |
| 63 | + * @brief Required to enable MATTER shell UART with ICD feature flag |
| 64 | + * @param[in] none. |
| 65 | + * @note this requires hardware jumping of the GPIO PINs to work with the baseboard. |
| 66 | + */ |
| 67 | +void sl_si91x_uart_power_requirement_handler(); |
| 68 | +#endif // SLI_SI91X_MCU_INTERFACE |
| 69 | +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER |
| 70 | +} // namespace SiWxPlatformInterface |
| 71 | +} // namespace Silabs |
| 72 | +} // namespace DeviceLayer |
| 73 | +} // namespace chip |
0 commit comments