Skip to content

Commit

Permalink
Update UI (project-chip#32345)
Browse files Browse the repository at this point in the history
  • Loading branch information
jepenven-silabs authored Feb 29, 2024
1 parent 4c6bdbe commit a94a3c5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
4 changes: 4 additions & 0 deletions examples/platform/silabs/display/demo-ui-bitmaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
#define ZIGBEE_BITMAP_WIDTH 16
#define ZIGBEE_BITMAP_HEIGHT 16

#define ZIGBEE_BITMAP \
0x3f, 0xfc, 0x07, 0xf0, 0xff, 0xc7, 0xff, 0x9f, 0x01, 0x9c, 0x00, 0x0e, 0x00, 0x07, 0x80, 0x03, 0xc0, 0x01, 0xe0, 0x00, 0x70, \
0x80, 0x39, 0x80, 0xf9, 0xff, 0xfb, 0xff, 0x07, 0xe0, 0x1f, 0xfc

#define RAIL_BITMAP_WIDTH 16
#define RAIL_BITMAP_HEIGHT 16

Expand Down
34 changes: 17 additions & 17 deletions examples/platform/silabs/display/demo-ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "dmd/dmd.h"
#include "em_types.h"
#include "glib.h"
#include "sl_component_catalog.h"
#include "sl_memlcd.h"
#if SL_WIFI && !SIWX_917
#include "spi_multiplex.h"
Expand All @@ -41,28 +42,25 @@
#define PROT2_ID_X_POSITION 79

// Matter Logo
#define PROT2_BITMAP_WIDTH MATTER_LOGO_WIDTH
#define PROT2_BITMAP_HEIGHT MATTER_LOGO_HEIGHT
#define PROT2_X_POSITION 104
#define PROT2_Y_POSITION (APP_Y_POSITION + (APP_Y_POSITION / 2))
#define PROT2_BITMAP (matterLogoBitmap)
#define PROT2_BITMAP_CONN (matterLogoBitmap)

// Networking Protocol Logo
#ifdef SL_WIFI
#define PROT1_BITMAP_WIDTH WIFI_BITMAP_WIDTH
#define PROT1_BITMAP_HEIGHT WIFI_BITMAP_HEIGHT
#define PROT1_X_POSITION 8
#define PROT1_Y_POSITION (APP_Y_POSITION + (APP_Y_POSITION / 2))
#define PROT1_BITMAP (networkBitMap)
#define PROT1_BITMAP_CONN (networkBitMap)
#else
#define PROT1_BITMAP_WIDTH THREAD_BITMAP_WIDTH
#define PROT1_BITMAP_HEIGHT THREAD_BITMAP_HEIGHT
#define PROT1_X_POSITION 8
#ifdef SL_CATALOG_ZIGBEE_ZCL_FRAMEWORK_CORE_PRESENT
#define ZIGBEE_POSITION_Y (APP_Y_POSITION + (APP_Y_POSITION / 2) + (ZIGBEE_BITMAP_HEIGHT / 2))
#define PROT1_Y_POSITION (APP_Y_POSITION + (APP_Y_POSITION / 2) - (ZIGBEE_BITMAP_HEIGHT / 2))
#else
#define PROT1_Y_POSITION (APP_Y_POSITION + (APP_Y_POSITION / 2))
#define PROT1_BITMAP (networkBitMap)
#define PROT1_BITMAP_CONN (networkBitMap)
#endif
#endif

/*******************************************************************************
Expand All @@ -82,6 +80,10 @@ static const uint8_t networkBitMap[] = { WIFI_BITMAP };
static const uint8_t networkBitMap[] = { THREAD_BITMAP };
#endif

#ifdef SL_CATALOG_ZIGBEE_ZCL_FRAMEWORK_CORE_PRESENT
static const uint8_t zigbeeBitMap[] = { ZIGBEE_BITMAP };
#endif

// Future usage
// static const uint8_t unconnectedBitMap[] = { QUESTION_MARK_BITMAP };

Expand Down Expand Up @@ -141,14 +143,13 @@ void demoUIDisplayApp(bool on)
updateDisplay();
}

void demoUIDisplayProtocol(demoUIProtocol protocol, bool isConnected)
void demoUIDisplayProtocols()
{
GLIB_drawBitmap(&glibContext, (protocol == DEMO_UI_PROTOCOL1 ? PROT1_X_POSITION : PROT2_X_POSITION),
(protocol == DEMO_UI_PROTOCOL1 ? PROT1_Y_POSITION : PROT2_Y_POSITION),
(protocol == DEMO_UI_PROTOCOL1 ? PROT1_BITMAP_WIDTH : PROT2_BITMAP_WIDTH),
(protocol == DEMO_UI_PROTOCOL1 ? PROT1_BITMAP_HEIGHT : PROT2_BITMAP_HEIGHT),
(protocol == DEMO_UI_PROTOCOL1 ? (isConnected ? PROT1_BITMAP_CONN : PROT1_BITMAP)
: (isConnected ? PROT2_BITMAP_CONN : PROT2_BITMAP)));
GLIB_drawBitmap(&glibContext, PROT2_X_POSITION, PROT2_Y_POSITION, MATTER_LOGO_WIDTH, MATTER_LOGO_HEIGHT, matterLogoBitmap);
GLIB_drawBitmap(&glibContext, PROT1_X_POSITION, PROT1_Y_POSITION, PROT1_BITMAP_WIDTH, PROT1_BITMAP_HEIGHT, networkBitMap);
#ifdef SL_CATALOG_ZIGBEE_ZCL_FRAMEWORK_CORE_PRESENT
GLIB_drawBitmap(&glibContext, PROT1_X_POSITION, ZIGBEE_POSITION_Y, ZIGBEE_BITMAP_WIDTH, ZIGBEE_BITMAP_HEIGHT, zigbeeBitMap);
#endif
updateDisplay();
}

Expand All @@ -157,6 +158,5 @@ void demoUIClearMainScreen(uint8_t * name)
GLIB_clear(&glibContext);
demoUIDisplayHeader((char *) name);
demoUIDisplayApp(false);
demoUIDisplayProtocol(DEMO_UI_PROTOCOL1, false);
demoUIDisplayProtocol(DEMO_UI_PROTOCOL2, false);
demoUIDisplayProtocols();
}
2 changes: 1 addition & 1 deletion examples/platform/silabs/display/demo-ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void demoUIDisplayApp(bool on);
* @return
* void
*****************************************************************************/
void demoUIDisplayProtocol(demoUIProtocol protocol, bool isConnected);
void demoUIDisplayProtocols();

/**************************************************************************/
/**
Expand Down

0 comments on commit a94a3c5

Please sign in to comment.