NUC472_NUC442_BSP V3.03.004
The Board Support Package for NUC472/NUC442
Macros | Functions
Collaboration diagram for EPWM Exported Functions:

Macros

#define EPWM_ENABLE_COMPLEMENTARY_MODE(pwm)
 This macro enable complementary mode. More...
 
#define EPWM_DISABLE_COMPLEMENTARY_MODE(pwm)
 This macro disable complementary mode, and enable independent mode. More...
 
#define EPWM_ENABLE_GROUP_MODE(pwm)
 This macro enable group mode. More...
 
#define EPWM_DISABLE_GROUP_MODE(pwm)
 This macro disable group mode. More...
 
#define EPWM_ENABLE_SYNC_MODE(pwm)
 This macro enable synchronous mode. More...
 
#define EPWM_DISABLE_SYNC_MODE(pwm)
 This macro disable synchronous mode, and enable independent mode. More...
 
#define EPWM_ENABLE_OUTPUT_INVERTER(pwm, u32ChannelMask)
 This macro enable output inverter of specified channel(s) More...
 
#define EPWM_MASK_OUTPUT(pwm, u32ChannelMask, u32LevelMask)
 This macro mask output output logic to high or low. More...
 
#define EPWM_SET_DIVIDER(pwm, u32ChannelNum, u32Divider)
 This macro set the divider of the selected channel. More...
 
#define EPWM_SET_CMR(pwm, u32ChannelNum, u32CMR)
 This macro set the duty of the selected channel. More...
 
#define EPWM_SET_CNR(pwm, u32ChannelNum, u32CNR)
 This macro set the period of the selected channel. More...
 
#define EPWM_SET_ALIGNED_TYPE(pwm, u32ChannelMask, u32AlignedType)
 This macro set the PWM aligned type. More...
 

Functions

uint32_t EPWM_ConfigOutputChannel (EPWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Frequency, uint32_t u32DutyCycle)
 This function config PWM generator and get the nearest frequency in edge aligned auto-reload mode. More...
 
void EPWM_Start (EPWM_T *pwm, uint32_t u32ChannelMask)
 This function start PWM module. More...
 
void EPWM_Stop (EPWM_T *pwm, uint32_t u32ChannelMask)
 This function stop PWM module. More...
 
void EPWM_ForceStop (EPWM_T *pwm, uint32_t u32ChannelMask)
 This function stop PWM generation immediately by clear channel enable bit. More...
 
void EPWM_EnableFaultBrake (EPWM_T *pwm, uint32_t u32ChannelMask, uint32_t u32LevelMask, uint32_t u32BrakeSource)
 This function enable fault brake of selected channels. More...
 
void EPWM_ClearFaultBrakeFlag (EPWM_T *pwm, uint32_t u32BrakeSource)
 This function clear fault brake flag. More...
 
void EPWM_EnableOutput (EPWM_T *pwm, uint32_t u32ChannelMask)
 This function enables PWM output generation of selected channels. More...
 
void EPWM_DisableOutput (EPWM_T *pwm, uint32_t u32ChannelMask)
 This function disables PWM output generation of selected channels. More...
 
void EPWM_EnableDeadZone (EPWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Duration)
 This function enable Dead zone of selected channel. More...
 
void EPWM_DisableDeadZone (EPWM_T *pwm, uint32_t u32ChannelNum)
 This function disable Dead zone of selected channel. More...
 
void EPWM_EnableDutyInt (EPWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32IntDutyType)
 This function enable duty interrupt of selected channel. More...
 
void EPWM_DisableDutyInt (EPWM_T *pwm, uint32_t u32ChannelNum)
 This function disable duty interrupt of selected channel. More...
 
void EPWM_ClearDutyIntFlag (EPWM_T *pwm, uint32_t u32ChannelNum)
 This function clears duty interrupt flag of selected channel. More...
 
uint32_t EPWM_GetDutyIntFlag (EPWM_T *pwm, uint32_t u32ChannelNum)
 This function get duty interrupt flag of selected channel. More...
 
void EPWM_EnableFaultBrakeInt (EPWM_T *pwm, uint32_t u32BrakeSource)
 This function enable fault brake interrupt. More...
 
void EPWM_DisableFaultBrakeInt (EPWM_T *pwm, uint32_t u32BrakeSource)
 This function disable fault brake interrupt. More...
 
void EPWM_ClearFaultBrakeIntFlag (EPWM_T *pwm, uint32_t u32BrakeSource)
 This function clear fault brake interrupt of selected source. More...
 
uint32_t EPWM_GetFaultBrakeIntFlag (EPWM_T *pwm, uint32_t u32BrakeSource)
 This function get fault brake interrupt of selected source. More...
 
void EPWM_EnablePeriodInt (EPWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32IntPeriodType)
 This function enable period interrupt of selected channel. More...
 
void EPWM_DisablePeriodInt (EPWM_T *pwm, uint32_t u32ChannelNum)
 This function disable period interrupt of selected channel. More...
 
void EPWM_ClearPeriodIntFlag (EPWM_T *pwm, uint32_t u32ChannelNum)
 This function clear period interrupt of selected channel. More...
 
uint32_t EPWM_GetPeriodIntFlag (EPWM_T *pwm, uint32_t u32ChannelNum)
 This function get period interrupt of selected channel. More...
 

Detailed Description

Macro Definition Documentation

◆ EPWM_DISABLE_COMPLEMENTARY_MODE

#define EPWM_DISABLE_COMPLEMENTARY_MODE (   pwm)

This macro disable complementary mode, and enable independent mode.

Parameters
[in]pwmThe base address of PWM module
Returns
None

Definition at line 88 of file epwm.h.

◆ EPWM_DISABLE_GROUP_MODE

#define EPWM_DISABLE_GROUP_MODE (   pwm)

This macro disable group mode.

Parameters
[in]pwmThe base address of PWM module
Returns
None

Definition at line 104 of file epwm.h.

◆ EPWM_DISABLE_SYNC_MODE

#define EPWM_DISABLE_SYNC_MODE (   pwm)

This macro disable synchronous mode, and enable independent mode.

Parameters
[in]pwmThe base address of PWM module
Returns
None

Definition at line 120 of file epwm.h.

◆ EPWM_ENABLE_COMPLEMENTARY_MODE

#define EPWM_ENABLE_COMPLEMENTARY_MODE (   pwm)

This macro enable complementary mode.

Parameters
[in]pwmThe base address of PWM module
Returns
None

Definition at line 80 of file epwm.h.

◆ EPWM_ENABLE_GROUP_MODE

#define EPWM_ENABLE_GROUP_MODE (   pwm)

This macro enable group mode.

Parameters
[in]pwmThe base address of PWM module
Returns
None

Definition at line 96 of file epwm.h.

◆ EPWM_ENABLE_OUTPUT_INVERTER

#define EPWM_ENABLE_OUTPUT_INVERTER (   pwm,
  u32ChannelMask 
)

This macro enable output inverter of specified channel(s)

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelMaskCombination of enabled channels. Each bit corresponds to a channel Bit 0 represents channel 0, bit 1 represents channel 1...
Returns
None

Definition at line 130 of file epwm.h.

◆ EPWM_ENABLE_SYNC_MODE

#define EPWM_ENABLE_SYNC_MODE (   pwm)

This macro enable synchronous mode.

Parameters
[in]pwmThe base address of PWM module
Returns
None

Definition at line 112 of file epwm.h.

◆ EPWM_MASK_OUTPUT

#define EPWM_MASK_OUTPUT (   pwm,
  u32ChannelMask,
  u32LevelMask 
)

This macro mask output output logic to high or low.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelMaskCombination of enabled channels. Each bit corresponds to a channel Bit 0 represents channel 0, bit 1 represents channel 1...
[in]u32LevelMaskOutput logic to high or low
Returns
None

Definition at line 147 of file epwm.h.

◆ EPWM_SET_ALIGNED_TYPE

#define EPWM_SET_ALIGNED_TYPE (   pwm,
  u32ChannelMask,
  u32AlignedType 
)

This macro set the PWM aligned type.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelMaskThis parameter is not used
[in]u32AlignedTypePWM aligned type, valid values are:
Returns
None

Definition at line 209 of file epwm.h.

◆ EPWM_SET_CMR

#define EPWM_SET_CMR (   pwm,
  u32ChannelNum,
  u32CMR 
)

This macro set the duty of the selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
[in]u32CMRDuty of specified channel. Valid values are between 0~0xFFFF
Returns
None
Note
This new setting will take effect on next PWM period

Definition at line 177 of file epwm.h.

◆ EPWM_SET_CNR

#define EPWM_SET_CNR (   pwm,
  u32ChannelNum,
  u32CNR 
)

This macro set the period of the selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
[in]u32CNRPeriod of specified channel. Valid values are between 0~0xFFFF
Returns
None
Note
This new setting will take effect on next PWM period
PWM counter will stop if period length set to 0

Definition at line 193 of file epwm.h.

◆ EPWM_SET_DIVIDER

#define EPWM_SET_DIVIDER (   pwm,
  u32ChannelNum,
  u32Divider 
)

This macro set the divider of the selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
[in]u32DividerClock divider of specified channel. Valid values are
Returns
None

Definition at line 165 of file epwm.h.

Function Documentation

◆ EPWM_ClearDutyIntFlag()

void EPWM_ClearDutyIntFlag ( EPWM_T pwm,
uint32_t  u32ChannelNum 
)

This function clears duty interrupt flag of selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
Returns
None

Definition at line 278 of file epwm.c.

◆ EPWM_ClearFaultBrakeFlag()

void EPWM_ClearFaultBrakeFlag ( EPWM_T pwm,
uint32_t  u32BrakeSource 
)

This function clear fault brake flag.

Parameters
[in]pwmThe base address of PWM module
[in]u32BrakeSourceThis parameter is not used
Returns
None
Note
After fault brake occurred, application must clear fault brake source before re-enable PWM output

Definition at line 174 of file epwm.c.

◆ EPWM_ClearFaultBrakeIntFlag()

void EPWM_ClearFaultBrakeIntFlag ( EPWM_T pwm,
uint32_t  u32BrakeSource 
)

This function clear fault brake interrupt of selected source.

Parameters
[in]pwmThe base address of PWM module
[in]u32BrakeSourceFault brake source, could be either
Returns
None

Definition at line 329 of file epwm.c.

◆ EPWM_ClearPeriodIntFlag()

void EPWM_ClearPeriodIntFlag ( EPWM_T pwm,
uint32_t  u32ChannelNum 
)

This function clear period interrupt of selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
Returns
None

Definition at line 380 of file epwm.c.

◆ EPWM_ConfigOutputChannel()

uint32_t EPWM_ConfigOutputChannel ( EPWM_T pwm,
uint32_t  u32ChannelNum,
uint32_t  u32Frequency,
uint32_t  u32DutyCycle 
)

This function config PWM generator and get the nearest frequency in edge aligned auto-reload mode.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
[in]u32FrequencyTarget generator frequency
[in]u32DutyCycleTarget generator duty cycle percentage. Valid range are between 0 ~ 100. 10 means 10%, 20 means 20%...
Returns
Nearest frequency clock in nano second

Definition at line 35 of file epwm.c.

◆ EPWM_DisableDeadZone()

void EPWM_DisableDeadZone ( EPWM_T pwm,
uint32_t  u32ChannelNum 
)

This function disable Dead zone of selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
Returns
None

Definition at line 234 of file epwm.c.

◆ EPWM_DisableDutyInt()

void EPWM_DisableDutyInt ( EPWM_T pwm,
uint32_t  u32ChannelNum 
)

This function disable duty interrupt of selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
Returns
None

Definition at line 265 of file epwm.c.

◆ EPWM_DisableFaultBrakeInt()

void EPWM_DisableFaultBrakeInt ( EPWM_T pwm,
uint32_t  u32BrakeSource 
)

This function disable fault brake interrupt.

Parameters
[in]pwmThe base address of PWM module
[in]u32BrakeSourceThis parameter is not used
Returns
None

Definition at line 316 of file epwm.c.

◆ EPWM_DisableOutput()

void EPWM_DisableOutput ( EPWM_T pwm,
uint32_t  u32ChannelMask 
)

This function disables PWM output generation of selected channels.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelMaskCombination of enabled channels. Each bit corresponds to a channel Set bit 0 to 1 disables channel 0 output, set bit 1 to 1 disables channel 1 output...
Returns
None

Definition at line 202 of file epwm.c.

◆ EPWM_DisablePeriodInt()

void EPWM_DisablePeriodInt ( EPWM_T pwm,
uint32_t  u32ChannelNum 
)

This function disable period interrupt of selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumThis parameter is not used
Returns
None

Definition at line 369 of file epwm.c.

◆ EPWM_EnableDeadZone()

void EPWM_EnableDeadZone ( EPWM_T pwm,
uint32_t  u32ChannelNum,
uint32_t  u32Duration 
)

This function enable Dead zone of selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
[in]u32DurationDead Zone length in PWM clock count, valid values are between 0~0x7FF
Returns
None

Definition at line 218 of file epwm.c.

◆ EPWM_EnableDutyInt()

void EPWM_EnableDutyInt ( EPWM_T pwm,
uint32_t  u32ChannelNum,
uint32_t  u32IntDutyType 
)

This function enable duty interrupt of selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
[in]u32IntDutyTypeThis parameter is not used
Returns
None

Definition at line 249 of file epwm.c.

◆ EPWM_EnableFaultBrake()

void EPWM_EnableFaultBrake ( EPWM_T pwm,
uint32_t  u32ChannelMask,
uint32_t  u32LevelMask,
uint32_t  u32BrakeSource 
)

This function enable fault brake of selected channels.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelMaskThis parameter is not used
[in]u32LevelMaskOutput high or low while fault brake occurs, each bit represent the level of a channel while fault brake occurs. Bit 0 represents channel 0, bit 1 represents channel 1... , bit 5 represent channel 5
[in]u32BrakeSourceFault brake source, could be one of following source
Returns
None

Definition at line 152 of file epwm.c.

◆ EPWM_EnableFaultBrakeInt()

void EPWM_EnableFaultBrakeInt ( EPWM_T pwm,
uint32_t  u32BrakeSource 
)

This function enable fault brake interrupt.

Parameters
[in]pwmThe base address of PWM module
[in]u32BrakeSourceThis parameter is not used
Returns
None

Definition at line 305 of file epwm.c.

◆ EPWM_EnableOutput()

void EPWM_EnableOutput ( EPWM_T pwm,
uint32_t  u32ChannelMask 
)

This function enables PWM output generation of selected channels.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelMaskCombination of enabled channels. Each bit corresponds to a channel. Set bit 0 to 1 enables channel 0 output, set bit 1 to 1 enables channel 1 output...
Returns
None

Definition at line 187 of file epwm.c.

◆ EPWM_EnablePeriodInt()

void EPWM_EnablePeriodInt ( EPWM_T pwm,
uint32_t  u32ChannelNum,
uint32_t  u32IntPeriodType 
)

This function enable period interrupt of selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumThis parameter is not used
[in]u32IntPeriodTypeThis parameter is not used
Returns
None
Note
All channels share the same period interrupt type setting.

Definition at line 357 of file epwm.c.

◆ EPWM_ForceStop()

void EPWM_ForceStop ( EPWM_T pwm,
uint32_t  u32ChannelMask 
)

This function stop PWM generation immediately by clear channel enable bit.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelMaskThis parameter is not used
Note
All channels share one counter
Returns
None

Definition at line 128 of file epwm.c.

◆ EPWM_GetDutyIntFlag()

uint32_t EPWM_GetDutyIntFlag ( EPWM_T pwm,
uint32_t  u32ChannelNum 
)

This function get duty interrupt flag of selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
Returns
Duty interrupt flag of specified channel
Return values
0Duty interrupt did not occurred
1Duty interrupt occurred

Definition at line 294 of file epwm.c.

◆ EPWM_GetFaultBrakeIntFlag()

uint32_t EPWM_GetFaultBrakeIntFlag ( EPWM_T pwm,
uint32_t  u32BrakeSource 
)

This function get fault brake interrupt of selected source.

Parameters
[in]pwmThe base address of PWM module
[in]u32BrakeSourceFault brake source, could be either
Returns
Fault brake interrupt flag of specified source
Return values
0Fault brake interrupt did not occurred
1Fault brake interrupt occurred

Definition at line 344 of file epwm.c.

◆ EPWM_GetPeriodIntFlag()

uint32_t EPWM_GetPeriodIntFlag ( EPWM_T pwm,
uint32_t  u32ChannelNum 
)

This function get period interrupt of selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
Returns
Period interrupt flag of specified channel
Return values
0Period interrupt did not occurred
1Period interrupt occurred

Definition at line 394 of file epwm.c.

◆ EPWM_Start()

void EPWM_Start ( EPWM_T pwm,
uint32_t  u32ChannelMask 
)

This function start PWM module.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelMaskThis parameter is not used
Note
All channels share one counter
Returns
None

Definition at line 104 of file epwm.c.

◆ EPWM_Stop()

void EPWM_Stop ( EPWM_T pwm,
uint32_t  u32ChannelMask 
)

This function stop PWM module.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelMaskThis parameter is not used
Note
All channels share one counter
Returns
None

Definition at line 116 of file epwm.c.