Skip to content

Commit

Permalink
Adds refactored deassert
Browse files Browse the repository at this point in the history
  • Loading branch information
rosahay-silabs committed Oct 16, 2023
1 parent 88e216d commit 1063c6d
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions examples/platform/silabs/efr32/rs911x/hal/efx_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,17 +279,11 @@ sl_status_t sl_wfx_host_spiflash_cs_deassert(void)
sl_status_t sl_wfx_host_pre_bootloader_spi_transfer(void)
{
#if SL_SPICTRL_MUX
xSemaphoreTake(spi_sem_sync_hdl, portMAX_DELAY);
if (spi_enabled)
if (sl_wfx_host_spi_cs_deassert() != SL_STATUS_OK)
{
if (ECODE_EMDRV_SPIDRV_OK != SPIDRV_DeInit(SL_SPIDRV_HANDLE))
{
xSemaphoreGive(spi_sem_sync_hdl);
SILABS_LOG("%s error.", __func__);
return SL_STATUS_FAIL;
}
spi_enabled = false;
return SL_STATUS_FAIL;
}
xSemaphoreTake(spi_sem_sync_hdl, portMAX_DELAY);
#endif // SL_SPICTRL_MUX
// bootloader_init takes care of SPIDRV_Init()
int32_t status = bootloader_init();
Expand Down Expand Up @@ -334,17 +328,11 @@ sl_status_t sl_wfx_host_post_bootloader_spi_transfer(void)
sl_status_t sl_wfx_host_pre_lcd_spi_transfer(void)
{
#if SL_SPICTRL_MUX
xSemaphoreTake(spi_sem_sync_hdl, portMAX_DELAY);
if (spi_enabled)
if (sl_wfx_host_spi_cs_deassert() != SL_STATUS_OK)
{
if (ECODE_EMDRV_SPIDRV_OK != SPIDRV_DeInit(SL_SPIDRV_HANDLE))
{
xSemaphoreGive(spi_sem_sync_hdl);
SILABS_LOG("%s error.", __func__);
return SL_STATUS_FAIL;
}
spi_enabled = false;
return SL_STATUS_FAIL;
}
xSemaphoreTake(spi_sem_sync_hdl, portMAX_DELAY);
#endif // SL_SPICTRL_MUX
// sl_memlcd_refresh takes care of SPIDRV_Init()
if (SL_STATUS_OK != sl_memlcd_refresh(sl_memlcd_get()))
Expand Down

0 comments on commit 1063c6d

Please sign in to comment.