Skip to content

Commit

Permalink
Adds refactored includes and define macros
Browse files Browse the repository at this point in the history
  • Loading branch information
brosahay authored and rosahay-silabs committed Oct 5, 2023
1 parent 65820b0 commit 1a45c1d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 26 deletions.
32 changes: 20 additions & 12 deletions examples/platform/silabs/efr32/rs911x/hal/efx_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include "FreeRTOS.h"
#include "event_groups.h"
#include "semphr.h"
#include "task.h"

#include "btl_interface.h"
Expand All @@ -48,6 +49,10 @@
#include "wfx_host_events.h"
#include "wfx_rsi.h"

#if defined(SL_CATALOG_POWER_MANAGER_PRESENT)
#include "sl_power_manager.h"
#endif

#ifdef CHIP_9117
#include "cmsis_os2.h"
#include "sl_board_configuration.h"
Expand All @@ -57,10 +62,21 @@
#include "sl_wifi_callback_framework.h"
#include "sl_wifi_constants.h"
#include "sl_wifi_types.h"

// macro to drive semaphore block minimum timer in milli seconds
// ported from rsi_hal.h (rs911x)
#define RSI_SEM_BLOCK_MIN_TIMER_VALUE_MS (50)
#else
#include "rsi_board_configuration.h"
#include "rsi_driver.h"
#endif
#endif // CHIP_9117

#if SL_LCDCTRL_MUX
#include "sl_memlcd.h"
#endif // SL_LCDCTRL_MUX
#if SL_MX25CTRL_MUX
#include "sl_mx25_flash_shutdown_usart_config.h"
#endif // SL_MX25CTRL_MUX

#if defined(EFR32MG12)
#include "em_usart.h"
Expand All @@ -78,16 +94,6 @@

#endif // EFR32MG12 || EFR32MG24

#if SL_LCDCTRL_MUX
#include "sl_memlcd.h"
#endif // SL_LCDCTRL_MUX

// Macro to drive semaphore block minimum timer in milli seconds
#define RSI_SEM_BLOCK_MIN_TIMER_VALUE_MS (50)
#if defined(SL_CATALOG_POWER_MANAGER_PRESENT)
#include "sl_power_manager.h"
#endif

#define CONCAT(A, B) (A##B)
#define SPI_CLOCK(N) CONCAT(cmuClock_USART, N)

Expand Down Expand Up @@ -470,6 +476,7 @@ int16_t rsi_spi_transfer(uint8_t * tx_buf, uint8_t * rx_buf, uint16_t xlen, uint
return rsiError;
}

#ifdef CHIP_9117
/*********************************************************************
* @fn int16_t sl_si91x_host_spi_transfer(uint8_t *tx_buf, uint8_t *rx_buf, uint16_t xlen)
* @param[in] uint8_t *tx_buff, pointer to the buffer with the data to be transferred
Expand All @@ -483,4 +490,5 @@ int16_t rsi_spi_transfer(uint8_t * tx_buf, uint8_t * rx_buf, uint16_t xlen, uint
sl_status_t sl_si91x_host_spi_transfer(const void * tx_buf, void * rx_buf, uint16_t xlen)
{
return (rsi_spi_transfer((uint8_t *) tx_buf, rx_buf, xlen, RSI_MODE_8BIT));
}
}
#endif // CHIP_9117
15 changes: 1 addition & 14 deletions examples/platform/silabs/efr32/spi_multiplex.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,6 @@
#ifdef __cplusplus
extern "C" {
#endif
#include "FreeRTOS.h"
#include "semphr.h"
#if SL_LCDCTRL_MUX
#include "sl_memlcd_display.h"
#endif // SL_LCDCTRL_MUX
#if SL_MX25CTRL_MUX
#include "sl_mx25_flash_shutdown_usart_config.h"
#endif // SL_MX25CTRL_MUX

#include "spidrv.h"

#define SL_SPIDRV_LCD_BITRATE SL_MEMLCD_SCLK_FREQ
#define SL_SPIDRV_MX25_FLASH_BITRATE 16000000

#if SL_SPICTRL_MUX
/****************************************************************************
Expand Down Expand Up @@ -176,4 +163,4 @@ sl_status_t sl_wfx_host_post_uart_transfer(void);
#ifdef __cplusplus
}
#endif
#endif // SL_SPICTRL_MUX
#endif // SL_SPICTRL_MUX
9 changes: 9 additions & 0 deletions examples/platform/silabs/efr32/wf200/efr_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@
#include "sl_power_manager.h"
#endif

#if SL_LCDCTRL_MUX
#include "sl_memlcd_display.h"
#define SL_SPIDRV_LCD_BITRATE SL_MEMLCD_SCLK_FREQ
#endif // SL_LCDCTRL_MUX
#if SL_MX25CTRL_MUX
#include "sl_mx25_flash_shutdown_usart_config.h"
#define SL_SPIDRV_MX25_FLASH_BITRATE 16000000
#endif // SL_MX25CTRL_MUX

// TODO: (MATTER-1906) Investigate why using SL_SPIDRV_EXP_BITRATE is causing WF200 init failure
// REF: sl_spidrv_exp_config.h
#define SL_SPIDRV_EXP_BITRATE_MULTIPLEXED 10000000
Expand Down

0 comments on commit 1a45c1d

Please sign in to comment.