Skip to content

Commit

Permalink
[EFR32] Add a disable lcd flag to efr32 examples (#18474)
Browse files Browse the repository at this point in the history
* Add disable LCD flag to efr32 examples

* update comment

* add QR code define

* clean up checks
  • Loading branch information
mkardous-silabs authored and pull[bot] committed Dec 19, 2023
1 parent 1f6c278 commit 1121492
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 30 deletions.
16 changes: 11 additions & 5 deletions examples/light-switch-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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"
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions examples/light-switch-app/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <app-common/zap-generated/attribute-id.h>
Expand Down
16 changes: 11 additions & 5 deletions examples/lighting-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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"
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions examples/lighting-app/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <app-common/zap-generated/attribute-id.h>
Expand Down
16 changes: 11 additions & 5 deletions examples/lock-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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"
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions examples/lock-app/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <app-common/zap-generated/af-structs.h>
Expand Down
16 changes: 11 additions & 5 deletions examples/ota-requestor-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions examples/ota-requestor-app/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <app-common/zap-generated/attribute-id.h>
Expand Down
19 changes: 12 additions & 7 deletions examples/window-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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
Expand Down Expand Up @@ -226,7 +231,7 @@ efr32_executable("window_app") {
}
}

if (lcd_on) {
if (!disable_lcd) {
sources += [
"${examples_plat_dir}/display/lcd.c",
"src/LcdPainter.cpp",
Expand Down
7 changes: 4 additions & 3 deletions third_party/efr32_sdk/efr32_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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 += [
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 1121492

Please sign in to comment.