Skip to content

Commit

Permalink
Allow sample apps to override BaseApplication's default lcd screen (#…
Browse files Browse the repository at this point in the history
…31603)

* Allow sample apps to override BaseApplication's default lcd screen

* Restyled by whitespace

* use virtual method in parent class

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
mykrupp and restyled-commits authored Jan 23, 2024
1 parent 84117dd commit 9f1c159
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
15 changes: 10 additions & 5 deletions examples/platform/silabs/BaseApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,11 +458,7 @@ void BaseApplication::ButtonHandler(AppEvent * aEvent)
// - Cycle LCD screen
CancelFunctionTimer();

OutputQrCode(false);
#ifdef DISPLAY_ENABLED
UpdateLCDStatusScreen();
slLCD.CycleScreens();
#endif
AppTask::GetAppTask().UpdateDisplay();

#ifdef SL_WIFI
if (!ConnectivityMgr().IsWiFiStationProvisioned())
Expand Down Expand Up @@ -493,6 +489,15 @@ void BaseApplication::ButtonHandler(AppEvent * aEvent)
}
}

void BaseApplication::UpdateDisplay()
{
OutputQrCode(false);
#ifdef DISPLAY_ENABLED
UpdateLCDStatusScreen();
slLCD.CycleScreens();
#endif
}

void BaseApplication::CancelFunctionTimer()
{
if (xTimerStop(sFunctionTimer, pdMS_TO_TICKS(0)) == pdFAIL)
Expand Down
5 changes: 5 additions & 0 deletions examples/platform/silabs/BaseApplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ class BaseApplication
*/
static void PostEvent(const AppEvent * event);

/**
* @brief Overridable function used to update display on button press
*/
virtual void UpdateDisplay();

#ifdef DISPLAY_ENABLED
/**
* @brief Return LCD object
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/display/lcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class SilabsLCD
void SetScreen(Screen_e screen);
void CycleScreens(void);
void SetStatus(DisplayStatus_t & status);
void WriteStatus();

#ifdef QR_CODE_ENABLED
void SetQRCode(uint8_t * str, uint32_t size);
Expand All @@ -85,7 +86,6 @@ class SilabsLCD
} DemoState_t;

void WriteDemoUI();
void WriteStatus();

#ifdef QR_CODE_ENABLED
void WriteQRCode();
Expand Down

0 comments on commit 9f1c159

Please sign in to comment.