Skip to content

Commit

Permalink
[EFR32] fix sleepy devices for efr32 (project-chip#16196)
Browse files Browse the repository at this point in the history
* fix sleepy devices for efr32

* PR comments

* restyles

* update window cover
  • Loading branch information
mkardous-silabs authored Mar 16, 2022
1 parent 645b03b commit 1302ce0
Show file tree
Hide file tree
Showing 15 changed files with 128 additions and 44 deletions.
10 changes: 7 additions & 3 deletions examples/light-switch-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ declare_args() {
use_rs911x_sockets = false
sl_wfx_config_softap = false
sl_wfx_config_scan = true
}

show_qr_code = true
# Enables LCD Qr Code on supported devices
show_qr_code = true
}

# BRD4166A --> ThunderBoard Sense 2 (No LCD)
if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") {
Expand Down Expand Up @@ -149,14 +150,17 @@ efr32_executable("light_switch_app") {
"${examples_plat_dir}/LEDWidget.cpp",
"${examples_plat_dir}/heap_4_silabs.c",
"${examples_plat_dir}/init_efrPlatform.cpp",
"${examples_plat_dir}/uart.cpp",
"src/AppTask.cpp",
"src/LightingManager.cpp",
"src/ZclCallbacks.cpp",
"src/binding-handler.cpp",
"src/main.cpp",
]

if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli) {
sources += [ "${examples_plat_dir}/uart.cpp" ]
}

deps = [
":sdk",
"${chip_root}/examples/common/QRCode",
Expand Down
3 changes: 2 additions & 1 deletion examples/light-switch-app/efr32/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,9 @@ int main(void)
#else // CHIP_DEVICE_CONFIG_THREAD_FTD
#if CHIP_DEVICE_CONFIG_ENABLE_SED
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice);
#endif // CHIP_DEVICE_CONFIG_ENABLE_SED
#else // CHIP_DEVICE_CONFIG_ENABLE_SED
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice);
#endif // CHIP_DEVICE_CONFIG_ENABLE_SED
#endif // CHIP_DEVICE_CONFIG_THREAD_FTD
if (ret != CHIP_NO_ERROR)
{
Expand Down
10 changes: 7 additions & 3 deletions examples/lighting-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ declare_args() {
use_rs911x_sockets = false
sl_wfx_config_softap = false
sl_wfx_config_scan = true
}

show_qr_code = true
# Enables LCD Qr Code on supported devices
show_qr_code = true
}

# BRD4166A --> ThunderBoard Sense 2 (No LCD)
if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") {
Expand Down Expand Up @@ -148,13 +149,16 @@ efr32_executable("lighting_app") {
"${examples_plat_dir}/LEDWidget.cpp",
"${examples_plat_dir}/heap_4_silabs.c",
"${examples_plat_dir}/init_efrPlatform.cpp",
"${examples_plat_dir}/uart.cpp",
"src/AppTask.cpp",
"src/LightingManager.cpp",
"src/ZclCallbacks.cpp",
"src/main.cpp",
]

if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli) {
sources += [ "${examples_plat_dir}/uart.cpp" ]
}

deps = [
":sdk",
"${chip_root}/examples/common/QRCode",
Expand Down
3 changes: 2 additions & 1 deletion examples/lighting-app/efr32/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ int main(void)
#else // CHIP_DEVICE_CONFIG_THREAD_FTD
#if CHIP_DEVICE_CONFIG_ENABLE_SED
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice);
#endif // CHIP_DEVICE_CONFIG_ENABLE_SED
#else // CHIP_DEVICE_CONFIG_ENABLE_SED
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice);
#endif // CHIP_DEVICE_CONFIG_ENABLE_SED
#endif // CHIP_DEVICE_CONFIG_THREAD_FTD
if (ret != CHIP_NO_ERROR)
{
Expand Down
10 changes: 7 additions & 3 deletions examples/lock-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ declare_args() {
use_rs911x_sockets = false
sl_wfx_config_softap = false
sl_wfx_config_scan = true
}

show_qr_code = true
# Enables LCD Qr Code on supported devices
show_qr_code = true
}

# BRD4166A --> ThunderBoard Sense 2 (No LCD)
if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") {
Expand Down Expand Up @@ -147,13 +148,16 @@ efr32_executable("lock_app") {
"${examples_plat_dir}/LEDWidget.cpp",
"${examples_plat_dir}/heap_4_silabs.c",
"${examples_plat_dir}/init_efrPlatform.cpp",
"${examples_plat_dir}/uart.cpp",
"src/AppTask.cpp",
"src/BoltLockManager.cpp",
"src/ZclCallbacks.cpp",
"src/main.cpp",
]

if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli) {
sources += [ "${examples_plat_dir}/uart.cpp" ]
}

deps = [
":sdk",
"${chip_root}/examples/common/QRCode",
Expand Down
3 changes: 2 additions & 1 deletion examples/lock-app/efr32/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,9 @@ int main(void)
#else // CHIP_DEVICE_CONFIG_THREAD_FTD
#if CHIP_DEVICE_CONFIG_ENABLE_SED
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice);
#endif // CHIP_DEVICE_CONFIG_ENABLE_SED
#else // CHIP_DEVICE_CONFIG_ENABLE_SED
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice);
#endif // CHIP_DEVICE_CONFIG_ENABLE_SED
#endif // CHIP_DEVICE_CONFIG_THREAD_FTD
if (ret != CHIP_NO_ERROR)
{
Expand Down
10 changes: 7 additions & 3 deletions examples/ota-requestor-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ declare_args() {

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

show_qr_code = true
# Enables LCD Qr Code on supported devices
show_qr_code = true
}

# BRD4166A --> ThunderBoard Sense 2 (No LCD)
if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") {
Expand Down Expand Up @@ -89,13 +90,16 @@ efr32_executable("ota_requestor_app") {
"${examples_plat_dir}/LEDWidget.cpp",
"${examples_plat_dir}/heap_4_silabs.c",
"${examples_plat_dir}/init_efrPlatform.cpp",
"${examples_plat_dir}/uart.cpp",
"src/AppTask.cpp",
"src/LightingManager.cpp",
"src/ZclCallbacks.cpp",
"src/main.cpp",
]

if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli) {
sources += [ "${examples_plat_dir}/uart.cpp" ]
}

deps = [
":sdk",
"${chip_root}/examples/common/QRCode",
Expand Down
5 changes: 4 additions & 1 deletion examples/shell/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@ efr32_executable("shell_app") {
sources = [
"${examples_plat_dir}/heap_4_silabs.c",
"${examples_plat_dir}/init_efrPlatform.cpp",
"${examples_plat_dir}/uart.cpp",
"src/main.cpp",
]

if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli) {
sources += [ "${examples_plat_dir}/uart.cpp" ]
}

deps = [
":sdk",
"${chip_root}/examples/shell/shell_common:shell_common",
Expand Down
10 changes: 7 additions & 3 deletions examples/window-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ declare_args() {
use_rs911x_sockets = false
sl_wfx_config_softap = false
sl_wfx_config_scan = true
}

show_qr_code = true
# Enables LCD Qr Code on supported devices
show_qr_code = true
}

# BRD4166A --> ThunderBoard Sense 2 (No LCD)
if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") {
Expand Down Expand Up @@ -137,13 +138,16 @@ efr32_executable("window_app") {
"${examples_plat_dir}/LEDWidget.cpp",
"${examples_plat_dir}/heap_4_silabs.c",
"${examples_plat_dir}/init_efrPlatform.cpp",
"${examples_plat_dir}/uart.cpp",
"${project_dir}/common/src/WindowApp.cpp",
"${project_dir}/common/src/ZclCallbacks.cpp",
"src/WindowAppImpl.cpp",
"src/main.cpp",
]

if (chip_build_libshell || enable_openthread_cli) {
sources += [ "${examples_plat_dir}/uart.cpp" ]
}

if (chip_enable_ota_requestor) {
defines += [ "EFR32_OTA_ENABLED" ]
sources += [ "${examples_plat_dir}/OTAConfig.cpp" ]
Expand Down
3 changes: 2 additions & 1 deletion examples/window-app/efr32/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@ int main(void)
#else // CHIP_DEVICE_CONFIG_THREAD_FTD
#if CHIP_DEVICE_CONFIG_ENABLE_SED
err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice);
#endif // CHIP_DEVICE_CONFIG_ENABLE_SED
#else // CHIP_DEVICE_CONFIG_ENABLE_SED
err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice);
#endif // CHIP_DEVICE_CONFIG_ENABLE_SED
#endif // CHIP_DEVICE_CONFIG_THREAD_FTD
if (err != CHIP_NO_ERROR)
{
Expand Down
7 changes: 6 additions & 1 deletion scripts/examples/gn_efr32_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ if [ "$#" == "0" ]; then
Location for an alternate or modified efr32 SDK
enable_heap_monitoring
Monitor & log memory usage at runtime. (Default false)
enable_openthread_cli
Enables openthread cli without matter shell. (Default true)
show_qr_code
Enables QR code on LCD for devices with an LCD
setupDiscriminator
Discriminatoor value used for BLE connexion. (Default 3840)
setupPinCode
Expand All @@ -78,7 +82,8 @@ if [ "$#" == "0" ]; then
Periodic query timeout variable for OTA in seconds
Presets
--sed
enable sleepy end device and set thread mtd
enable sleepy end device, set thread mtd
For minimum consumption, disable openthread cli and qr code
--wifi <wf200 | rs911x>
build wifi example variant for given exansion board
"
Expand Down
4 changes: 4 additions & 0 deletions src/platform/EFR32/ThreadStackManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ extern "C" otError otPlatUartEnable(void)
#endif
}

#if CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI

extern "C" otError otPlatUartSend(const uint8_t * aBuf, uint16_t aBufLength)
{
#ifdef PW_RPC_ENABLED
Expand Down Expand Up @@ -162,3 +164,5 @@ extern "C" __WEAK otError otPlatUartDisable(void)
{
return OT_ERROR_NOT_IMPLEMENTED;
}

#endif // CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI
5 changes: 4 additions & 1 deletion src/test_driver/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,13 @@ efr32_executable("efr32_device_tests") {
"${examples_plat_dir}/PigweedLogger.cpp",
"${examples_plat_dir}/heap_4_silabs.c",
"${examples_plat_dir}/init_efrPlatform.cpp",
"${examples_plat_dir}/uart.cpp",
"src/main.cpp",
]

if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli) {
sources += [ "${examples_plat_dir}/uart.cpp" ]
}

deps = [
":nl_test_service.nanopb_rpc",
":sdk",
Expand Down
Loading

0 comments on commit 1302ce0

Please sign in to comment.