Skip to content

Commit

Permalink
Restyled by clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits authored and thashok committed Dec 12, 2022
1 parent 0b3e99b commit 282be26
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 52 deletions.
24 changes: 12 additions & 12 deletions examples/platform/silabs/efr32/display/demo-ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,26 +108,26 @@ void demoUIDisplayHeader(char * name)
{
GLIB_drawStringOnLine(&glibContext, name, 5, GLIB_ALIGN_CENTER, 0, 0, true);
}
#if (defined(EFR32MG24) && defined(WF200_WIFI))
#if (defined(EFR32MG24) && defined(WF200_WIFI))
pre_lcd_spi_transfer();
#endif
#endif
DMD_updateDisplay();
#if (defined(EFR32MG24) && defined(WF200_WIFI))
#if (defined(EFR32MG24) && defined(WF200_WIFI))
post_lcd_spi_transfer();
#endif
#endif
}

void demoUIDisplayApp(bool on)
{
GLIB_drawBitmap(&glibContext, APP_X_POSITION, APP_Y_POSITION, APP_BITMAP_WIDTH, APP_BITMAP_HEIGHT,
(on ? OnStateBitMap : OffStateBitMap));
#if (defined(EFR32MG24) && defined(WF200_WIFI))
#if (defined(EFR32MG24) && defined(WF200_WIFI))
pre_lcd_spi_transfer();
#endif
#endif
DMD_updateDisplay();
#if (defined(EFR32MG24) && defined(WF200_WIFI))
#if (defined(EFR32MG24) && defined(WF200_WIFI))
post_lcd_spi_transfer();
#endif
#endif
}

void demoUIDisplayProtocol(demoUIProtocol protocol, bool isConnected)
Expand All @@ -138,13 +138,13 @@ void demoUIDisplayProtocol(demoUIProtocol protocol, bool isConnected)
(protocol == DEMO_UI_PROTOCOL1 ? PROT1_BITMAP_HEIGHT : PROT2_BITMAP_HEIGHT),
(protocol == DEMO_UI_PROTOCOL1 ? (isConnected ? PROT1_BITMAP_CONN : PROT1_BITMAP)
: (isConnected ? PROT2_BITMAP_CONN : PROT2_BITMAP)));
#if (defined(EFR32MG24) && defined(WF200_WIFI))
#if (defined(EFR32MG24) && defined(WF200_WIFI))
pre_lcd_spi_transfer();
#endif
#endif
DMD_updateDisplay();
#if (defined(EFR32MG24) && defined(WF200_WIFI))
#if (defined(EFR32MG24) && defined(WF200_WIFI))
post_lcd_spi_transfer();
#endif
#endif
}

void demoUIClearMainScreen(uint8_t * name)
Expand Down
18 changes: 9 additions & 9 deletions examples/platform/silabs/efr32/display/lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ CHIP_ERROR SilabsLCD::Init(uint8_t * name, bool initialState)
}

#if (defined(EFR32MG24) && defined(WF200_WIFI))
if(pr_type != LCD)
if (pr_type != LCD)
{
pr_type = LCD;
}
Expand Down Expand Up @@ -127,13 +127,13 @@ int SilabsLCD::DrawPixel(void * pContext, int32_t x, int32_t y)
int SilabsLCD::Update(void)
{
int status;
#if (defined(EFR32MG24) && defined(WF200_WIFI))
#if (defined(EFR32MG24) && defined(WF200_WIFI))
pre_lcd_spi_transfer();
#endif
#endif
status = DMD_updateDisplay();
#if (defined(EFR32MG24) && defined(WF200_WIFI))
#if (defined(EFR32MG24) && defined(WF200_WIFI))
post_lcd_spi_transfer();
#endif
#endif
/*
* TO-DO; Above logic can be optimised by writing a common API
*/
Expand Down Expand Up @@ -200,14 +200,14 @@ void SilabsLCD::WriteQRCode()
}
}
}
#if (defined(EFR32MG24) && defined(WF200_WIFI))
#if (defined(EFR32MG24) && defined(WF200_WIFI))
pre_lcd_spi_transfer();
#endif
#endif

DMD_updateDisplay();
#if (defined(EFR32MG24) && defined(WF200_WIFI))
#if (defined(EFR32MG24) && defined(WF200_WIFI))
post_lcd_spi_transfer();
#endif
#endif
}

void SilabsLCD::SetQRCode(uint8_t * str, uint32_t size)
Expand Down
12 changes: 6 additions & 6 deletions examples/platform/silabs/efr32/spi_multiplex.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
* limitations under the License.
*/

#include "spi_multiplex.h"
#include "dmadrv.h"
#include "em_bus.h"
#include "em_cmu.h"
#include "em_gpio.h"
#include "em_ldma.h"
#include "em_usart.h"
#include "spi_multiplex.h"

/****************************************************************************
* @fn void spi_drv_reinit()
Expand Down Expand Up @@ -61,7 +61,7 @@ void set_spi_baudrate(peripheraltype_t pr_type)
{
spi_drv_reinit(EXP_HDR_BIT_RATE);
}
else if(pr_type == EXT_SPIFLASH)
else if (pr_type == EXT_SPIFLASH)
{
spi_drv_reinit(SPI_FLASH_BIT_RATE);
}
Expand All @@ -74,7 +74,7 @@ void set_spi_baudrate(peripheraltype_t pr_type)
* @param[in] None
* @return returns void
*****************************************************************************/
void spiflash_cs_assert(void)
void spiflash_cs_assert(void)
{
GPIO_PinOutClear(SL_MX25_FLASH_SHUTDOWN_CS_PORT, SL_MX25_FLASH_SHUTDOWN_CS_PIN);
}
Expand Down Expand Up @@ -102,7 +102,7 @@ void pre_bootloader_spi_transfer(void)
{
if (xSemaphoreTake(spi_sem_sync_hdl, portMAX_DELAY) != pdTRUE)
{
return ;
return;
}
/*
* CS for Expansion header controlled within GSDK,
Expand Down Expand Up @@ -142,9 +142,9 @@ void pre_lcd_spi_transfer(void)
{
if (xSemaphoreTake(spi_sem_sync_hdl, portMAX_DELAY) != pdTRUE)
{
return ;
return;
}
if(pr_type != LCD)
if (pr_type != LCD)
{
pr_type = LCD;
set_spi_baudrate(pr_type);
Expand Down
23 changes: 12 additions & 11 deletions examples/platform/silabs/efr32/spi_multiplex.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
#ifdef __cplusplus
extern "C" {
#endif
#include "sl_spidrv_exp_config.h"
#include "sl_mx25_flash_shutdown_usart_config.h"
#include "sl_wfx_host_api.h"
#include "FreeRTOS.h"
#include "semphr.h"
#include "sl_mx25_flash_shutdown_usart_config.h"
#include "sl_spidrv_exp_config.h"
#include "sl_wfx_host_api.h"

#define LCD_BIT_RATE 1100000
#define EXP_HDR_BIT_RATE 16000000
#define SPI_FLASH_BIT_RATE 16000000
#define LCD_BIT_RATE 1100000
#define EXP_HDR_BIT_RATE 16000000
#define SPI_FLASH_BIT_RATE 16000000

typedef enum PERIPHERAL_TYPE {
EXP_HDR =0,
LCD ,
EXT_SPIFLASH ,
}peripheraltype_t;
typedef enum PERIPHERAL_TYPE
{
EXP_HDR = 0,
LCD,
EXT_SPIFLASH,
} peripheraltype_t;

extern SemaphoreHandle_t spi_sem_sync_hdl;
extern peripheraltype_t pr_type;
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/efr32/wf200/efr_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ sl_status_t sl_wfx_host_spi_transfer_no_cs_assert(sl_wfx_host_bus_transfer_type_
{
sl_status_t result = SL_STATUS_FAIL;
#if defined(EFR32MG24)
if(pr_type != EXP_HDR)
if (pr_type != EXP_HDR)
{
pr_type = EXP_HDR;
set_spi_baudrate(pr_type);
Expand Down
26 changes: 13 additions & 13 deletions src/platform/silabs/EFR32/OTAImageProcessorImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ extern "C" {
#include "btl_interface.h"
#include "em_bus.h" // For CORE_CRITICAL_SECTION
#if (defined(EFR32MG24) && defined(WF200_WIFI))
#include "spi_multiplex.h"
#include "sl_wfx_host_api.h"
#include "spi_multiplex.h"
#endif
}

Expand Down Expand Up @@ -166,13 +166,13 @@ void OTAImageProcessorImpl::HandleFinalize(intptr_t context)
writeBuffer[writeBufOffset] = 0;
writeBufOffset++;
}
#if (defined(EFR32MG24) && defined(WF200_WIFI))
#if (defined(EFR32MG24) && defined(WF200_WIFI))
pre_bootloader_spi_transfer();
#endif
#endif
CORE_CRITICAL_SECTION(err = bootloader_eraseWriteStorage(mSlotId, mWriteOffset, writeBuffer, kAlignmentBytes);)
#if (defined(EFR32MG24) && defined(WF200_WIFI))
#if (defined(EFR32MG24) && defined(WF200_WIFI))
post_bootloader_spi_transfer();
#endif
#endif
if (err)
{
ChipLogError(SoftwareUpdate, "ERROR: In HandleFinalize bootloader_eraseWriteStorage() error %ld", err);
Expand All @@ -194,9 +194,9 @@ void OTAImageProcessorImpl::HandleApply(intptr_t context)

// Force KVS to store pending keys such as data from StoreCurrentUpdateInfo()
chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().ForceKeyMapSave();
#if (defined(EFR32MG24) && defined(WF200_WIFI))
#if (defined(EFR32MG24) && defined(WF200_WIFI))
pre_bootloader_spi_transfer();
#endif
#endif
CORE_CRITICAL_SECTION(err = bootloader_verifyImage(mSlotId, NULL);)
if (err != SL_BOOTLOADER_OK)
{
Expand All @@ -215,9 +215,9 @@ void OTAImageProcessorImpl::HandleApply(intptr_t context)

// This reboots the device
CORE_CRITICAL_SECTION(bootloader_rebootAndInstall();)
#if (defined(EFR32MG24) && defined(WF200_WIFI))
#if (defined(EFR32MG24) && defined(WF200_WIFI))
xSemaphoreGive(spi_sem_sync_hdl);
#endif
#endif
}

void OTAImageProcessorImpl::HandleAbort(intptr_t context)
Expand Down Expand Up @@ -268,13 +268,13 @@ void OTAImageProcessorImpl::HandleProcessBlock(intptr_t context)
if (writeBufOffset == kAlignmentBytes)
{
writeBufOffset = 0;
#if (defined(EFR32MG24) && defined(WF200_WIFI))
#if (defined(EFR32MG24) && defined(WF200_WIFI))
pre_bootloader_spi_transfer();
#endif
#endif
CORE_CRITICAL_SECTION(err = bootloader_eraseWriteStorage(mSlotId, mWriteOffset, writeBuffer, kAlignmentBytes);)
#if (defined(EFR32MG24) && defined(WF200_WIFI))
#if (defined(EFR32MG24) && defined(WF200_WIFI))
post_bootloader_spi_transfer();
#endif
#endif
if (err)
{
ChipLogError(SoftwareUpdate, "ERROR: In HandleProcessBlock bootloader_eraseWriteStorage() error %ld", err);
Expand Down

0 comments on commit 282be26

Please sign in to comment.