Skip to content

Commit

Permalink
fixing the build for the custom boards on ncp
Browse files Browse the repository at this point in the history
  • Loading branch information
chirag-silabs committed Aug 20, 2024
1 parent bb26a58 commit 1118284
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 21 deletions.
3 changes: 3 additions & 0 deletions examples/platform/silabs/efr32/rs911x/hal/efx32_ncp_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@
#include "sl_power_manager.h"
#endif

#ifdef SL_BOARD_NAME
#include "sl_board_control.h"
#endif // SL_BOARD_NAME

#include "sl_si91x_ncp_utility.h"
#include "spi_multiplex.h"

Expand Down
17 changes: 4 additions & 13 deletions examples/platform/silabs/efr32/rs911x/hal/efx_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include "em_gpio.h"
#include "em_ldma.h"
#include "gpiointerrupt.h"
#include "sl_board_control.h"
#include "sl_device_init_clocks.h"
#include "sl_device_init_hfxo.h"
#include "sl_spidrv_instances.h"
Expand All @@ -47,6 +46,10 @@
#include "wfx_host_events.h"
#include "wfx_rsi.h"

#ifdef SL_BOARD_NAME
#include "sl_board_control.h"
#endif // SL_BOARD_NAME

#if defined(SL_CATALOG_POWER_MANAGER_PRESENT)
#include "sl_power_manager.h"
#endif
Expand All @@ -65,18 +68,12 @@
#include "sl_mx25_flash_shutdown_usart_config.h"
#endif // SL_MX25CTRL_MUX

#if defined(EFR32MG24)
#include "em_eusart.h"
#include "sl_spidrv_eusart_exp_config.h"
#include "spi_multiplex.h"
#else
#error "Unknown platform"
#endif

#if defined(EFR32MG24)
#define SL_SPIDRV_HANDLE sl_spidrv_eusart_exp_handle
#define SL_SPIDRV_EXP_BITRATE_MULTIPLEXED SL_SPIDRV_EUSART_EXP_BITRATE
#endif

#define CONCAT(A, B) (A##B)
#define SPI_CLOCK(N) CONCAT(cmuClock_USART, N)
Expand Down Expand Up @@ -113,10 +110,8 @@ void sl_wfx_host_gpio_init(void)
// Enable GPIO clock.
CMU_ClockEnable(cmuClock_GPIO, true);

#if defined(EFR32MG24)
// Set CS pin to high/inactive
GPIO_PinModeSet(SL_SPIDRV_EUSART_EXP_CS_PORT, SL_SPIDRV_EUSART_EXP_CS_PIN, gpioModePushPull, PINOUT_SET);
#endif // EFR32MG24

GPIO_PinModeSet(WFX_RESET_PIN.port, WFX_RESET_PIN.pin, gpioModePushPull, PINOUT_SET);
GPIO_PinModeSet(WFX_SLEEP_CONFIRM_PIN.port, WFX_SLEEP_CONFIRM_PIN.pin, gpioModePushPull, PINOUT_CLEAR);
Expand Down Expand Up @@ -195,9 +190,7 @@ sl_status_t sl_wfx_host_spi_cs_assert(void)
if (!spi_enabled) // Reduce sl_spidrv_init_instances
{
sl_spidrv_init_instances();
#if defined(EFR32MG24)
GPIO_PinOutClear(SL_SPIDRV_EUSART_EXP_CS_PORT, SL_SPIDRV_EUSART_EXP_CS_PIN);
#endif // EFR32MG24
spi_enabled = true;
}
return SL_STATUS_OK;
Expand All @@ -211,10 +204,8 @@ sl_status_t sl_wfx_host_spi_cs_deassert(void)
status = SPIDRV_DeInit(SL_SPIDRV_HANDLE);
if (SL_STATUS_OK == status)
{
#if defined(EFR32MG24)
GPIO_PinOutSet(SL_SPIDRV_EUSART_EXP_CS_PORT, SL_SPIDRV_EUSART_EXP_CS_PIN);
GPIO->EUSARTROUTE[SL_SPIDRV_EUSART_EXP_PERIPHERAL_NO].ROUTEEN = PINOUT_CLEAR;
#endif // EFR32MG24
spi_enabled = false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ typedef struct
#elif defined(EFR32MG24_BRD4187C) || defined(BRD4187C)
#include "brd4187c.h"
#else
#error "Need SPI Pins"
#include "sl_custom_board.h"
#warning "SPIDRV USART peripheral not configured correctly"
#endif /* EFR32MG24_BRD4186C */

#endif /* _RSI_BOARD_CONFIGURATION_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ typedef struct
#elif defined(EFR32MG24_BRD4187C) || defined(BRD4187C)
#include "brd4187c.h"
#else
#error "Need SPI Pins"
#include "sl_custom_board.h"
#warning "SPIDRV USART peripheral not configured correctly"
#endif
#if EXP_BOARD
#define RESET_PIN PIN(A, 6)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
#include "spidrv.h"
#include "task.h"

#ifdef SL_BOARD_NAME
#include "sl_board_control.h"
#endif // SL_BOARD_NAME

#include "sl_device_init_clocks.h"
#include "sl_device_init_hfxo.h"
Expand Down
5 changes: 0 additions & 5 deletions examples/platform/silabs/efr32/wf200/efr_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,9 @@ sl_status_t sl_wfx_host_init_bus(void)
* EUSARTROUTE register to do this.
*/

#if defined(EFR32MG24)
GPIO->USARTROUTE[0].ROUTEEN = GPIO_USART_ROUTEEN_RXPEN | // MISO
GPIO_USART_ROUTEEN_TXPEN | // MOSI
GPIO_USART_ROUTEEN_CLKPEN;
#endif

spi_sem = xSemaphoreCreateBinaryStatic(&xEfrSpiSemaBuffer);
xSemaphoreGive(spi_sem);
Expand Down Expand Up @@ -338,11 +336,8 @@ void sl_wfx_host_gpio_init(void)
{
// Enable GPIO clock.
CMU_ClockEnable(cmuClock_GPIO, true);

#if defined(EFR32MG24)
// configure WF200 CS pin.
GPIO_PinModeSet(SL_SPIDRV_EXP_CS_PORT, SL_SPIDRV_EXP_CS_PIN, gpioModePushPull, 1);
#endif
// Configure WF200 reset pin.
GPIO_PinModeSet(SL_WFX_HOST_PINOUT_RESET_PORT, SL_WFX_HOST_PINOUT_RESET_PIN, gpioModePushPull, 0);
// Configure WF200 WUP pin.
Expand Down
3 changes: 2 additions & 1 deletion examples/platform/silabs/efr32/wf200/sl_wfx_board.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#elif defined(EFR32MG24_BRD4187C) || defined(BRD4187C) || defined(EFR32MG24_BRD4187A) || defined(BRD4187A)
#include "brd4187c.h"
#else
#error "Need SPI Pins"
#include "sl_custom_board.h"
#warning "SPIDRV USART peripheral not configured correctly"
#endif
#endif /* _SL_WFX_BOARD_H_ */

0 comments on commit 1118284

Please sign in to comment.