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] Window Covering app modified to compile on boards without LCD. #22101

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions examples/window-app/efr32/include/WindowAppImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
#include <string>
#include <task.h>
#include <timers.h>
#ifdef DISPLAY_ENABLED
#include <LcdPainter.h>
#endif

class WindowAppImpl : public WindowApp
{
Expand Down Expand Up @@ -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
};
21 changes: 15 additions & 6 deletions examples/window-app/efr32/src/WindowAppImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@
*/

#include <AppConfig.h>
#include <LcdPainter.h>
#include <WindowAppImpl.h>
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app/clusters/window-covering-server/window-covering-server.h>
#include <app/server/OnboardingCodesUtil.h>
#include <lcd.h>
#include <lib/core/CHIPError.h>
#include <lib/dnssd/Advertiser.h>
#include <lib/support/CodeUtils.h>
Expand All @@ -37,6 +35,11 @@
#include "wfx_host_events.h"
#endif

#ifdef DISPLAY_ENABLED
#include <LcdPainter.h>
SilabsLCD slLCD;
#endif

#define APP_TASK_STACK_SIZE (4096)
#define APP_TASK_PRIORITY 2
#define APP_EVENT_QUEUE_SIZE 10
Expand Down Expand Up @@ -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)
{
Expand All @@ -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()
Expand Down Expand Up @@ -331,6 +336,7 @@ void WindowAppImpl::DispatchEvent(const WindowApp::Event & event)
case EventId::BLEConnectionsChanged:
UpdateLEDs();
break;
#ifdef DISPLAY_ENABLED
case EventId::CoverTypeChange:
UpdateLCD();
break;
Expand All @@ -344,6 +350,7 @@ void WindowAppImpl::DispatchEvent(const WindowApp::Event & event)
mIcon = mTiltMode ? LcdIcon::Tilt : LcdIcon::Lift;
UpdateLCD();
break;
#endif
default:
break;
}
Expand Down Expand Up @@ -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
Expand Down