Skip to content

Commit

Permalink
Adds changes to optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
rosahay-silabs committed Oct 24, 2024
1 parent 4ae4cce commit 973467f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ sl_status_t join_callback_handler(sl_wifi_event_t event, char * result, uint32_t

#if CHIP_CONFIG_ENABLE_ICD_SERVER
#if SLI_SI91X_MCU_INTERFACE
void chip::DeviceLayer::Silabs::SiWxPlatformInterface::gpio_uulp_pin_interrupt_callback(uint32_t pin_intr)
void gpio_uulp_pin_interrupt_callback(uint32_t pin_intr)
{
// UULP_GPIO_2 is used to detect the button 0 press
VerifyOrReturn(pin_intr == RTE_UULP_GPIO_2_PIN, ChipLogError(DeviceLayer, "invalid pin interrupt: %ld", pin_intr));
Expand Down
17 changes: 9 additions & 8 deletions examples/platform/silabs/SiWx917/SiWxPlatformInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@
#include <sl_si91x_button.h>
#include <sl_si91x_button_pin_config.h>
#include <sl_si91x_driver_gpio.h>
extern "C" {
/**
* @brief invoked when button press event is received when in sleep
* @param[in] pin_intr GPIO pin interrupt number.
* @return none.
* @note this is a callback from the Wiseconnect SDK
*/
void gpio_uulp_pin_interrupt_callback(uint32_t pin_intr);
}
#endif // SLI_SI91X_MCU_INTERFACE
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER

Expand Down Expand Up @@ -54,14 +63,6 @@ inline void sl_si91x_btn_event_handler()
* @note this requires hardware jumping of the GPIO PINs to work with the baseboard.
*/
void sl_si91x_uart_power_requirement_handler();

/**
* @brief invoked when button press event is received when in sleep
* @param[in] pin_intr GPIO pin interrupt number.
* @return none.
* @note this is a callback from the Wiseconnect SDK
*/
void gpio_uulp_pin_interrupt_callback(uint32_t pin_intr);
#endif // SLI_SI91X_MCU_INTERFACE
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER
} // namespace SiWxPlatformInterface
Expand Down
4 changes: 2 additions & 2 deletions src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ void sl_button_on_change(uint8_t btn, uint8_t btnAction)
if (btn == SL_BUTTON_BTN0_NUMBER)
{
// if the btn was not pressed and only a release event came, ignore it
VerifyOrReturn((btnAction == BUTTON_RELEASED) && (btn0_pressed == false));
// if the btn was already pressed and another press event came, ignore it
VerifyOrReturn((btnAction == BUTTON_PRESSED) && (btn0_pressed == true));
VerifyOrReturn(btnAction ^ btn0_pressed);

if ((btnAction == BUTTON_PRESSED) && (btn0_pressed == false))
{
btn0_pressed = true;
Expand Down

0 comments on commit 973467f

Please sign in to comment.