From 11214928a2bc9e429100d65a847279e7f0b43d4b Mon Sep 17 00:00:00 2001 From: mkardous-silabs <84793247+mkardous-silabs@users.noreply.github.com> Date: Mon, 16 May 2022 18:27:30 -0400 Subject: [PATCH] [EFR32] Add a disable lcd flag to efr32 examples (#18474) * Add disable LCD flag to efr32 examples * update comment * add QR code define * clean up checks --- examples/light-switch-app/efr32/BUILD.gn | 16 +++++++++++----- .../light-switch-app/efr32/src/AppTask.cpp | 2 ++ examples/lighting-app/efr32/BUILD.gn | 16 +++++++++++----- examples/lighting-app/efr32/src/AppTask.cpp | 2 ++ examples/lock-app/efr32/BUILD.gn | 16 +++++++++++----- examples/lock-app/efr32/src/AppTask.cpp | 2 ++ examples/ota-requestor-app/efr32/BUILD.gn | 16 +++++++++++----- .../ota-requestor-app/efr32/src/AppTask.cpp | 2 ++ examples/window-app/efr32/BUILD.gn | 19 ++++++++++++------- third_party/efr32_sdk/efr32_sdk.gni | 7 ++++--- 10 files changed, 68 insertions(+), 30 deletions(-) diff --git a/examples/light-switch-app/efr32/BUILD.gn b/examples/light-switch-app/efr32/BUILD.gn index 2c18e0e10d11e5..a9e31ea0c88edf 100644 --- a/examples/light-switch-app/efr32/BUILD.gn +++ b/examples/light-switch-app/efr32/BUILD.gn @@ -58,10 +58,18 @@ declare_args() { sl_wfx_config_softap = false sl_wfx_config_scan = true + # Disable LCD on supported devices + disable_lcd = false +} + +declare_args() { # Enables LCD Qr Code on supported devices - show_qr_code = true + show_qr_code = !disable_lcd } +# qr code cannot be true if lcd is disabled +assert(!(disable_lcd && show_qr_code)) + # Sanity check assert(!(chip_enable_wifi && chip_enable_openthread)) assert(!(use_rs911x && chip_enable_openthread)) @@ -73,11 +81,9 @@ if (chip_enable_wifi) { # BRD4166A --> ThunderBoard Sense 2 (No LCD) if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { show_qr_code = false + disable_lcd = true } -# Enables LCD on supported devices -lcd_on = show_qr_code - # WiFi settings if (chip_enable_wifi) { wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi" @@ -237,7 +243,7 @@ efr32_executable("light_switch_app") { } } - if (lcd_on) { + if (!disable_lcd) { sources += [ "${examples_plat_dir}/display/lcd.c" ] defines += [ "DISPLAY_ENABLED" ] if (show_qr_code) { diff --git a/examples/light-switch-app/efr32/src/AppTask.cpp b/examples/light-switch-app/efr32/src/AppTask.cpp index 0de6074a6eaa3b..d7da5a17ea4d24 100644 --- a/examples/light-switch-app/efr32/src/AppTask.cpp +++ b/examples/light-switch-app/efr32/src/AppTask.cpp @@ -26,7 +26,9 @@ #ifdef DISPLAY_ENABLED #include "lcd.h" +#ifdef QR_CODE_ENABLED #include "qrcodegen.h" +#endif // QR_CODE_ENABLED #endif // DISPLAY_ENABLED #include diff --git a/examples/lighting-app/efr32/BUILD.gn b/examples/lighting-app/efr32/BUILD.gn index e4ada0367062b9..bee89cccfa52d9 100644 --- a/examples/lighting-app/efr32/BUILD.gn +++ b/examples/lighting-app/efr32/BUILD.gn @@ -58,10 +58,18 @@ declare_args() { sl_wfx_config_softap = false sl_wfx_config_scan = true + # Disable LCD on supported devices + disable_lcd = false +} + +declare_args() { # Enables LCD Qr Code on supported devices - show_qr_code = true + show_qr_code = !disable_lcd } +# qr code cannot be true if lcd is disabled +assert(!(disable_lcd && show_qr_code)) + # Sanity check assert(!(chip_enable_wifi && chip_enable_openthread)) assert(!(use_rs911x && chip_enable_openthread)) @@ -73,11 +81,9 @@ if (chip_enable_wifi) { # BRD4166A --> ThunderBoard Sense 2 (No LCD) if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { show_qr_code = false + disable_lcd = true } -# Enables LCD on supported devices -lcd_on = show_qr_code - # WiFi settings if (chip_enable_wifi) { wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi" @@ -236,7 +242,7 @@ efr32_executable("lighting_app") { } } - if (lcd_on) { + if (!disable_lcd) { sources += [ "${examples_plat_dir}/display/lcd.c" ] defines += [ "DISPLAY_ENABLED" ] if (show_qr_code) { diff --git a/examples/lighting-app/efr32/src/AppTask.cpp b/examples/lighting-app/efr32/src/AppTask.cpp index d9c5de9bc766b1..040f0c715cdf38 100644 --- a/examples/lighting-app/efr32/src/AppTask.cpp +++ b/examples/lighting-app/efr32/src/AppTask.cpp @@ -23,7 +23,9 @@ #include "LEDWidget.h" #ifdef DISPLAY_ENABLED #include "lcd.h" +#ifdef QR_CODE_ENABLED #include "qrcodegen.h" +#endif // QR_CODE_ENABLED #endif // DISPLAY_ENABLED #include "sl_simple_led_instances.h" #include diff --git a/examples/lock-app/efr32/BUILD.gn b/examples/lock-app/efr32/BUILD.gn index ea20b04fc03516..ab479bb5175a86 100644 --- a/examples/lock-app/efr32/BUILD.gn +++ b/examples/lock-app/efr32/BUILD.gn @@ -58,10 +58,18 @@ declare_args() { sl_wfx_config_softap = false sl_wfx_config_scan = true + # Disable LCD on supported devices + disable_lcd = false +} + +declare_args() { # Enables LCD Qr Code on supported devices - show_qr_code = true + show_qr_code = !disable_lcd } +# qr code cannot be true if lcd is disabled +assert(!(disable_lcd && show_qr_code)) + # Sanity check assert(!(chip_enable_wifi && chip_enable_openthread)) assert(!(use_rs911x && chip_enable_openthread)) @@ -73,11 +81,9 @@ if (chip_enable_wifi) { # BRD4166A --> ThunderBoard Sense 2 (No LCD) if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { show_qr_code = false + disable_lcd = true } -# Enables LCD on supported devices -lcd_on = show_qr_code - # WiFi settings if (chip_enable_wifi) { wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi" @@ -238,7 +244,7 @@ efr32_executable("lock_app") { } } - if (lcd_on) { + if (!disable_lcd) { sources += [ "${examples_plat_dir}/display/lcd.c" ] defines += [ "DISPLAY_ENABLED" ] if (show_qr_code) { diff --git a/examples/lock-app/efr32/src/AppTask.cpp b/examples/lock-app/efr32/src/AppTask.cpp index 18da28e917740b..27e376503bfdd9 100644 --- a/examples/lock-app/efr32/src/AppTask.cpp +++ b/examples/lock-app/efr32/src/AppTask.cpp @@ -23,7 +23,9 @@ #include "LEDWidget.h" #ifdef DISPLAY_ENABLED #include "lcd.h" +#ifdef QR_CODE_ENABLED #include "qrcodegen.h" +#endif // QR_CODE_ENABLED #endif // DISPLAY_ENABLED #include "sl_simple_led_instances.h" #include diff --git a/examples/ota-requestor-app/efr32/BUILD.gn b/examples/ota-requestor-app/efr32/BUILD.gn index 22e413d288567d..9e56b9d900cfcd 100644 --- a/examples/ota-requestor-app/efr32/BUILD.gn +++ b/examples/ota-requestor-app/efr32/BUILD.gn @@ -45,18 +45,24 @@ declare_args() { # Monitor & log memory usage at runtime. enable_heap_monitoring = false + # Disable LCD on supported devices + disable_lcd = false +} + +declare_args() { # Enables LCD Qr Code on supported devices - show_qr_code = true + show_qr_code = !disable_lcd } +# qr code cannot be true if lcd is disabled +assert(!(disable_lcd && show_qr_code)) + # BRD4166A --> ThunderBoard Sense 2 (No LCD) if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { show_qr_code = false + disable_lcd = true } -# Enables LCD on supported devices -lcd_on = show_qr_code - efr32_sdk("sdk") { sources = [ "${efr32_project_dir}/include/CHIPProjectConfig.h", @@ -125,7 +131,7 @@ efr32_executable("ota_requestor_app") { ] } - if (lcd_on) { + if (!disable_lcd) { sources += [ "${examples_plat_dir}/display/lcd.c" ] defines += [ "DISPLAY_ENABLED" ] if (show_qr_code) { diff --git a/examples/ota-requestor-app/efr32/src/AppTask.cpp b/examples/ota-requestor-app/efr32/src/AppTask.cpp index e3255f3eace0df..31f819f77e7540 100644 --- a/examples/ota-requestor-app/efr32/src/AppTask.cpp +++ b/examples/ota-requestor-app/efr32/src/AppTask.cpp @@ -23,7 +23,9 @@ #include "LEDWidget.h" #ifdef DISPLAY_ENABLED #include "lcd.h" +#ifdef QR_CODE_ENABLED #include "qrcodegen.h" +#endif // QR_CODE_ENABLED #endif // DISPLAY_ENABLED #include "sl_simple_led_instances.h" #include diff --git a/examples/window-app/efr32/BUILD.gn b/examples/window-app/efr32/BUILD.gn index 43a0ef3eed70e8..61f5ed9b842af1 100644 --- a/examples/window-app/efr32/BUILD.gn +++ b/examples/window-app/efr32/BUILD.gn @@ -51,10 +51,18 @@ declare_args() { sl_wfx_config_softap = false sl_wfx_config_scan = true - # Enables Qr Code on supported devices - show_qr_code = true + # Disable LCD on supported devices + disable_lcd = false } +declare_args() { + # Enables LCD Qr Code on supported devices + show_qr_code = !disable_lcd +} + +# qr code cannot be true if lcd is disabled +assert(!(disable_lcd && show_qr_code)) + # Sanity check assert(!(chip_enable_wifi && chip_enable_openthread)) assert(!(use_rs911x && chip_enable_openthread)) @@ -63,13 +71,10 @@ if (chip_enable_wifi) { assert(use_rs911x || use_wf200) } -# Enables LCD on supported devices -lcd_on = true - # BRD4166A --> ThunderBoard Sense 2 (No LCD) if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { show_qr_code = false - lcd_on = false + disable_lcd = true } # WiFi settings @@ -226,7 +231,7 @@ efr32_executable("window_app") { } } - if (lcd_on) { + if (!disable_lcd) { sources += [ "${examples_plat_dir}/display/lcd.c", "src/LcdPainter.cpp", diff --git a/third_party/efr32_sdk/efr32_sdk.gni b/third_party/efr32_sdk/efr32_sdk.gni index 96e62104f3a99f..3fe0e894978505 100644 --- a/third_party/efr32_sdk/efr32_sdk.gni +++ b/third_party/efr32_sdk/efr32_sdk.gni @@ -179,7 +179,7 @@ template("efr32_sdk") { if ((defined(invoker.chip_enable_pw_rpc) && invoker.chip_enable_pw_rpc) || chip_build_libshell || enable_openthread_cli || (defined(invoker.show_qr_code) && invoker.show_qr_code) || - (defined(invoker.lcd_on) && invoker.lcd_on)) { + (defined(invoker.disable_lcd) && !invoker.disable_lcd)) { defines += [ "CONFIG_ENABLE_UART" ] _include_dirs += [ @@ -484,7 +484,8 @@ template("efr32_sdk") { # USART sources files if ((defined(invoker.chip_enable_pw_rpc) && invoker.chip_enable_pw_rpc) || chip_build_libshell || enable_openthread_cli || - (defined(invoker.show_qr_code) && invoker.show_qr_code)) { + (defined(invoker.show_qr_code) && invoker.show_qr_code) || + (defined(invoker.disable_lcd) && !invoker.disable_lcd)) { sources += [ "${efr32_sdk_root}/matter/efr32/${efr32_family}/sl_uartdrv_init.c", "${efr32_sdk_root}/platform/emdrv/uartdrv/src/uartdrv.c", @@ -512,7 +513,7 @@ template("efr32_sdk") { } if ((defined(invoker.show_qr_code) && invoker.show_qr_code) || - (defined(invoker.lcd_on) && invoker.lcd_on)) { + (defined(invoker.disable_lcd) && !invoker.disable_lcd)) { sources += [ "${efr32_sdk_root}/hardware/driver/memlcd/src/sl_memlcd.c", "${efr32_sdk_root}/hardware/driver/memlcd/src/sl_memlcd_display.c",