/* Set the PWM frequency */ void Chip_SCTPWM_SetRate(LPC_SCT_T *pSCT, uint32_t freq) { uint32_t rate; rate = Chip_Clock_GetSystemClockRate() / freq;; /* Stop the SCT before configuration */ Chip_SCTPWM_Stop(pSCT); /* Set MATCH0 for max limit */ pSCT->REGMODE_U = 0; Chip_SCT_SetMatchCount(pSCT, SCT_MATCH_0, 0); Chip_SCT_SetMatchReload(pSCT, SCT_MATCH_0, rate); pSCT->EV[0].CTRL = 1 << 12; pSCT->EV[0].STATE = 1; /* Set SCT Counter to count 32-bits and reset to 0 after reaching MATCH0 */ Chip_SCT_Config(pSCT, SCT_CONFIG_32BIT_COUNTER | SCT_CONFIG_AUTOLIMIT_L); }
/** * @brief Stops the timer */ void SctStop(){ Chip_SCTPWM_Stop(LPC_SCT); }
/** * this function stops the SCT. * * @return status_ok if succeeded (otherwise check status.h for details). */ status_t PWM_Stop() { Chip_SCTPWM_Stop(PWM_SCT); return status_ok; }
/*Para el funcionamiento PWM*/ void ParadaPWM(void){ Chip_SCTPWM_Stop(LPC_SCT); }