Skip to content

Commit

Permalink
Adds additional macro checks
Browse files Browse the repository at this point in the history
  • Loading branch information
rosahay-silabs committed Jun 21, 2023
1 parent 2f9275d commit 1027019
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
4 changes: 4 additions & 0 deletions examples/platform/silabs/efr32/spi_multiplex.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* limitations under the License.
*/

#if defined(EFR32MG24)

#include "dmadrv.h"
#include "em_bus.h"
#include "em_cmu.h"
Expand All @@ -41,3 +43,5 @@ void SPIDRV_ReInit(uint32_t baudrate)

USART_InitSync(USART0, &usartInit);
}

#endif /* EFR32MG24 */
12 changes: 7 additions & 5 deletions examples/platform/silabs/efr32/spi_multiplex.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,22 @@

#pragma once

#if defined(EFR32MG24)
#ifdef __cplusplus
extern "C" {
#endif
#include "FreeRTOS.h"
#include "semphr.h"
#include "sl_mx25_flash_shutdown_usart_config.h"
#ifdef WF200_WIFI
#if (defined(EFR32MG24) && defined(WF200_WIFI))
#include "sl_spidrv_exp_config.h"
#endif
#ifdef RS911X_WIFI
#endif /* EFR32MG24 && WF200_WIFI */
#if (defined(EFR32MG24) && defined(RS911X_WIFI))
#include "sl_spidrv_eusart_exp_config.h"
#endif
#endif /* EFR32MG24 && RS911X_WIFI */
#if (defined(EFR32MG24) && defined(WF200_WIFI))
#include "sl_wfx_host_api.h"
#endif
#endif /* EFR32MG24 && WF200_WIFI */
#include "em_eusart.h"
#include "spidrv.h"

Expand Down Expand Up @@ -161,3 +162,4 @@ void sl_wfx_host_post_uart_transfer(void);
#ifdef __cplusplus
}
#endif
#endif /* EFR32MG24 */
13 changes: 11 additions & 2 deletions examples/platform/silabs/efr32/wf200/efr_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@

#include "gpiointerrupt.h"

#include "sl_spidrv_exp_config.h"
#include "sl_wfx_board.h"
#include "sl_wfx_host.h"
#include "sl_wfx_task.h"
Expand All @@ -49,8 +48,14 @@
#include "sl_power_manager.h"
#endif

#if SL_WIFI
#if defined(EFR32MG12)
#include "sl_spidrv_exp_config.h"
extern SPIDRV_Handle_t sl_spidrv_exp_handle;
#define SL_SPIDRV_HANDLE sl_spidrv_exp_handle
#elif defined(EFR32MG24)
#include "spi_multiplex.h"
#else
#error "Unknown platform"
#endif

#define USART SL_WFX_HOST_PINOUT_SPI_PERIPHERAL
Expand Down Expand Up @@ -133,7 +138,9 @@ sl_status_t sl_wfx_host_spi_cs_assert()
{
return SL_STATUS_TIMEOUT;
}
#if defined(EFR32MG24)
SPIDRV_ReInit(SL_BIT_RATE_EXP_HDR);
#endif /* EFR32MG24 */
GPIO_PinOutClear(SL_SPIDRV_EXP_CS_PORT, SL_SPIDRV_EXP_CS_PIN);
return SL_STATUS_OK;
}
Expand Down Expand Up @@ -364,6 +371,7 @@ void sl_wfx_host_gpio_init(void)
NVIC_SetPriority(GPIO_ODD_IRQn, 5);
}

#if defined(EFR32MG24)
void sl_wfx_host_spiflash_cs_assert(void)
{
GPIO_PinOutClear(SL_MX25_FLASH_SHUTDOWN_CS_PORT, SL_MX25_FLASH_SHUTDOWN_CS_PIN);
Expand Down Expand Up @@ -440,3 +448,4 @@ void sl_wfx_host_post_uart_transfer(void)
sl_wfx_host_enable_platform_interrupt();
sl_wfx_enable_irq();
}
#endif /* EFR32MG24 */

0 comments on commit 1027019

Please sign in to comment.