Skip to content

Commit

Permalink
clang-format bot reformatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
sihyung-maxim committed Sep 26, 2023
1 parent e069cc9 commit 337407a
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 15 deletions.
8 changes: 4 additions & 4 deletions Examples/MAX78002/SPI_ControllerTarget/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ int main(void)
controller_pins.vddioh = false;

// This demonstrates how to set the Active Polarity for each TSn pin.
// This setting is passed into MXC_SPI_Init(...) and should match between
// This setting is passed into MXC_SPI_Init(...) and should match between
// the Controller and Target.
// ts_active_pol_mask[0] = 1 -> Active HIGH (1)
// ts_active_pol_mask[1] = 0 -> Active LOW (0)
Expand Down Expand Up @@ -258,7 +258,7 @@ int main(void)
target_pins.vddioh = false;

// This demonstrates how to set the Active Polarity for each TSn pin.
// This setting is passed into MXC_SPI_Init(...) and should match between
// This setting is passed into MXC_SPI_Init(...) and should match between
// the Controller and Target.
// ts_active_pol_mask[0] = 1 -> Active HIGH (1)
// ts_active_pol_mask[1] = 0 -> Active LOW (0)
Expand All @@ -278,8 +278,8 @@ int main(void)
target_cfg.use_dma_rx = false;
#endif

error = MXC_SPI_Init(SPI_TARGET, MXC_SPI_TYPE_TARGET, MXC_SPI_INTERFACE_STANDARD, 0, ts_active_pol_mask,
SPI_SPEED, target_pins);
error = MXC_SPI_Init(SPI_TARGET, MXC_SPI_TYPE_TARGET, MXC_SPI_INTERFACE_STANDARD, 0,
ts_active_pol_mask, SPI_SPEED, target_pins);
if (error != E_NO_ERROR) {
printf("\nSPI TARGET INITIALIZATION ERROR\n");
while (1) {}
Expand Down
3 changes: 2 additions & 1 deletion Libraries/PeriphDrivers/Include/MAX78002/spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,8 @@ int MXC_SPI_GetPeripheralClock(mxc_spi_regs_t *spi);
*
* @return Success/Fail, see \ref MXC_Error_Codes for a list of return codes.
*/
int MXC_SPI_SetTSControl(mxc_spi_regs_t *spi, mxc_spi_tscontrol_t ts_control, uint8_t ts_init_mask, uint8_t ts_active_pol_mask);
int MXC_SPI_SetTSControl(mxc_spi_regs_t *spi, mxc_spi_tscontrol_t ts_control, uint8_t ts_init_mask,
uint8_t ts_active_pol_mask);

/**
* @brief Set the frequency of the SPI interface.
Expand Down
3 changes: 2 additions & 1 deletion Libraries/PeriphDrivers/Source/SPI/spi_ai87.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,8 @@ int MXC_SPI_ConfigStruct(mxc_spi_cfg_t *cfg, bool use_dma_tx, bool use_dma_rx)
return E_NOT_SUPPORTED;
}

int MXC_SPI_SetTSControl(mxc_spi_regs_t *spi, mxc_spi_tscontrol_t ts_control, uint8_t ts_init_mask, uint8_t ts_active_pol_mask)
int MXC_SPI_SetTSControl(mxc_spi_regs_t *spi, mxc_spi_tscontrol_t ts_control, uint8_t ts_init_mask,
uint8_t ts_active_pol_mask)
{
return E_NOT_SUPPORTED;
}
Expand Down
10 changes: 7 additions & 3 deletions Libraries/PeriphDrivers/Source/SPI/spi_ai87_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ int MXC_SPI_Init(mxc_spi_regs_t *spi, mxc_spi_type_t controller_target, mxc_spi_

// Create mask based on true/false conditions of mxc_spi_pins_t parameter.
// Shortened function length.
ts_init_mask = (pins.ts0 ? 1 << MXC_SPI_TS0_MASK_POS : 0) | (pins.ts1 ? 1 << MXC_SPI_TS1_MASK_POS : 0) | (pins.ts2 ? 1 << MXC_SPI_TS2_MASK_POS : 0);
ts_init_mask = (pins.ts0 ? 1 << MXC_SPI_TS0_MASK_POS : 0) |
(pins.ts1 ? 1 << MXC_SPI_TS1_MASK_POS : 0) |
(pins.ts2 ? 1 << MXC_SPI_TS2_MASK_POS : 0);
} else {
ts_control = MXC_SPI_TSCONTROL_SW_APP;

Expand Down Expand Up @@ -346,9 +348,11 @@ int MXC_SPI_GetPeripheralClock(mxc_spi_regs_t *spi)
return retval;
}

int MXC_SPI_SetTSControl(mxc_spi_regs_t *spi, mxc_spi_tscontrol_t ts_control, uint8_t ts_init_mask, uint8_t ts_active_pol_mask)
int MXC_SPI_SetTSControl(mxc_spi_regs_t *spi, mxc_spi_tscontrol_t ts_control, uint8_t ts_init_mask,
uint8_t ts_active_pol_mask)
{
return MXC_SPI_RevA2_SetTSControl((mxc_spi_reva_regs_t *)spi, ts_control, ts_init_mask, ts_active_pol_mask);
return MXC_SPI_RevA2_SetTSControl((mxc_spi_reva_regs_t *)spi, ts_control, ts_init_mask,
ts_active_pol_mask);
}

mxc_spi_tscontrol_t MXC_SPI_GetTSControl(mxc_spi_regs_t *spi)
Expand Down
12 changes: 8 additions & 4 deletions Libraries/PeriphDrivers/Source/SPI/spi_reva2.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,8 @@ static void MXC_SPI_RevA2_resetStateStruct(int8_t spi_num)

/* **** Public Functions **** */

int MXC_SPI_RevA2_Init(mxc_spi_reva_regs_t *spi, mxc_spi_type_t controller_target, mxc_spi_interface_t if_mode, uint32_t freq)
int MXC_SPI_RevA2_Init(mxc_spi_reva_regs_t *spi, mxc_spi_type_t controller_target,
mxc_spi_interface_t if_mode, uint32_t freq)
{
int error;
int8_t spi_num;
Expand Down Expand Up @@ -535,7 +536,8 @@ void MXC_SPI_RevA2_DisableInt(mxc_spi_reva_regs_t *spi, uint32_t dis)
spi->inten &= ~(dis);
}

int MXC_SPI_RevA2_SetTSControl(mxc_spi_reva_regs_t *spi, mxc_spi_tscontrol_t ts_control, uint8_t ts_init_mask, uint8_t ts_active_pol_mask)
int MXC_SPI_RevA2_SetTSControl(mxc_spi_reva_regs_t *spi, mxc_spi_tscontrol_t ts_control,
uint8_t ts_init_mask, uint8_t ts_active_pol_mask)
{
int8_t spi_num;

Expand All @@ -553,8 +555,10 @@ int MXC_SPI_RevA2_SetTSControl(mxc_spi_reva_regs_t *spi, mxc_spi_tscontrol_t ts_

switch (ts_control) {
case MXC_SPI_TSCONTROL_HW_AUTO:
MXC_SETFIELD(spi->ctrl0, MXC_F_SPI_REVA_CTRL0_SS_ACTIVE, (ts_init_mask << MXC_F_SPI_REVA_CTRL0_SS_ACTIVE_POS));
MXC_SETFIELD(spi->ctrl2, MXC_F_SPI_REVA_CTRL2_SS_POL, (ts_active_pol_mask << MXC_F_SPI_REVA_CTRL2_SS_POL_POS));
MXC_SETFIELD(spi->ctrl0, MXC_F_SPI_REVA_CTRL0_SS_ACTIVE,
(ts_init_mask << MXC_F_SPI_REVA_CTRL0_SS_ACTIVE_POS));
MXC_SETFIELD(spi->ctrl2, MXC_F_SPI_REVA_CTRL2_SS_POL,
(ts_active_pol_mask << MXC_F_SPI_REVA_CTRL2_SS_POL_POS));
break;

case MXC_SPI_TSCONTROL_SW_DRV:
Expand Down
6 changes: 4 additions & 2 deletions Libraries/PeriphDrivers/Source/SPI/spi_reva2.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ extern "C" {

/* **** Functions **** */

int MXC_SPI_RevA2_Init(mxc_spi_reva_regs_t *spi, mxc_spi_type_t controller_target, mxc_spi_interface_t if_mode, uint32_t freq);
int MXC_SPI_RevA2_Init(mxc_spi_reva_regs_t *spi, mxc_spi_type_t controller_target,
mxc_spi_interface_t if_mode, uint32_t freq);

int MXC_SPI_RevA2_Config(mxc_spi_cfg_t *cfg);

Expand All @@ -68,7 +69,8 @@ void MXC_SPI_RevA2_EnableInt(mxc_spi_reva_regs_t *spi, uint32_t en);

void MXC_SPI_RevA2_DisableInt(mxc_spi_reva_regs_t *spi, uint32_t dis);

int MXC_SPI_RevA2_SetTSControl(mxc_spi_reva_regs_t *spi, mxc_spi_tscontrol_t ts_control, uint8_t ts_init_mask, uint8_t ts_active_pol_mask);
int MXC_SPI_RevA2_SetTSControl(mxc_spi_reva_regs_t *spi, mxc_spi_tscontrol_t ts_control,
uint8_t ts_init_mask, uint8_t ts_active_pol_mask);

mxc_spi_tscontrol_t MXC_SPI_RevA2_GetTSControl(mxc_spi_reva_regs_t *spi);

Expand Down

0 comments on commit 337407a

Please sign in to comment.