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

[SL-UP]Fix SoC build if disable button and led components #155

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/platform/silabs/MatterConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,9 @@ CHIP_ERROR SilabsMatterConfig::InitWiFi(void)
extern "C" void vApplicationIdleHook(void)
{
#if (SLI_SI91X_MCU_INTERFACE && CHIP_CONFIG_ENABLE_ICD_SERVER)
#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT
SiWxPlatformInterface::sl_si91x_btn_event_handler();
#endif //SL_CATALOG_SIMPLE_BUTTON_PRESENT
SiWxPlatformInterface::sl_si91x_uart_power_requirement_handler();
#endif
}
5 changes: 4 additions & 1 deletion src/platform/silabs/SiWx917/SiWxPlatformInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ extern "C" {
#endif
#if CHIP_CONFIG_ENABLE_ICD_SERVER
#if SLI_SI91X_MCU_INTERFACE
#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT
#include "sl_si91x_button.h"
#include "sl_si91x_button_pin_config.h"
#endif //SL_CATALOG_SIMPLE_BUTTON_PRESENT
#include "sl_si91x_driver_gpio.h"
#include "sl_si91x_power_manager.h"

Expand Down Expand Up @@ -70,6 +72,7 @@ namespace SiWxPlatformInterface {

#if CHIP_CONFIG_ENABLE_ICD_SERVER
#if SLI_SI91X_MCU_INTERFACE
#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT
/**
* @brief Required to invoke button press event during sleep as falling edge is not detected
* @param[in] none.
Expand All @@ -81,7 +84,7 @@ inline void sl_si91x_btn_event_handler()
sl_button_on_change(SL_BUTTON_BTN0_NUMBER,
(sl_si91x_gpio_get_uulp_npss_pin(SL_BUTTON_BTN0_PIN) == LOW) ? BUTTON_PRESSED : BUTTON_RELEASED);
}

#endif //SL_CATALOG_SIMPLE_BUTTON_PRESENT
/**
* @brief Required to enable MATTER shell UART with ICD feature flag
* @param[in] none.
Expand Down
38 changes: 25 additions & 13 deletions src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/

#include <platform/silabs/platformAbstraction/SilabsPlatform.h>
#include <sl_si91x_button_pin_config.h>
#include <sl_si91x_common_flash_intf.h>

#include <FreeRTOS.h>
Expand All @@ -36,17 +35,11 @@ extern "C" {
#include "em_core.h"
#include "rsi_board.h"
#include "sl_event_handler.h"

#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT
#include "sl_si91x_button.h"
#include "sl_si91x_button_pin_config.h"
#if defined(SL_MATTER_RGB_LED_ENABLED) && SL_MATTER_RGB_LED_ENABLED
#include "sl_si91x_rgb_led.h"
#include "sl_si91x_rgb_led_config.h"
#include "sl_si91x_rgb_led_instances.h"
#else
#include "sl_si91x_led.h"
#include "sl_si91x_led_config.h"
#include "sl_si91x_led_instances.h"
#endif // defined(SL_MATTER_RGB_LED_ENABLED) && SL_MATTER_RGB_LED_ENABLED
#endif //SL_CATALOG_SIMPLE_BUTTON_PRESENT

#if CHIP_CONFIG_ENABLE_ICD_SERVER == 0
void soc_pll_config(void);
Expand All @@ -61,20 +54,32 @@ void soc_pll_config(void);
#include "uart.h"
#endif

#ifdef ENABLE_WSTK_LEDS
bhmanda-silabs marked this conversation as resolved.
Show resolved Hide resolved
#if defined(SL_MATTER_RGB_LED_ENABLED) && SL_MATTER_RGB_LED_ENABLED
#include "sl_si91x_rgb_led.h"
#include "sl_si91x_rgb_led_config.h"
#include "sl_si91x_rgb_led_instances.h"
#define SL_LED_COUNT SL_SI91X_RGB_LED_COUNT
const sl_rgb_led_t * ledPinArray[SL_LED_COUNT] = { &led_led0 };
const sl_rgb_led_t *ledPinArray[SL_LED_COUNT] = { &led_led0 };
#define SL_RGB_LED_INSTANCE(n) (ledPinArray[n])
#else
#define SL_LED_COUNT SL_SI91x_LED_COUNT
#include "sl_si91x_led.h"
#include "sl_si91x_led_config.h"
#include "sl_si91x_led_instances.h"
#define SL_LED_COUNT SL_SI91X_LED_COUNT
uint8_t ledPinArray[SL_LED_COUNT] = { SL_LED_LED0_PIN, SL_LED_LED1_PIN };
#endif // defined(SL_MATTER_RGB_LED_ENABLED) && SL_MATTER_RGB_LED_ENABLED
#endif // SL_MATTER_RGB_LED_ENABLED
#endif // ENABLE_WSTK_LEDS

namespace chip {
namespace DeviceLayer {
namespace Silabs {
namespace {

#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT
uint8_t sButtonStates[SL_SI91x_BUTTON_COUNT] = { 0 };
#endif //SL_CATALOG_SIMPLE_BUTTON_PRESENT

#if CHIP_CONFIG_ENABLE_ICD_SERVER
bool btn0_pressed = false;
#endif /* SL_ICD_ENABLED */
Expand Down Expand Up @@ -152,6 +157,7 @@ void SilabsPlatform::StartScheduler()
vTaskStartScheduler();
}

#ifdef SL_CATALOG_SIMPLE_BUTTON_PRESENT
extern "C" void sl_button_on_change(uint8_t btn, uint8_t btnAction)
{
#if SL_ICD_ENABLED
Expand Down Expand Up @@ -191,6 +197,12 @@ uint8_t SilabsPlatform::GetButtonState(uint8_t button)
{
return (button < SL_SI91x_BUTTON_COUNT) ? sButtonStates[button] : 0;
}
#else
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be merged into one line.

uint8_t SilabsPlatform::GetButtonState(uint8_t button)
{
return 0;
}
#endif // SL_CATALOG_SIMPLE_BUTTON_PRESENT

CHIP_ERROR SilabsPlatform::FlashInit()
{
Expand Down
Loading