Skip to content

Commit

Permalink
Resolved review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bhmanda-silabs committed Feb 21, 2024
1 parent 8388855 commit cb625d8
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 13 deletions.
10 changes: 7 additions & 3 deletions examples/platform/silabs/efr32/rs911x/hal/efx32_ncp_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,16 @@ uint32_t sl_si91x_host_get_wake_indicator(void)

sl_status_t sl_si91x_host_init(sl_si91x_host_init_configuration * config)
{
uint32_t status = SL_STATUS_OK;
#if SL_SPICTRL_MUX
if (SL_STATUS_OK != sl_board_disable_display())
status = sl_board_disable_display();
if (SL_STATUS_OK != status)
{
return SL_STATUS_FAIL;
SILABS_LOG("sl_board_disable_display failed with error: %x", status);
xSemaphoreGive(spi_sem_sync_hdl);
return status;
}
#endif
#endif //SL_SPICTRL_MUX
init_config.rx_irq = config->rx_irq;
init_config.rx_done = config->rx_done;

Expand Down
16 changes: 12 additions & 4 deletions examples/platform/silabs/efr32/rs911x/hal/efx_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,16 @@ sl_status_t sl_wfx_host_post_bootloader_spi_transfer(void)
#if SL_LCDCTRL_MUX
sl_status_t sl_wfx_host_pre_lcd_spi_transfer(void)
{
uint32_t status = SL_STATUS_OK;
#if SL_SPICTRL_MUX
xSemaphoreTake(spi_sem_sync_hdl, portMAX_DELAY);
#endif // SL_SPICTRL_MUX
if (SL_STATUS_OK != sl_board_enable_display())
status = sl_board_enable_display();
if (SL_STATUS_OK != status)
{
return SL_STATUS_FAIL;
SILABS_LOG("sl_board_enable_display failed with error: %x", status);
xSemaphoreGive(spi_sem_sync_hdl);
return status;
}
// sl_memlcd_refresh takes care of SPIDRV_Init()
if (SL_STATUS_OK != sl_memlcd_refresh(sl_memlcd_get()))
Expand All @@ -318,12 +322,16 @@ sl_status_t sl_wfx_host_pre_lcd_spi_transfer(void)

sl_status_t sl_wfx_host_post_lcd_spi_transfer(void)
{
uint32_t status = SL_STATUS_OK;
USART_Enable(SL_MEMLCD_SPI_PERIPHERAL, usartDisable);
CMU_ClockEnable(SPI_CLOCK(SL_MEMLCD_SPI_PERIPHERAL_NO), false);
GPIO->USARTROUTE[SL_MEMLCD_SPI_PERIPHERAL_NO].ROUTEEN = PINOUT_CLEAR;
if (SL_STATUS_OK != sl_board_disable_display())
status = sl_board_disable_display();
if (SL_STATUS_OK != status)
{
return SL_STATUS_FAIL;
SILABS_LOG("sl_board_disable_display failed with error: %x", status);
xSemaphoreGive(spi_sem_sync_hdl);
return status;
}
#if SL_SPICTRL_MUX
xSemaphoreGive(spi_sem_sync_hdl);
Expand Down
17 changes: 12 additions & 5 deletions examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ sl_status_t sl_wfx_host_spiflash_cs_deassert(void);
#if SL_SPICTRL_MUX
StaticSemaphore_t spi_sem_peripheral;
SemaphoreHandle_t spi_sem_sync_hdl;

#endif // SL_SPICTRL_MUX

#if SL_LCDCTRL_MUX
Expand All @@ -81,12 +80,16 @@ SemaphoreHandle_t spi_sem_sync_hdl;
**********************************************************/
sl_status_t sl_wfx_host_pre_lcd_spi_transfer(void)
{
uint32_t status = SL_STATUS_OK;
#if SL_SPICTRL_MUX
xSemaphoreTake(spi_sem_sync_hdl, portMAX_DELAY);
#endif // SL_SPICTRL_MUX
if (SL_STATUS_OK != sl_board_enable_display())
status = sl_board_enable_display();
if (SL_STATUS_OK != status)
{
return SL_STATUS_FAIL;
SILABS_LOG("sl_board_enable_display failed with error: %x", status);
xSemaphoreGive(spi_sem_sync_hdl);
return status;
}
SPIDRV_SetBaudrate(SL_SPIDRV_LCD_BITRATE);

Expand All @@ -102,12 +105,16 @@ sl_status_t sl_wfx_host_pre_lcd_spi_transfer(void)
**********************************************************/
sl_status_t sl_wfx_host_post_lcd_spi_transfer(void)
{
uint32_t status = SL_STATUS_OK;
#if SL_SPICTRL_MUX
xSemaphoreGive(spi_sem_sync_hdl);
#endif // SL_SPICTRL_MUX
if (SL_STATUS_OK != sl_board_disable_display())
status = sl_board_disable_display();
if (SL_STATUS_OK != status)
{
return SL_STATUS_FAIL;
SILABS_LOG("sl_board_disable_display failed with error: %x", status);
xSemaphoreGive(spi_sem_sync_hdl);
return status;
}
return SL_STATUS_OK;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
#define SL_SI91X_NCP_UTILITY_H

#pragma once

#include "FreeRTOS.h"
#include "semphr.h"
#include "silabs_utils.h"
#include "sl_status.h"
#include "spi_multiplex.h"
Expand All @@ -39,6 +40,7 @@
#define USART_INITSYNC_BAUDRATE 12500000

#if SL_SPICTRL_MUX
extern SemaphoreHandle_t spi_sem_sync_hdl;
sl_status_t spi_board_init(void);
#endif // SL_SPICTRL_MUX

Expand Down

0 comments on commit cb625d8

Please sign in to comment.