/* Enable PWM1 clock source */
CLK_EnableModuleClock(PWM1_MODULE);
/* Select PWM module clock source */
//CLK_SetModuleClock(PWM0_MODULE, CLK_CLKSEL3_PWM0_S_HClK, 0);
CLK_SetModuleClock(PWM1_MODULE, CLK_CLKSEL3_PWM1_S_PCLK, 0);
/* Reset PWM0 */
SYS_ResetModule(PWM1_RST);
/* Update System Core Clock */
/* User can use SystemCoreClockUpdate() to calculate PllClock, SystemCoreClock and CycylesPerUs automatically. */
//SystemCoreClockUpdate();
PllClock = PLL_CLOCK; // PLL
SystemCoreClock = PLL_CLOCK / 1; // HCLK
CyclesPerUs = PLL_CLOCK / 1000000; // For SYS_SysTickDelay()
/* Set GPA multi-function pins for PWM1 Channel 2 */
SYS->GPA_MFP &= ~(SYS_GPA_MFP_PA10_Msk);
SYS->GPA_MFP |= (SYS_GPA_MFP_PA10_PWM1_CH2);
/* Set GPA multi-function pins for PWM1 Channel 5 */
SYS->GPF_MFP &= ~(SYS_GPF_MFP_PF5_Msk);
SYS->GPF_MFP |= (SYS_GPF_MFP_PF5_PWM1_CH5);
SYS->ALT_MFP3 |= SYS_ALT_MFP3_PA10_PWM1_CH2;
SYS->ALT_MFP3 |= SYS_ALT_MFP3_PF5_PWM1_CH5;
|