Skip to content

Commit

Permalink
Restyled by clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits authored and chirag-silabs committed Mar 7, 2023
1 parent d35ecfd commit 6786158
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 51 deletions.
128 changes: 83 additions & 45 deletions examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_ioports.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,25 @@ void rsi_hal_config_gpio(uint8_t gpio_number, uint8_t mode, uint8_t value)

CMU_ClockEnable(cmuClock_GPIO, true);

switch(gpio_number)
{
case RSI_HAL_SLEEP_CONFIRM_PIN: GPIO_PinModeSet(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin, gpioModeWiredOrPullDown, 1); break;
switch (gpio_number)
{
case RSI_HAL_SLEEP_CONFIRM_PIN:
GPIO_PinModeSet(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin, gpioModeWiredOrPullDown, 1);
break;
#ifndef LOGGING_STATS
case RSI_HAL_WAKEUP_INDICATION_PIN: GPIO_PinModeSet(WAKE_INDICATOR_PIN.port, WAKE_INDICATOR_PIN.pin, gpioModeWiredOrPullDown, 0); break;
case RSI_HAL_WAKEUP_INDICATION_PIN:
GPIO_PinModeSet(WAKE_INDICATOR_PIN.port, WAKE_INDICATOR_PIN.pin, gpioModeWiredOrPullDown, 0);
break;
#endif
case RSI_HAL_RESET_PIN: GPIO_PinModeSet(WFX_RESET_PIN.port, WFX_RESET_PIN.pin, gpioModePushPull, 1); break;
case RSI_HAL_LP_SLEEP_CONFIRM_PIN: GPIO_PinModeSet(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin, gpioModeWiredOrPullDown, 1);break;
default: break;
}
case RSI_HAL_RESET_PIN:
GPIO_PinModeSet(WFX_RESET_PIN.port, WFX_RESET_PIN.pin, gpioModePushPull, 1);
break;
case RSI_HAL_LP_SLEEP_CONFIRM_PIN:
GPIO_PinModeSet(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin, gpioModeWiredOrPullDown, 1);
break;
default:
break;
}
}

/*===========================================================*/
Expand All @@ -82,19 +91,31 @@ void rsi_hal_config_gpio(uint8_t gpio_number, uint8_t mode, uint8_t value)
* @return none
* @description This API is used to drives or makes the host gpio value high.
*/
void rsi_hal_set_gpio(uint8_t gpio_number) {
switch(gpio_number)
{
case RSI_HAL_SLEEP_CONFIRM_PIN: GPIO_PinModeSet(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin, gpioModeWiredOrPullDown, 1); break;
void rsi_hal_set_gpio(uint8_t gpio_number)
{
switch (gpio_number)
{
case RSI_HAL_SLEEP_CONFIRM_PIN:
GPIO_PinModeSet(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin, gpioModeWiredOrPullDown, 1);
break;
#ifndef LOGGING_STATS
case RSI_HAL_WAKEUP_INDICATION_PIN: GPIO_PinModeSet(WAKE_INDICATOR_PIN.port, WAKE_INDICATOR_PIN.pin, gpioModeInput, 1); break;
case RSI_HAL_WAKEUP_INDICATION_PIN:
GPIO_PinModeSet(WAKE_INDICATOR_PIN.port, WAKE_INDICATOR_PIN.pin, gpioModeInput, 1);
break;
#else
case RSI_HAL_WAKEUP_INDICATION_PIN: GPIO_PinModeSet(LOGGING_WAKE_INDICATOR_PIN.port, LOGGING_WAKE_INDICATOR_PIN.pin, gpioModeInput, 1); break;
case RSI_HAL_WAKEUP_INDICATION_PIN:
GPIO_PinModeSet(LOGGING_WAKE_INDICATOR_PIN.port, LOGGING_WAKE_INDICATOR_PIN.pin, gpioModeInput, 1);
break;
#endif
case RSI_HAL_RESET_PIN: GPIO_PinModeSet(WFX_RESET_PIN.port, WFX_RESET_PIN.pin, gpioModeWiredOrPullDown, 1); break;
case RSI_HAL_LP_SLEEP_CONFIRM_PIN: GPIO_PinModeSet(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin, gpioModeWiredOrPullDown, 1);break;
default: break;
}
case RSI_HAL_RESET_PIN:
GPIO_PinModeSet(WFX_RESET_PIN.port, WFX_RESET_PIN.pin, gpioModeWiredOrPullDown, 1);
break;
case RSI_HAL_LP_SLEEP_CONFIRM_PIN:
GPIO_PinModeSet(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin, gpioModeWiredOrPullDown, 1);
break;
default:
break;
}
}
/*===========================================================*/
/**
Expand All @@ -105,21 +126,29 @@ void rsi_hal_set_gpio(uint8_t gpio_number) {
* @return gpio pin value
* @description This API is used to configure get the gpio pin value.
*/
uint8_t rsi_hal_get_gpio(uint8_t gpio_number) {
switch(gpio_number)
{
case RSI_HAL_SLEEP_CONFIRM_PIN: return GPIO_PinInGet(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin);
uint8_t rsi_hal_get_gpio(uint8_t gpio_number)
{
switch (gpio_number)
{
case RSI_HAL_SLEEP_CONFIRM_PIN:
return GPIO_PinInGet(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin);
#ifndef LOGGING_STATS
case RSI_HAL_WAKEUP_INDICATION_PIN: return GPIO_PinInGet(WAKE_INDICATOR_PIN.port, WAKE_INDICATOR_PIN.pin);
case RSI_HAL_WAKEUP_INDICATION_PIN:
return GPIO_PinInGet(WAKE_INDICATOR_PIN.port, WAKE_INDICATOR_PIN.pin);
#else
case RSI_HAL_WAKEUP_INDICATION_PIN: return GPIO_PinInGet(LOGGING_WAKE_INDICATOR_PIN.port, LOGGING_WAKE_INDICATOR_PIN.pin);
case RSI_HAL_WAKEUP_INDICATION_PIN:
return GPIO_PinInGet(LOGGING_WAKE_INDICATOR_PIN.port, LOGGING_WAKE_INDICATOR_PIN.pin);
#endif
case RSI_HAL_RESET_PIN: return GPIO_PinInGet(WFX_RESET_PIN.port, WFX_RESET_PIN.pin);
case RSI_HAL_MODULE_INTERRUPT_PIN: return GPIO_PinInGet(WFX_INTERRUPT_PIN.port, WFX_INTERRUPT_PIN.pin);
case RSI_HAL_LP_SLEEP_CONFIRM_PIN: return GPIO_PinInGet(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin);
default: break;
}
return 0;
case RSI_HAL_RESET_PIN:
return GPIO_PinInGet(WFX_RESET_PIN.port, WFX_RESET_PIN.pin);
case RSI_HAL_MODULE_INTERRUPT_PIN:
return GPIO_PinInGet(WFX_INTERRUPT_PIN.port, WFX_INTERRUPT_PIN.pin);
case RSI_HAL_LP_SLEEP_CONFIRM_PIN:
return GPIO_PinInGet(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin);
default:
break;
}
return 0;
}
/*===========================================================*/
/**
Expand All @@ -130,25 +159,34 @@ uint8_t rsi_hal_get_gpio(uint8_t gpio_number) {
* @return none
* @description This API is used to drives or makes the host gpio value low.
*/
void rsi_hal_clear_gpio(uint8_t gpio_number) {
switch(gpio_number)
{
void rsi_hal_clear_gpio(uint8_t gpio_number)
{
switch (gpio_number)
{
case RSI_HAL_SLEEP_CONFIRM_PIN:
GPIO_PinOutClear(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin); break;
GPIO_PinOutClear(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin);
break;
#ifndef LOGGING_STATS
//fall through
// fall through
case RSI_HAL_WAKEUP_INDICATION_PIN:
GPIO_PinOutClear(WAKE_INDICATOR_PIN.port, WAKE_INDICATOR_PIN.pin); break;
GPIO_PinOutClear(WAKE_INDICATOR_PIN.port, WAKE_INDICATOR_PIN.pin);
break;
#else
//fall through
// fall through
case RSI_HAL_WAKEUP_INDICATION_PIN:
GPIO_PinOutClear(LOGGING_WAKE_INDICATOR_PIN.port, LOGGING_WAKE_INDICATOR_PIN.pin); break;
GPIO_PinOutClear(LOGGING_WAKE_INDICATOR_PIN.port, LOGGING_WAKE_INDICATOR_PIN.pin);
break;
#endif
//fall through
case RSI_HAL_RESET_PIN: GPIO_PinOutClear(WFX_RESET_PIN.port, WFX_RESET_PIN.pin); break;
//fall through
case RSI_HAL_LP_SLEEP_CONFIRM_PIN: GPIO_PinOutClear(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin); break;
//fall through
default: break;
}
// fall through
case RSI_HAL_RESET_PIN:
GPIO_PinOutClear(WFX_RESET_PIN.port, WFX_RESET_PIN.pin);
break;
// fall through
case RSI_HAL_LP_SLEEP_CONFIRM_PIN:
GPIO_PinOutClear(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin);
break;
// fall through
default:
break;
}
}
6 changes: 4 additions & 2 deletions examples/platform/silabs/efr32/rs911x/rsi_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,8 @@ void wfx_rsi_task(void * arg)
#if CHIP_DEVICE_CONFIG_ENABLE_SED
// enabling the power save mode for RS9116 if sleepy device is enabled
rsi_status = rsi_wlan_power_save_profile(RSI_SLEEP_MODE_2, RSI_MAX_PSP);
if (status != RSI_SUCCESS) {
if (status != RSI_SUCCESS)
{
WFX_RSI_LOG("Powersave Config Failed, Error Code : 0x%lX", status);
return status;
}
Expand Down Expand Up @@ -685,7 +686,8 @@ void wfx_rsi_task(void * arg)
#if CHIP_DEVICE_CONFIG_ENABLE_SED
// enabling the power save mode for RS9116 if sleepy device is enabled
rsi_status = rsi_wlan_power_save_profile(RSI_SLEEP_MODE_2, RSI_MAX_PSP);
if (rsi_status != RSI_SUCCESS) {
if (rsi_status != RSI_SUCCESS)
{
WFX_RSI_LOG("Powersave Config Failed, Error Code : 0x%lX", rsi_status);
}
WFX_RSI_LOG("Powersave Config Success");
Expand Down
6 changes: 2 additions & 4 deletions src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,8 @@ void ConnectivityManagerImpl::_OnWiFiStationProvisionChange()
CHIP_ERROR ConnectivityManagerImpl::_GetSEDIntervalsConfig(ConnectivityManager::SEDIntervalsConfig & SEDIntervalsConfig)
{
// For now Wi-Fi uses DTIM power save mode
SEDIntervalsConfig.ActiveIntervalMS =
chip::System::Clock::Milliseconds32(50);
SEDIntervalsConfig.IdleIntervalMS =
chip::System::Clock::Milliseconds32(300);
SEDIntervalsConfig.ActiveIntervalMS = chip::System::Clock::Milliseconds32(50);
SEDIntervalsConfig.IdleIntervalMS = chip::System::Clock::Milliseconds32(300);
return CHIP_NO_ERROR;
}

Expand Down

0 comments on commit 6786158

Please sign in to comment.