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

[Silabs] Adds SPI multiplex changes for rs911x #26238

Merged
merged 50 commits into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
dd8cbca
SPI multiplex changes for rs911x
kurvaSai Apr 24, 2023
63d7375
Adds intermediate changes with cleanup
rosahay-silabs Apr 28, 2023
564b105
Adds additional macro checks
rosahay-silabs Apr 30, 2023
897a9f0
Adds updated working logic for multiplexing expansion header and LCD
rosahay-silabs May 4, 2023
eceb277
Adds missing ;
rosahay-silabs May 15, 2023
5308e5b
Adds fix for WF200 baudrate on SPI
rosahay-silabs May 16, 2023
5e6c9a4
Adds fix for third_party
rosahay-silabs May 16, 2023
25ed296
Adds updated log statements
rosahay-silabs May 17, 2023
68710c3
Adds fix for log statement
rosahay-silabs May 17, 2023
62e7aae
Adds conditional use of semaphore
rosahay-silabs May 18, 2023
830f1f2
Adds conditional EFR32MG24 semaphore logic
rosahay-silabs May 18, 2023
3c82fba
Adds fix for err usage
rosahay-silabs May 18, 2023
471a3c8
Refactor SPIDRV_ReInit
rosahay-silabs May 23, 2023
d0ed067
Adds SPIDRV_ReInit for EUSART
rosahay-silabs May 23, 2023
d0cbb77
Added error logs
rosahay-silabs May 23, 2023
7e2f516
Added logs
rosahay-silabs May 23, 2023
2764df6
Revert submodule update
rosahay-silabs May 23, 2023
f46cbf2
Aligned the macros
rosahay-silabs May 24, 2023
3a617a7
Restyled
rosahay-silabs May 24, 2023
ddd86b0
Aligned the MACRO
rosahay-silabs May 25, 2023
9a23e6b
Adds cosmetic changes
rosahay-silabs May 26, 2023
e55962a
Removes debug log
rosahay-silabs May 26, 2023
161b508
Adds sl_wfx_host_post_bootloader_spi_transfer in relevant failure out…
rosahay-silabs May 26, 2023
3df8e4a
Adds re factored local function updateDisplay(void)
rosahay-silabs May 29, 2023
e0d011f
Removes spi_multiplex.c
rosahay-silabs May 29, 2023
2385720
Removes development debug trace and log
rosahay-silabs May 29, 2023
89ae0e9
Renamed conflicting variable
rosahay-silabs May 29, 2023
ca03194
Adds comment for technical debt and understanding
rosahay-silabs May 29, 2023
ab9621f
Adds changes for updateDisplay function
rosahay-silabs Jun 1, 2023
81a7732
Adds checks for semaphore used for sync peripherals
rosahay-silabs Jun 1, 2023
d041967
Clean up of unreachable code due to portMAX_DELAY
rosahay-silabs Jun 1, 2023
0396629
Adds fix for comment alignment
rosahay-silabs Jun 1, 2023
dcf6f02
Changes SPIDRV_ReInit to SPIDRV_SetBaudrate
rosahay-silabs Jun 1, 2023
81cfce5
Removes unused error variable
rosahay-silabs Jun 1, 2023
16550a7
Clean up logs
rosahay-silabs Jun 1, 2023
79ad0c9
Clean up of logs
rosahay-silabs Jun 1, 2023
4157d56
Replace magic number
rosahay-silabs Jun 1, 2023
f41a329
Added tickets for tracking additional rework
rosahay-silabs Jun 5, 2023
e35ebfe
Clean up additional logs
rosahay-silabs Jun 5, 2023
6fa303b
Adds fix for print statements
rosahay-silabs Jun 8, 2023
d015a24
Adds fix for MACRO
rosahay-silabs Jun 8, 2023
8740a88
Adds fix for MATTER-1904
rosahay-silabs Jun 19, 2023
89bba24
Adds partial fix for MATTER-1907
rosahay-silabs Jun 20, 2023
12f958d
Adds for fix code compilation
rosahay-silabs Jun 20, 2023
1ba09ff
Adds code to clean up MACROs
rosahay-silabs Jun 20, 2023
6cdf634
Restyled by clang-format
restyled-commits Jun 20, 2023
3326a40
Removes debug log
rosahay-silabs Jun 21, 2023
ae9f3af
Adds fix for MATTER-1907
rosahay-silabs Jun 21, 2023
d720788
Adds use of the ECODE_EMDRV_SPIDRV status instead of generic ECODE
rosahay-silabs Jun 21, 2023
c9472c1
Adds comment for declaring the current supported family.
rosahay-silabs Jun 21, 2023
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
41 changes: 18 additions & 23 deletions examples/platform/silabs/display/demo-ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "glib.h"
#include <stdio.h>
#include <string.h>
#if (defined(EFR32MG24) && defined(WF200_WIFI))
#if (defined(EFR32MG24) && defined(SL_WIFI))
#include "spi_multiplex.h"
#endif

Expand Down Expand Up @@ -92,7 +92,6 @@ static void demoUIDisplayLogo(void)
GLIB_drawBitmap(&glibContext, SILICONLABS_X_POSITION, SILICONLABS_Y_POSITION, SILICONLABS_BITMAP_WIDTH,
SILICONLABS_BITMAP_HEIGHT, siliconlabsBitmap);
}

/*******************************************************************************
************************** GLOBAL FUNCTIONS *******************************
******************************************************************************/
Expand All @@ -101,33 +100,35 @@ void demoUIInit(GLIB_Context_t * context)
memcpy(&glibContext, context, sizeof(GLIB_Context_t));
}

sl_status_t updateDisplay(void)
{
#if (defined(EFR32MG24) && defined(SL_WIFI))
rosahay-silabs marked this conversation as resolved.
Show resolved Hide resolved
sl_wfx_host_pre_lcd_spi_transfer();
#endif
sl_status_t status = DMD_updateDisplay();
#if (defined(EFR32MG24) && defined(SL_WIFI))
sl_wfx_host_post_lcd_spi_transfer();
#endif
if (status != DMD_OK)
return SL_STATUS_FAIL;
return SL_STATUS_OK;
}

void demoUIDisplayHeader(char * name)
{
demoUIDisplayLogo();
if (APP_NAME_MAX_LENGTH >= strlen(name))
{
GLIB_drawStringOnLine(&glibContext, name, 5, GLIB_ALIGN_CENTER, 0, 0, true);
}
#if (defined(EFR32MG24) && defined(WF200_WIFI))
pre_lcd_spi_transfer();
#endif
DMD_updateDisplay();
#if (defined(EFR32MG24) && defined(WF200_WIFI))
post_lcd_spi_transfer();
#endif
updateDisplay();
}

void demoUIDisplayApp(bool on)
{
GLIB_drawBitmap(&glibContext, APP_X_POSITION, APP_Y_POSITION, APP_BITMAP_WIDTH, APP_BITMAP_HEIGHT,
(on ? OnStateBitMap : OffStateBitMap));
#if (defined(EFR32MG24) && defined(WF200_WIFI))
pre_lcd_spi_transfer();
#endif
DMD_updateDisplay();
#if (defined(EFR32MG24) && defined(WF200_WIFI))
post_lcd_spi_transfer();
#endif
updateDisplay();
}

void demoUIDisplayProtocol(demoUIProtocol protocol, bool isConnected)
Expand All @@ -138,13 +139,7 @@ void demoUIDisplayProtocol(demoUIProtocol protocol, bool isConnected)
(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)));
#if (defined(EFR32MG24) && defined(WF200_WIFI))
pre_lcd_spi_transfer();
#endif
DMD_updateDisplay();
#if (defined(EFR32MG24) && defined(WF200_WIFI))
post_lcd_spi_transfer();
#endif
updateDisplay();
}

void demoUIClearMainScreen(uint8_t * name)
Expand Down
172 changes: 95 additions & 77 deletions examples/platform/silabs/display/demo-ui.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
/***************************************************************************/ /**
* @file
* @brief User Interface for demo.
*******************************************************************************
* # License
* <b>Copyright 2020 Silicon Laboratories Inc.
*www.silabs.com</b>
*******************************************************************************
*
* The licensor of this software is Silicon
*Laboratories Inc. Your use of this software is
*governed by the terms of Silicon Labs Master
*Software License Agreement (MSLA) available at
* www.silabs.com/about-us/legal/master-software-license-agreement.
*This software is distributed to you in Source Code
*format and is governed by the sections of the MSLA
*applicable to Source Code.
*
******************************************************************************/
/***************************************************************************/
/**
* @file
* @brief User Interface for demo.
*******************************************************************************
* # License
* <b>Copyright 2020 Silicon Laboratories Inc.
*www.silabs.com</b>
*******************************************************************************
*
* The licensor of this software is Silicon
*Laboratories Inc. Your use of this software is
*governed by the terms of Silicon Labs Master
*Software License Agreement (MSLA) available at
* www.silabs.com/about-us/legal/master-software-license-agreement.
*This software is distributed to you in Source Code
*format and is governed by the sections of the MSLA
*applicable to Source Code.
*
******************************************************************************/

#pragma once

Expand All @@ -25,13 +26,15 @@ extern "C" {
#endif

#include "glib.h"
/**************************************************************************/ /**
* DEMO UI uses the underlying DMD interface and the
*GLIB and exposes several wrapper functions to
*application. These functions are used to display
* different bitmaps for the demo.
*
******************************************************************************/
#include "sl_status.h"
/**************************************************************************/
/**
* DEMO UI uses the underlying DMD interface and the
*GLIB and exposes several wrapper functions to
*application. These functions are used to display
* different bitmaps for the demo.
*
******************************************************************************/

#define APP_NAME_MAX_LENGTH 20

Expand Down Expand Up @@ -73,67 +76,82 @@ typedef enum
****************************** PROTOTYPES *********************************
******************************************************************************/

/**************************************************************************/ /**
* @brief
* Initilize the GLIB and DMD interfaces.
*
* @param[in] void
*
* @return
* void
*****************************************************************************/
/**************************************************************************/
/**
* @brief
* Initilize the GLIB and DMD interfaces.
*
* @param[in] void
*
* @return
* void
*****************************************************************************/
void demoUIInit(GLIB_Context_t * context);

/**************************************************************************/ /**
* @brief
* Update the display with Silicon Labs logo and
*application name.
*
* @param[in] name name of the current application.
*
* @return
* void
*****************************************************************************/
/**************************************************************************/
/**
* @brief
* Update the display with Silicon Labs logo and
*application name.
*
* @param[in] name name of the current application.
*
* @return
* void
*****************************************************************************/
void demoUIDisplayHeader(char * name);

/**************************************************************************/ /**
* @brief
* Update the display with App image. Bool state only
*for now.
*
* @param[in] on status of App
*
* @return
* void
*****************************************************************************/
/**************************************************************************/
/**
* @brief
* Update the display with App image. Bool state only
*for now.
*
* @param[in] on status of App
*
* @return
* void
*****************************************************************************/
void demoUIDisplayApp(bool on);

/**************************************************************************/ /**
* @brief
* Update the display to show if the bluetooth is
*connected to the mobile device.
*
* @param[in] bool, true if the Light is connected to
*mobile device, false otherwise.
*
* @return
* void
*****************************************************************************/
/**************************************************************************/
/**
* @brief
* Update the display to show if the bluetooth is
*connected to the mobile device.
*
* @param[in] bool, true if the Light is connected to
*mobile device, false otherwise.
*
* @return
* void
*****************************************************************************/
void demoUIDisplayProtocol(demoUIProtocol protocol, bool isConnected);

/**************************************************************************/ /**
* @brief
* Clear the Lcd screen and display the main screen.
*
* @param[in] name - application name
* @param[in] showPROT1 - show protocol 1 related icon.
* @param[in] showPROT2 - show protocol 2 related icon.
*
* @return
* void
*****************************************************************************/
/**************************************************************************/
/**
* @brief
* Clear the Lcd screen and display the main screen.
*
* @param[in] name - application name
* @param[in] showPROT1 - show protocol 1 related icon.
* @param[in] showPROT2 - show protocol 2 related icon.
*
* @return
* void
*****************************************************************************/
void demoUIClearMainScreen(uint8_t * name);

/**************************************************************************/
/**
* @brief
* Clear the Lcd screen and display the main screen.
*
* @return
* Returns SL_STATUS_OK if successful, error otherwise.
*****************************************************************************/
sl_status_t updateDisplay(void);

#ifdef __cplusplus
}
#endif
24 changes: 3 additions & 21 deletions examples/platform/silabs/display/lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#include "sl_board_control.h"

#if (defined(EFR32MG24) && defined(WF200_WIFI))
#if (defined(EFR32MG24) && defined(SL_WIFI))
#include "spi_multiplex.h"
#endif
#define LCD_SIZE 128
Expand Down Expand Up @@ -120,18 +120,7 @@ int SilabsLCD::DrawPixel(void * pContext, int32_t x, int32_t y)

int SilabsLCD::Update(void)
{
int status;
#if (defined(EFR32MG24) && defined(WF200_WIFI))
pre_lcd_spi_transfer();
#endif
status = DMD_updateDisplay();
#if (defined(EFR32MG24) && defined(WF200_WIFI))
post_lcd_spi_transfer();
#endif
/*
* TO-DO; Above logic can be optimised by writing a common API
*/
return status;
return updateDisplay();
}

void SilabsLCD::WriteDemoUI(bool state)
Expand Down Expand Up @@ -194,14 +183,7 @@ void SilabsLCD::WriteQRCode()
}
}
}
#if (defined(EFR32MG24) && defined(WF200_WIFI))
pre_lcd_spi_transfer();
#endif

DMD_updateDisplay();
#if (defined(EFR32MG24) && defined(WF200_WIFI))
post_lcd_spi_transfer();
#endif
SilabsLCD::Update();
}

void SilabsLCD::SetQRCode(uint8_t * str, uint32_t size)
Expand Down
Loading