diff --git a/examples/window-app/efr32/include/WindowAppImpl.h b/examples/window-app/efr32/include/WindowAppImpl.h index a052838add1c89..8bfbe8ead0b7be 100644 --- a/examples/window-app/efr32/include/WindowAppImpl.h +++ b/examples/window-app/efr32/include/WindowAppImpl.h @@ -26,6 +26,9 @@ #include #include #include +#ifdef DISPLAY_ENABLED +#include +#endif class WindowAppImpl : public WindowApp { @@ -81,6 +84,8 @@ class WindowAppImpl : public WindowApp // Get QR Code and emulate its content using NFC tag char mQRCodeBuffer[chip::QRCodeBasicSetupPayloadGenerator::kMaxQRCodeBase38RepresentationLength + 1]; +#ifdef DISPLAY_ENABLED Timer mIconTimer; LcdIcon mIcon = LcdIcon::None; +#endif }; diff --git a/examples/window-app/efr32/src/WindowAppImpl.cpp b/examples/window-app/efr32/src/WindowAppImpl.cpp index 8ccfa97ea098a7..3f2cad957c068a 100644 --- a/examples/window-app/efr32/src/WindowAppImpl.cpp +++ b/examples/window-app/efr32/src/WindowAppImpl.cpp @@ -16,12 +16,10 @@ */ #include -#include #include #include #include #include -#include #include #include #include @@ -37,6 +35,11 @@ #include "wfx_host_events.h" #endif +#ifdef DISPLAY_ENABLED +#include +SilabsLCD slLCD; +#endif + #define APP_TASK_STACK_SIZE (4096) #define APP_TASK_PRIORITY 2 #define APP_EVENT_QUEUE_SIZE 10 @@ -129,16 +132,16 @@ StaticQueue_t sAppEventQueueStruct; WindowAppImpl WindowAppImpl::sInstance; -#ifdef DISPLAY_ENABLED -SilabsLCD slLCD; -#endif - WindowApp & WindowApp::Instance() { return WindowAppImpl::sInstance; } +#ifdef DISPLAY_ENABLED WindowAppImpl::WindowAppImpl() : mIconTimer("Timer:icon", LCD_ICON_TIMEOUT, OnIconTimeout, this) {} +#else +WindowAppImpl::WindowAppImpl() {} +#endif void WindowAppImpl::OnTaskCallback(void * parameter) { @@ -147,8 +150,10 @@ void WindowAppImpl::OnTaskCallback(void * parameter) void WindowAppImpl::OnIconTimeout(WindowApp::Timer & timer) { +#ifdef DISPLAY_ENABLED sInstance.mIcon = LcdIcon::None; sInstance.UpdateLCD(); +#endif } CHIP_ERROR WindowAppImpl::Init() @@ -331,6 +336,7 @@ void WindowAppImpl::DispatchEvent(const WindowApp::Event & event) case EventId::BLEConnectionsChanged: UpdateLEDs(); break; +#ifdef DISPLAY_ENABLED case EventId::CoverTypeChange: UpdateLCD(); break; @@ -344,6 +350,7 @@ void WindowAppImpl::DispatchEvent(const WindowApp::Event & event) mIcon = mTiltMode ? LcdIcon::Tilt : LcdIcon::Lift; UpdateLCD(); break; +#endif default: break; } @@ -433,10 +440,12 @@ void WindowAppImpl::UpdateLCD() Attributes::CurrentPositionTilt::Get(cover.mEndpoint, tilt); chip::DeviceLayer::PlatformMgr().UnlockChipStack(); +#ifdef DISPLAY_ENABLED if (!tilt.IsNull() && !lift.IsNull()) { LcdPainter::Paint(slLCD, type, lift.Value(), tilt.Value(), mIcon); } +#endif } #ifdef QR_CODE_ENABLED else