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] Clean up gn files for QRcode Lib #16527

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion examples/lighting-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ efr32_executable("lighting_app") {

deps = [
":sdk",
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/lighting-app/lighting-common",
"${chip_root}/src/lib",
"${chip_root}/src/setup_payload",
Expand Down Expand Up @@ -219,6 +218,8 @@ efr32_executable("lighting_app") {
if (show_qr_code) {
sources += [ "${examples_plat_dir}/display/lcd.c" ]
defines += [ "DISPLAY_ENABLED" ]

deps += [ "${chip_root}/examples/common/QRCode" ]
}

if (chip_enable_pw_rpc) {
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 @@ -21,8 +21,10 @@
#include "AppConfig.h"
#include "AppEvent.h"
#include "LEDWidget.h"
#ifdef DISPLAY_ENABLED
#include "lcd.h"
#include "qrcodegen.h"
#endif // DISPLAY_ENABLED
#include "sl_simple_led_instances.h"
#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attribute-type.h>
Expand Down
4 changes: 2 additions & 2 deletions examples/lock-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ efr32_executable("lock_app") {

deps = [
":sdk",
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/lock-app/lock-common",
"${chip_root}/src/lib",
"${chip_root}/src/setup_payload",
Expand Down Expand Up @@ -220,8 +219,9 @@ efr32_executable("lock_app") {

if (show_qr_code) {
sources += [ "${examples_plat_dir}/display/lcd.c" ]

defines += [ "DISPLAY_ENABLED" ]

deps += [ "${chip_root}/examples/common/QRCode" ]
}

if (chip_enable_pw_rpc) {
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 @@ -21,8 +21,10 @@
#include "AppConfig.h"
#include "AppEvent.h"
#include "LEDWidget.h"
#ifdef DISPLAY_ENABLED
#include "lcd.h"
#include "qrcodegen.h"
#endif // DISPLAY_ENABLED
#include "sl_simple_led_instances.h"
#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attribute-type.h>
Expand Down
2 changes: 2 additions & 0 deletions examples/ota-requestor-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ efr32_executable("ota_requestor_app") {
if (show_qr_code) {
sources += [ "${examples_plat_dir}/display/lcd.c" ]
defines += [ "DISPLAY_ENABLED" ]

deps += [ "${chip_root}/examples/common/QRCode" ]
mkardous-silabs marked this conversation as resolved.
Show resolved Hide resolved
}

if (chip_enable_pw_rpc) {
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 @@ -21,8 +21,10 @@
#include "AppConfig.h"
#include "AppEvent.h"
#include "LEDWidget.h"
#ifdef DISPLAY_ENABLED
#include "lcd.h"
#include "qrcodegen.h"
#endif // DISPLAY_ENABLED
#include "sl_simple_led_instances.h"
#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attribute-type.h>
Expand Down
10 changes: 10 additions & 0 deletions examples/platform/efr32/display/lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@

#include "dmd.h"
#include "glib.h"

#if !defined(QR_CODE_ENABLED) || QR_CODE_ENABLED
mkardous-silabs marked this conversation as resolved.
Show resolved Hide resolved
#include "qrcodegen.h"
#endif // !defined(QR_CODE_ENABLED) || QR_CODE_ENABLED

#include "sl_board_control.h"

#define LCD_SIZE 128
Expand All @@ -32,10 +36,14 @@
#define QR_CODE_BORDER_SIZE 0

static GLIB_Context_t glibContext;
#if !defined(QR_CODE_ENABLED) || QR_CODE_ENABLED
mkardous-silabs marked this conversation as resolved.
Show resolved Hide resolved
static uint8_t qrCode[qrcodegen_BUFFER_LEN_FOR_VERSION(QR_CODE_VERSION)];
static uint8_t workBuffer[qrcodegen_BUFFER_LEN_FOR_VERSION(QR_CODE_VERSION)];
#endif // !defined(QR_CODE_ENABLED) || QR_CODE_ENABLED

#if !defined(QR_CODE_ENABLED) || QR_CODE_ENABLED
mkardous-silabs marked this conversation as resolved.
Show resolved Hide resolved
static void LCDFillRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h);
#endif // !defined(QR_CODE_ENABLED) || QR_CODE_ENABLED

void initLCD(void)
{
Expand Down Expand Up @@ -92,6 +100,7 @@ int LCD_update(void)
return DMD_updateDisplay();
}

#if !defined(QR_CODE_ENABLED) || QR_CODE_ENABLED
mkardous-silabs marked this conversation as resolved.
Show resolved Hide resolved
void LCDWriteQRCode(uint8_t * str)
{
if (!qrcodegen_encodeText((const char *) str, workBuffer, qrCode, qrcodegen_Ecc_LOW, QR_CODE_VERSION, QR_CODE_VERSION,
Expand Down Expand Up @@ -134,3 +143,4 @@ void LCDFillRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h)
}
}
}
#endif // !defined(QR_CODE_ENABLED) || QR_CODE_ENABLED
18 changes: 14 additions & 4 deletions examples/window-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,19 @@ declare_args() {
sl_wfx_config_softap = false
sl_wfx_config_scan = true

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

# 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
}

if (use_rs911x || use_wf200) {
wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi"
if (use_rs911x) {
Expand Down Expand Up @@ -180,7 +185,6 @@ efr32_executable("window_app") {
}
deps = [
":sdk",
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/window-app/common:window-common",
"${chip_root}/src/lib",
"${chip_root}/src/setup_payload",
Expand All @@ -205,13 +209,19 @@ efr32_executable("window_app") {
}
}

if (show_qr_code) {
if (lcd_on) {
sources += [
"${examples_plat_dir}/display/lcd.c",
"src/LcdPainter.cpp",
]

defines += [ "DISPLAY_ENABLED" ]

if (show_qr_code) {
deps += [ "${chip_root}/examples/common/QRCode" ]
defines += [ "QR_CODE_ENABLED=1" ]
} else {
defines += [ "QR_CODE_ENABLED=0" ]
}
}

if (enable_heap_monitoring) {
Expand Down
8 changes: 6 additions & 2 deletions examples/window-app/efr32/src/WindowAppImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
#include <lib/dnssd/Advertiser.h>
#include <lib/support/CodeUtils.h>
#include <platform/CHIPDeviceLayer.h>
#if QR_CODE_ENABLED
#include <qrcodegen.h>
#endif // QR_CODE_ENABLED
#include <sl_simple_button_instances.h>
#include <sl_simple_led_instances.h>
#include <sl_system_kernel.h>
Expand Down Expand Up @@ -413,7 +415,7 @@ void WindowAppImpl::UpdateLCD()
if (mState.isThreadProvisioned)
#else
if (mState.isWiFiProvisioned)
#endif
#endif // CHIP_ENABLE_OPENTHREAD
{
Cover & cover = GetCover();
chip::app::DataModel::Nullable<uint16_t> lift;
Expand All @@ -431,14 +433,16 @@ void WindowAppImpl::UpdateLCD()
LcdPainter::Paint(type, static_cast<uint8_t>(lift.Value()), static_cast<uint8_t>(tilt.Value()), mIcon);
}
}
#if !defined(QR_CODE_ENABLED) || QR_CODE_ENABLED
mkardous-silabs marked this conversation as resolved.
Show resolved Hide resolved
else
{
if (GetQRCode(mQRCode, chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)) == CHIP_NO_ERROR)
{
LCDWriteQRCode((uint8_t *) mQRCode.c_str());
}
}
#endif
#endif // !defined(QR_CODE_ENABLED) || QR_CODE_ENABLED
#endif // DISPLAY_ENABLED
}

void WindowAppImpl::OnMainLoop()
Expand Down
40 changes: 20 additions & 20 deletions third_party/efr32_sdk/efr32_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ template("efr32_sdk") {
# USART include 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.lcd_on) && invoker.lcd_on)) {
defines += [ "CONFIG_ENABLE_UART" ]

_include_dirs += [
Expand Down Expand Up @@ -505,25 +506,24 @@ template("efr32_sdk") {
}
}

if (defined(invoker.show_qr_code)) {
if (invoker.show_qr_code) {
sources += [
"${efr32_sdk_root}/hardware/driver/memlcd/src/sl_memlcd.c",
"${efr32_sdk_root}/hardware/driver/memlcd/src/sl_memlcd_display.c",
"${efr32_sdk_root}/platform/middleware/glib/dmd/display/dmd_memlcd.c",
"${efr32_sdk_root}/platform/middleware/glib/glib/bmp.c",
"${efr32_sdk_root}/platform/middleware/glib/glib/glib.c",
"${efr32_sdk_root}/platform/middleware/glib/glib/glib_bitmap.c",
"${efr32_sdk_root}/platform/middleware/glib/glib/glib_circle.c",
"${efr32_sdk_root}/platform/middleware/glib/glib/glib_font_narrow_6x8.c",
"${efr32_sdk_root}/platform/middleware/glib/glib/glib_font_normal_8x8.c",
"${efr32_sdk_root}/platform/middleware/glib/glib/glib_font_number_16x20.c",
"${efr32_sdk_root}/platform/middleware/glib/glib/glib_line.c",
"${efr32_sdk_root}/platform/middleware/glib/glib/glib_polygon.c",
"${efr32_sdk_root}/platform/middleware/glib/glib/glib_rectangle.c",
"${efr32_sdk_root}/platform/middleware/glib/glib/glib_string.c",
]
}
if ((defined(invoker.show_qr_code) && invoker.show_qr_code) ||
(defined(invoker.lcd_on) && invoker.lcd_on)) {
sources += [
"${efr32_sdk_root}/hardware/driver/memlcd/src/sl_memlcd.c",
"${efr32_sdk_root}/hardware/driver/memlcd/src/sl_memlcd_display.c",
"${efr32_sdk_root}/platform/middleware/glib/dmd/display/dmd_memlcd.c",
"${efr32_sdk_root}/platform/middleware/glib/glib/bmp.c",
"${efr32_sdk_root}/platform/middleware/glib/glib/glib.c",
"${efr32_sdk_root}/platform/middleware/glib/glib/glib_bitmap.c",
"${efr32_sdk_root}/platform/middleware/glib/glib/glib_circle.c",
"${efr32_sdk_root}/platform/middleware/glib/glib/glib_font_narrow_6x8.c",
"${efr32_sdk_root}/platform/middleware/glib/glib/glib_font_normal_8x8.c",
"${efr32_sdk_root}/platform/middleware/glib/glib/glib_font_number_16x20.c",
"${efr32_sdk_root}/platform/middleware/glib/glib/glib_line.c",
"${efr32_sdk_root}/platform/middleware/glib/glib/glib_polygon.c",
"${efr32_sdk_root}/platform/middleware/glib/glib/glib_rectangle.c",
"${efr32_sdk_root}/platform/middleware/glib/glib/glib_string.c",
]
}
if (use_wf200) {
sources += [
Expand Down