Skip to content

Commit

Permalink
[EFR32] window app implementation for wifi (#22451)
Browse files Browse the repository at this point in the history
* [EFR32] window app implementation for wifi

* removed log message from common file

* [EFR32] added comment
  • Loading branch information
ShubhamMalasane authored Sep 8, 2022
1 parent 660786b commit 0e3bbae
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
4 changes: 4 additions & 0 deletions examples/window-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ declare_args() {
# PIN code for PASE session establishment.
setupPinCode = 20202021

#default Discriminator value
setupDiscriminator = 3840

# Monitor & log memory usage at runtime.
enable_heap_monitoring = false

Expand Down Expand Up @@ -128,6 +131,7 @@ efr32_sdk("sdk") {
defines = [
"BOARD_ID=${efr32_board}",
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}",
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setupDiscriminator}",
"OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}",
]

Expand Down
4 changes: 3 additions & 1 deletion examples/window-app/efr32/include/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021
#endif
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00

#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00
#endif
// For convenience, Chip Security Test Mode can be enabled and the
// requirement for authentication in various protocols can be disabled.
//
Expand Down
33 changes: 21 additions & 12 deletions examples/window-app/efr32/src/WindowAppImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

#ifdef SL_WIFI
#include "wfx_host_events.h"
#include <app/clusters/network-commissioning/network-commissioning.h>
#include <platform/EFR32/NetworkCommissioningWiFiDriver.h>
#endif

#ifdef DISPLAY_ENABLED
Expand All @@ -51,6 +53,10 @@ using namespace chip::app::Clusters::WindowCovering;
#define APP_STATE_LED &sl_led_led0
#define APP_ACTION_LED &sl_led_led1

#ifdef SL_WIFI
chip::app::Clusters::NetworkCommissioning::Instance
sWiFiNetworkCommissioningInstance(0 /* Endpoint Id */, &(chip::DeviceLayer::NetworkCommissioning::SlWiFiDriver::GetInstance()));
#endif
//------------------------------------------------------------------------------
// Timers
//------------------------------------------------------------------------------
Expand Down Expand Up @@ -145,6 +151,21 @@ WindowAppImpl::WindowAppImpl() {}

void WindowAppImpl::OnTaskCallback(void * parameter)
{
#ifdef SL_WIFI
/*
* Wait for the WiFi to be initialized
*/
EFR32_LOG("APP: Wait WiFi Init");
while (!wfx_hw_ready())
{
vTaskDelay(10);
}
EFR32_LOG("APP: Done WiFi Init");
/* We will init server when we get IP */
sWiFiNetworkCommissioningInstance.Init();
/* added for commisioning with wifi */
#endif

sInstance.Run();
}

Expand All @@ -158,18 +179,6 @@ void WindowAppImpl::OnIconTimeout(WindowApp::Timer & timer)

CHIP_ERROR WindowAppImpl::Init()
{
#ifdef SL_WIFI
/*
* Wait for the WiFi to be initialized
*/
EFR32_LOG("APP: Wait WiFi Init");
while (!wfx_hw_ready())
{
vTaskDelay(10);
}
EFR32_LOG("APP: Done WiFi Init");
/* We will init server when we get IP */
#endif
WindowApp::Init();

// Initialize App Task
Expand Down

0 comments on commit 0e3bbae

Please sign in to comment.