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

EFR32 Network Commissioning WiFi Driver #15356

Merged
merged 3 commits into from
Feb 18, 2022
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
20 changes: 11 additions & 9 deletions examples/light-switch-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ declare_args() {
chip_print_memory_usage = false

# PIN code for PASE session establishment.
setupPinCode = 73141520
setupPinCode = 20202021
setupDiscriminator = 3840

# Monitor & log memory usage at runtime.
Expand All @@ -53,7 +53,7 @@ declare_args() {
use_rs911x = false
use_rs911x_sockets = false
sl_wfx_config_softap = false
sl_wfx_config_scan = false
sl_wfx_config_scan = true
}

show_qr_code = true
Expand Down Expand Up @@ -114,9 +114,8 @@ efr32_sdk("sdk") {
} else if (use_wf200) {
defines += wf200_defs
include_dirs += wf200_plat_incs
} else {
defines += [ "SL_HEAP_SIZE=20480" ]
}

if (use_rs911x_sockets) {
include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ]
defines += rs911x_sock_defs
Expand All @@ -126,11 +125,14 @@ efr32_sdk("sdk") {
#
defines += efr32_lwip_defs
}
if (sl_wfx_config_softap) {
defines += "SL_WFX_CONFIG_SOFTAP"
}
if (sl_wfx_config_scan) {
defines += "SL_WFX_CONFIG_SCAN"

if (use_rs911x || use_wf200) {
if (sl_wfx_config_softap) {
defines += [ "SL_WFX_CONFIG_SOFTAP" ]
}
if (sl_wfx_config_scan) {
defines += [ "SL_WFX_CONFIG_SCAN" ]
}
}
}

Expand Down
10 changes: 10 additions & 0 deletions examples/light-switch-app/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
#endif
#ifdef SL_WIFI
#include "wfx_host_events.h"
#include <app/clusters/network-commissioning/network-commissioning.h>
#include <platform/EFR32/NetworkCommissioningWiFiDriver.h>
#endif /* SL_WIFI */

#define FACTORY_RESET_TRIGGER_TIMEOUT 3000
Expand All @@ -67,6 +69,9 @@
#define APP_FUNCTION_BUTTON &sl_button_btn0
#define APP_LIGHT_SWITCH &sl_button_btn1

using namespace chip;
using namespace ::chip::DeviceLayer;

namespace {
TimerHandle_t sFunctionTimer; // FreeRTOS app sw timer.

Expand All @@ -79,6 +84,9 @@ LEDWidget sStatusLED;
bool sIsWiFiProvisioned = false;
bool sIsWiFiEnabled = false;
bool sIsWiFiAttached = false;

app::Clusters::NetworkCommissioning::Instance
sWiFiNetworkCommissioningInstance(0 /* Endpoint Id */, &(NetworkCommissioning::SlWiFiDriver::GetInstance()));
#endif /* SL_WIFI */

#if CHIP_ENABLE_OPENTHREAD
Expand Down Expand Up @@ -178,6 +186,8 @@ CHIP_ERROR AppTask::Init()
}
EFR32_LOG("APP: Done WiFi Init");
/* We will init server when we get IP */

sWiFiNetworkCommissioningInstance.Init();
#endif
// Init ZCL Data Model
chip::Server::GetInstance().Init();
Expand Down
19 changes: 10 additions & 9 deletions examples/lighting-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ declare_args() {
chip_print_memory_usage = false

# PIN code for PASE session establishment.
setupPinCode = 73141520
setupPinCode = 20202021
setupDiscriminator = 3840

# Monitor & log memory usage at runtime.
Expand All @@ -53,7 +53,7 @@ declare_args() {
use_rs911x = false
use_rs911x_sockets = false
sl_wfx_config_softap = false
sl_wfx_config_scan = false
sl_wfx_config_scan = true
}

show_qr_code = true
Expand Down Expand Up @@ -114,9 +114,8 @@ efr32_sdk("sdk") {
} else if (use_wf200) {
defines += wf200_defs
include_dirs += wf200_plat_incs
} else {
defines += [ "SL_HEAP_SIZE=20480" ]
}

if (use_rs911x_sockets) {
include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ]
defines += rs911x_sock_defs
Expand All @@ -126,11 +125,13 @@ efr32_sdk("sdk") {
#
defines += efr32_lwip_defs
}
if (sl_wfx_config_softap) {
defines += "SL_WFX_CONFIG_SOFTAP"
}
if (sl_wfx_config_scan) {
defines += "SL_WFX_CONFIG_SCAN"
if (use_rs911x || use_wf200) {
if (sl_wfx_config_softap) {
defines += [ "SL_WFX_CONFIG_SOFTAP" ]
}
if (sl_wfx_config_scan) {
defines += [ "SL_WFX_CONFIG_SCAN" ]
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/efr32/build_for_wifi_gnfile.gn
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ check_system_includes = true
default_args = {
target_cpu = "arm"
target_os = "freertos"
use_thread = false
chip_enable_wifi = true
import("//build_for_wifi_args.gni")
}
10 changes: 10 additions & 0 deletions examples/lighting-app/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
#endif
#ifdef SL_WIFI
#include "wfx_host_events.h"
#include <app/clusters/network-commissioning/network-commissioning.h>
#include <platform/EFR32/NetworkCommissioningWiFiDriver.h>
#endif /* SL_WIFI */

#define FACTORY_RESET_TRIGGER_TIMEOUT 3000
Expand All @@ -67,6 +69,9 @@
#define APP_FUNCTION_BUTTON &sl_button_btn0
#define APP_LIGHT_SWITCH &sl_button_btn1

using namespace chip;
using namespace ::chip::DeviceLayer;

namespace {
TimerHandle_t sFunctionTimer; // FreeRTOS app sw timer.

Expand All @@ -80,6 +85,9 @@ LEDWidget sLightLED;
bool sIsWiFiProvisioned = false;
bool sIsWiFiEnabled = false;
bool sIsWiFiAttached = false;

app::Clusters::NetworkCommissioning::Instance
sWiFiNetworkCommissioningInstance(0 /* Endpoint Id */, &(NetworkCommissioning::SlWiFiDriver::GetInstance()));
#endif /* SL_WIFI */

#if CHIP_ENABLE_OPENTHREAD
Expand Down Expand Up @@ -231,6 +239,8 @@ CHIP_ERROR AppTask::Init()
}
EFR32_LOG("APP: Done WiFi Init");
/* We will init server when we get IP */

sWiFiNetworkCommissioningInstance.Init();
#endif
// Init ZCL Data Model
chip::Server::GetInstance().Init();
Expand Down
19 changes: 10 additions & 9 deletions examples/lock-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ declare_args() {
chip_print_memory_usage = false

# PIN code for PASE session establishment.
setupPinCode = 73141520
setupPinCode = 20202021

# Monitor & log memory usage at runtime.
enable_heap_monitoring = false
Expand All @@ -52,7 +52,7 @@ declare_args() {
use_rs911x = false
use_rs911x_sockets = false
sl_wfx_config_softap = false
sl_wfx_config_scan = false
sl_wfx_config_scan = true
}

show_qr_code = true
Expand Down Expand Up @@ -112,9 +112,8 @@ efr32_sdk("sdk") {
} else if (use_wf200) {
defines += wf200_defs
include_dirs += wf200_plat_incs
} else {
defines += [ "SL_HEAP_SIZE=20480" ]
}

if (use_rs911x_sockets) {
include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ]
defines += rs911x_sock_defs
Expand All @@ -124,11 +123,13 @@ efr32_sdk("sdk") {
#
defines += efr32_lwip_defs
}
if (sl_wfx_config_softap) {
defines += "SL_WFX_CONFIG_SOFTAP"
}
if (sl_wfx_config_scan) {
defines += "SL_WFX_CONFIG_SCAN"
if (use_rs911x || use_wf200) {
if (sl_wfx_config_softap) {
defines += [ "SL_WFX_CONFIG_SOFTAP" ]
}
if (sl_wfx_config_scan) {
defines += [ "SL_WFX_CONFIG_SCAN" ]
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions examples/lock-app/efr32/include/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,11 @@ See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#define configENABLE_BACKWARD_COMPATIBILITY (1)
#define configSUPPORT_STATIC_ALLOCATION (1)
#define configSUPPORT_DYNAMIC_ALLOCATION (1)
#ifdef SL_WIFI
#define configTOTAL_HEAP_SIZE ((size_t)(28 * 1024))
#else
#define configTOTAL_HEAP_SIZE ((size_t)(20 * 1024))
#endif

/* Optional functions - most linkers will remove unused functions anyway. */
#define INCLUDE_vTaskPrioritySet (1)
Expand Down
16 changes: 12 additions & 4 deletions examples/lock-app/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
#endif
#ifdef SL_WIFI
#include "wfx_host_events.h"
#include <app/clusters/network-commissioning/network-commissioning.h>
#include <platform/EFR32/NetworkCommissioningWiFiDriver.h>
#endif

#define FACTORY_RESET_TRIGGER_TIMEOUT 3000
Expand All @@ -62,6 +64,11 @@
#define APP_FUNCTION_BUTTON &sl_button_btn0
#define APP_LOCK_BUTTON &sl_button_btn1

using namespace chip;
using namespace chip::TLV;
using namespace ::chip::Credentials;
using namespace ::chip::DeviceLayer;

namespace {
TimerHandle_t sFunctionTimer; // FreeRTOS app sw timer.

Expand All @@ -75,6 +82,9 @@ LEDWidget sLockLED;
bool sIsWiFiProvisioned = false;
bool sIsWiFiEnabled = false;
bool sIsWiFiAttached = false;

app::Clusters::NetworkCommissioning::Instance
sWiFiNetworkCommissioningInstance(0 /* Endpoint Id */, &(NetworkCommissioning::SlWiFiDriver::GetInstance()));
#endif

#if CHIP_ENABLE_OPENTHREAD
Expand All @@ -87,10 +97,6 @@ StackType_t appStack[APP_TASK_STACK_SIZE / sizeof(StackType_t)];
StaticTask_t appTaskStruct;
} // namespace

using namespace chip::TLV;
using namespace ::chip::Credentials;
using namespace ::chip::DeviceLayer;

AppTask AppTask::sAppTask;

CHIP_ERROR AppTask::StartAppTask()
Expand Down Expand Up @@ -120,6 +126,8 @@ CHIP_ERROR AppTask::Init()
}
EFR32_LOG("APP: Done WiFi Init");
/* We will init server when we get IP */

sWiFiNetworkCommissioningInstance.Init();
#endif
// Init ZCL Data Model
chip::Server::GetInstance().Init();
Expand Down
19 changes: 10 additions & 9 deletions examples/window-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ declare_args() {
chip_print_memory_usage = false

# PIN code for PASE session establishment.
setupPinCode = 73141520
setupPinCode = 20202021

# Monitor & log memory usage at runtime.
enable_heap_monitoring = false
Expand All @@ -46,7 +46,7 @@ declare_args() {
use_rs911x = false
use_rs911x_sockets = false
sl_wfx_config_softap = false
sl_wfx_config_scan = false
sl_wfx_config_scan = true
}

show_qr_code = true
Expand Down Expand Up @@ -99,9 +99,8 @@ efr32_sdk("sdk") {
} else if (use_wf200) {
defines += wf200_defs
include_dirs += wf200_plat_incs
} else {
defines += [ "SL_HEAP_SIZE=20480" ]
}

if (use_rs911x_sockets) {
include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ]
defines += rs911x_sock_defs
Expand All @@ -111,11 +110,13 @@ efr32_sdk("sdk") {
#
defines += efr32_lwip_defs
}
if (sl_wfx_config_softap) {
defines += "SL_WFX_CONFIG_SOFTAP"
}
if (sl_wfx_config_scan) {
defines += "SL_WFX_CONFIG_SCAN"
if (use_rs911x || use_wf200) {
if (sl_wfx_config_softap) {
defines += [ "SL_WFX_CONFIG_SOFTAP" ]
}
if (sl_wfx_config_scan) {
defines += [ "SL_WFX_CONFIG_SCAN" ]
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/window-app/efr32/include/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

// Use a default pairing code if one hasn't been provisioned in flash.
#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 12345678
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021
#endif
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00

Expand Down
4 changes: 2 additions & 2 deletions src/platform/EFR32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ static_library("EFR32") {
if (chip_enable_wifi) {
sources += [
"ConnectivityManagerImpl_WIFI.cpp",
"ServiceProvisioning.cpp",
"ServiceProvisioning.h",
"NetworkCommissioningWiFiDriver.cpp",
"NetworkCommissioningWiFiDriver.h",
]
}
}
Loading