From 4e4d1940791681ac3835decd0ed9148ac6f4b118 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 02f44f8a5c5aa3..b3471bb405eac2 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c +++ b/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c @@ -173,6 +173,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__); @@ -182,12 +193,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);