diff --git a/Examples/MAX78002/SPI_ControllerTarget/main.c b/Examples/MAX78002/SPI_ControllerTarget/main.c index 99065478da..53e5d83e9a 100644 --- a/Examples/MAX78002/SPI_ControllerTarget/main.c +++ b/Examples/MAX78002/SPI_ControllerTarget/main.c @@ -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) @@ -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) @@ -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) {} diff --git a/Libraries/PeriphDrivers/Include/MAX78002/spi.h b/Libraries/PeriphDrivers/Include/MAX78002/spi.h index 3cf4d439a9..96421f20db 100644 --- a/Libraries/PeriphDrivers/Include/MAX78002/spi.h +++ b/Libraries/PeriphDrivers/Include/MAX78002/spi.h @@ -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. diff --git a/Libraries/PeriphDrivers/Source/SPI/spi_ai87.c b/Libraries/PeriphDrivers/Source/SPI/spi_ai87.c index 4a3320a78d..80c8590e4b 100644 --- a/Libraries/PeriphDrivers/Source/SPI/spi_ai87.c +++ b/Libraries/PeriphDrivers/Source/SPI/spi_ai87.c @@ -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; } diff --git a/Libraries/PeriphDrivers/Source/SPI/spi_ai87_v2.c b/Libraries/PeriphDrivers/Source/SPI/spi_ai87_v2.c index 11e612164e..3e81d1ed52 100644 --- a/Libraries/PeriphDrivers/Source/SPI/spi_ai87_v2.c +++ b/Libraries/PeriphDrivers/Source/SPI/spi_ai87_v2.c @@ -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; @@ -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) diff --git a/Libraries/PeriphDrivers/Source/SPI/spi_reva2.c b/Libraries/PeriphDrivers/Source/SPI/spi_reva2.c index 9513635fec..aabf1dad23 100644 --- a/Libraries/PeriphDrivers/Source/SPI/spi_reva2.c +++ b/Libraries/PeriphDrivers/Source/SPI/spi_reva2.c @@ -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; @@ -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; @@ -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: diff --git a/Libraries/PeriphDrivers/Source/SPI/spi_reva2.h b/Libraries/PeriphDrivers/Source/SPI/spi_reva2.h index 1209194435..b5de69f636 100644 --- a/Libraries/PeriphDrivers/Source/SPI/spi_reva2.h +++ b/Libraries/PeriphDrivers/Source/SPI/spi_reva2.h @@ -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); @@ -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);