Skip to content

Commit

Permalink
[Silabs]: Enabled LCD for 2.0 917 SOC board (#29250)
Browse files Browse the repository at this point in the history
* added required files to GN, and solved build errors

* Enabled LCD for BRD4338A (2.0) board

* Updated Matter support pointer

* Fixed build issues

* Build error fixed

* Update matter support pointer

* Restyled by clang-format

* Restyled by gn

---------

Co-authored-by: srningap <Srishylam.Ningapuram@silabs.com>
Co-authored-by: Restyled.io <commits@restyled.io>
  • Loading branch information
3 people authored Sep 20, 2023
1 parent 06ff0e2 commit a190015
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 7 deletions.
12 changes: 12 additions & 0 deletions examples/platform/silabs/display/lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
#include "dmd.h"
#include "glib.h"

#if (SIWX_917)
#include "rsi_chip.h"
#endif

#ifdef QR_CODE_ENABLED
#include "qrcodegen.h"
#endif // QR_CODE_ENABLED
Expand All @@ -38,6 +42,7 @@
#define QR_CODE_VERSION 4
#define QR_CODE_MODULE_SIZE 3
#define QR_CODE_BORDER_SIZE 0
#define SL_BOARD_ENABLE_DISPLAY_PIN 0

#ifdef QR_CODE_ENABLED
static uint8_t qrCode[qrcodegen_BUFFER_LEN_FOR_VERSION(QR_CODE_VERSION)];
Expand All @@ -64,12 +69,19 @@ CHIP_ERROR SilabsLCD::Init(uint8_t * name, bool initialState)
}

/* Enable the memory lcd */
#if (SIWX_917)
RSI_NPSSGPIO_InputBufferEn(SL_BOARD_ENABLE_DISPLAY_PIN, 1U);
RSI_NPSSGPIO_SetPinMux(SL_BOARD_ENABLE_DISPLAY_PIN, 0);
RSI_NPSSGPIO_SetDir(SL_BOARD_ENABLE_DISPLAY_PIN, 0);
RSI_NPSSGPIO_SetPin(SL_BOARD_ENABLE_DISPLAY_PIN, 1U);
#else
status = sl_board_enable_display();
if (status != SL_STATUS_OK)
{
SILABS_LOG("Board Display enable fail %d", status);
err = CHIP_ERROR_INTERNAL;
}
#endif

/* Initialize the DMD module for the DISPLAY device driver. */
status = DMD_init(0);
Expand Down
71 changes: 67 additions & 4 deletions third_party/silabs/SiWx917_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,27 @@ template("siwx917_sdk") {
"${efr32_sdk_root}/util/third_party/freertos/kernel/include",
"${wifi_sdk_root}/components/protocol/wifi/si91x",
"${efr32_sdk_root}/util/third_party/freertos/kernel/portable/GCC/ARM_CM4F",

#for LCD
"${efr32_sdk_root}/platform/middleware/glib",
"${efr32_sdk_root}/platform/middleware/glib/config",
"${efr32_sdk_root}/platform/middleware/glib/glib",
"${efr32_sdk_root}/platform/middleware/glib/dmd",
"${wifi_sdk_root}/components/siwx917_soc/drivers/hardware_drivers/memlcd/inc",
"${wifi_sdk_root}/components/siwx917_soc/drivers/hardware_drivers/memlcd/inc/memlcd_917",
"${wifi_sdk_root}/components/siwx917_soc/drivers/middleware/sleeptimer/inc",
"${wifi_sdk_root}/components/siwx917_soc/drivers/unified_api/inc",
"${efr32_sdk_root}/hardware/driver/memlcd/src/ls013b7dh03",
"${efr32_sdk_root}/platform/service/sleeptimer/inc",
"${efr32_sdk_root}/platform/service/sleeptimer/config",
"${efr32_sdk_root}/platform/service/sleeptimer/src",
"${sdk_support_root}/matter/si91x/siwx917/${sdk_support_board}/support/inc",
]

if (silabs_board == "BRD4338A") {
_include_dirs += [ "${wifi_sdk_root}/components/siwx917_soc/core/config" ]
}

# Note that we're setting the mbedTLS and PSA configuration files through a
# define. This means the build system by default does not pick up changes in
# the content of these, only when changing the filename itself.
Expand Down Expand Up @@ -164,11 +182,11 @@ template("siwx917_sdk") {
"TA_DEEP_SLEEP_COMMON_FLASH",
"SL_WIFI_COMPONENT_INCLUDED",
"CHIP_917=1",
"ROMDRIVER_PRESENT",
"ROMDRIVER_PRESENT=1",
"SL_CATALOG_FREERTOS_KERNEL_PRESENT=1",
"SL_PLATFORM_EXAMPLES_ENABLE",
"SI91X_DEVICE",
"SI917_RADIO_BOARD",
"SI91X_DEVICE=1",
"SI917_RADIO_BOARD=1",
"FLASH_PAGE_SIZE",
"SL_NVM3_PRESENT",
"ROM_WIRELESS",
Expand All @@ -185,7 +203,18 @@ template("siwx917_sdk") {
"EXECUTION_FROM_RAM",
]
if (silabs_board == "BRD4338A") {
defines += [ "SI917_RADIO_BOARD_V2=1" ]
defines += [
"SI917_RADIO_BOARD_V2=1",
"SL_BOARD_NAME=\"BRD4338A\"",
"SL_BOARD_REV=\"A00\"",
"SPI_MULTI_SLAVE=1",
"SYSCALLS_WRITE=1",
"SI91X_PLATFORM=1",
"SI91X_SYSRTC_COUNT=1",
"SI91X_SYSRTC_PRESENT=1",
"SSI_ULP_MASTER=1",
"SL_MEMLCD_EXTCOMIN_PORT=0",
]
}
}

Expand Down Expand Up @@ -225,6 +254,15 @@ template("siwx917_sdk") {
if (invoker.enable_dic) {
_include_dirs += [ "${chip_root}/third_party/silabs/mqtt/stack" ]
}
if (!disable_lcd) {
defines += [
"CONFIG_ENABLE_UART",
"__STATIC_INLINE=static inline",
"SI91X_SYSRTC_COUNT=1",
"SYSCALLS_WRITE",
"SPI_MULTI_SLAVE",
]
}

# Enabling led interface
if (use_wstk_leds) {
Expand Down Expand Up @@ -428,6 +466,31 @@ template("siwx917_sdk") {
]
}

if (!disable_lcd) {
sources += [
"${efr32_sdk_root}/platform/middleware/glib/dmd/display/dmd_memlcd.c",
"${efr32_sdk_root}/platform/middleware/glib/fonts/glib_font_narrow_6x8.c",
"${efr32_sdk_root}/platform/middleware/glib/fonts/glib_font_normal_8x8.c",
"${efr32_sdk_root}/platform/middleware/glib/fonts/glib_font_number_16x20.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_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",
"${efr32_sdk_root}/platform/service/sleeptimer/src/sl_sleeptimer.c",
"${wifi_sdk_root}/components/siwx917_soc/drivers/cmsis_driver/SPI.c",
"${wifi_sdk_root}/components/siwx917_soc/drivers/hardware_drivers/memlcd/src/memlcd_917/sl_memlcd_spi.c",
"${wifi_sdk_root}/components/siwx917_soc/drivers/hardware_drivers/memlcd/src/sl_memlcd.c",
"${wifi_sdk_root}/components/siwx917_soc/drivers/hardware_drivers/memlcd/src/sl_memlcd_display.c",
"${wifi_sdk_root}/components/siwx917_soc/drivers/peripheral_drivers/src/rsi_sysrtc.c",
"${wifi_sdk_root}/components/siwx917_soc/drivers/service/sleeptimer/src/sl_sleeptimer_hal_si91x_sysrtc.c",
"${wifi_sdk_root}/components/siwx917_soc/drivers/unified_api/src/sl_si91x_ulp_timer.c",
]
}

public_deps = [
":siwx917_mbedtls_config",
"${segger_rtt_root}:segger_rtt",
Expand Down
2 changes: 1 addition & 1 deletion third_party/silabs/matter_support
4 changes: 2 additions & 2 deletions third_party/silabs/silabs_board.gni
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ if (silabs_board == "BRD4304A") {
} else if (silabs_board == "BRD4338A") {
silabs_family = "SiWx917-common"
silabs_mcu = "SiWG917M111MGTBA"
disable_lcd = true
show_qr_code = false
disable_lcd = false
show_qr_code = true
wifi_soc = true
wifi_soc_common_flash = true
silabs_board_lower = "brd4338a"
Expand Down

0 comments on commit a190015

Please sign in to comment.