From d06645bb7f280882c77fc2dcdd340ce330afb858 Mon Sep 17 00:00:00 2001 From: rosahay-silabs Date: Tue, 23 May 2023 14:19:12 +0530 Subject: [PATCH] Adds SPIDRV_ReInit for EUSART --- .../platform/silabs/efr32/rs911x/hal/efx_spi.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c b/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c index b95471df464990..dc413b6541d2e5 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c +++ b/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c @@ -172,6 +172,17 @@ void rsi_hal_board_init(void) } #if defined(EFR32MG24) + +void SPIDRV_ReInit(uint32_t baudrate) +{ + if (EUSART_BaudrateGet(MY_USART) == baudrate) + { + // EUSART synced to baudrate already + return; + } + EUSART_BaudrateSet(MY_USART, 0, baudrate); +} + sl_status_t sl_wfx_host_spi_cs_assert() { // SILABS_LOG("%s started.", __func__); @@ -181,12 +192,7 @@ sl_status_t sl_wfx_host_spi_cs_assert() SILABS_LOG("%s errored.", __func__); return SL_STATUS_TIMEOUT; } - // if (spi_enabled) - // { - // SPIDRV_DeInit(SL_SPIDRV_HANDLE); - // SILABS_LOG("%s did deinit.", __func__); - // spi_enabled = false; - // } + if (!spi_enabled) // Reduce SPIDRV_Init { SPIDRV_Init(SL_SPIDRV_HANDLE, &sl_spidrv_eusart_init_exp);