M480 BSP V3.05.005
The Board Support Package for M480 Series
Macros | Functions

Macros

#define TPWM_ENABLE_PWM_MODE(timer)
 Enable PWM Counter Mode. More...
 
#define TPWM_DISABLE_PWM_MODE(timer)
 Disable PWM Counter Mode. More...
 
#define TPWM_ENABLE_INDEPENDENT_MODE(timer)
 Enable Independent Mode. More...
 
#define TPWM_ENABLE_COMPLEMENTARY_MODE(timer)
 Enable Complementary Mode. More...
 
#define TPWM_SET_COUNTER_TYPE(timer, type)
 Set Counter Type. More...
 
#define TPWM_START_COUNTER(timer)
 Start PWM Counter. More...
 
#define TPWM_STOP_COUNTER(timer)
 Stop PWM Counter. More...
 
#define TPWM_SET_PRESCALER(timer, prescaler)
 Set Counter Clock Prescaler. More...
 
#define TPWM_GET_PRESCALER(timer)
 Get Counter Clock Prescaler. More...
 
#define TPWM_SET_PERIOD(timer, period)
 Set Counter Period. More...
 
#define TPWM_GET_PERIOD(timer)
 Get Counter Period. More...
 
#define TPWM_SET_CMPDAT(timer, cmp)
 Set Comparator Value. More...
 
#define TPWM_GET_CMPDAT(timer)
 Get Comparator Value. More...
 
#define TPWM_CLEAR_COUNTER(timer)
 Clear Counter. More...
 
#define TPWM_SW_TRIGGER_BRAKE(timer, type)
 Software Trigger Brake Event. More...
 
#define TPWM_ENABLE_OUTPUT(timer, ch)
 Enable Output Function. More...
 
#define TPWM_SET_OUTPUT_INVERSE(timer, ch)
 Set Output Inverse. More...
 
#define TPWM_SET_MASK_OUTPUT(timer, ch, level)
 Enable Output Function. More...
 
#define TPWM_SET_COUNTER_SYNC_MODE(timer, mode)
 Set Counter Synchronous Mode. More...
 
#define TPWM_TRIGGER_COUNTER_SYNC(timer)
 Trigger Counter Synchronous. More...
 
#define TPWM_ENABLE_ZERO_INT(timer)
 Enable Zero Event Interrupt. More...
 
#define TPWM_DISABLE_ZERO_INT(timer)
 Disable Zero Event Interrupt. More...
 
#define TPWM_GET_ZERO_INT_FLAG(timer)
 Get Zero Event Interrupt Flag. More...
 
#define TPWM_CLEAR_ZERO_INT_FLAG(timer)
 Clear Zero Event Interrupt Flag. More...
 
#define TPWM_ENABLE_PERIOD_INT(timer)
 Enable Period Event Interrupt. More...
 
#define TPWM_DISABLE_PERIOD_INT(timer)
 Disable Period Event Interrupt. More...
 
#define TPWM_GET_PERIOD_INT_FLAG(timer)
 Get Period Event Interrupt Flag. More...
 
#define TPWM_CLEAR_PERIOD_INT_FLAG(timer)
 Clear Period Event Interrupt Flag. More...
 
#define TPWM_ENABLE_CMP_UP_INT(timer)
 Enable Compare Up Event Interrupt. More...
 
#define TPWM_DISABLE_CMP_UP_INT(timer)
 Disable Compare Up Event Interrupt. More...
 
#define TPWM_GET_CMP_UP_INT_FLAG(timer)
 Get Compare Up Event Interrupt Flag. More...
 
#define TPWM_CLEAR_CMP_UP_INT_FLAG(timer)
 Clear Compare Up Event Interrupt Flag. More...
 
#define TPWM_ENABLE_CMP_DOWN_INT(timer)
 Enable Compare Down Event Interrupt. More...
 
#define TPWM_DISABLE_CMP_DOWN_INT(timer)
 Disable Compare Down Event Interrupt. More...
 
#define TPWM_GET_CMP_DOWN_INT_FLAG(timer)
 Get Compare Down Event Interrupt Flag. More...
 
#define TPWM_CLEAR_CMP_DOWN_INT_FLAG(timer)
 Clear Compare Down Event Interrupt Flag. More...
 
#define TPWM_GET_REACH_MAX_CNT_STATUS(timer)
 Get Counter Reach Maximum Count Status. More...
 
#define TPWM_CLEAR_REACH_MAX_CNT_STATUS(timer)
 Clear Counter Reach Maximum Count Status. More...
 
#define TPWM_GET_TRG_ADC_STATUS(timer)
 Get Trigger ADC Status. More...
 
#define TPWM_CLEAR_TRG_ADC_STATUS(timer)
 Clear Trigger ADC Status. More...
 
#define TPWM_SET_BRAKE_PIN_HIGH_DETECT(timer)
 Set Brake Event at Brake Pin High or Low-to-High. More...
 
#define TPWM_SET_BRAKE_PIN_LOW_DETECT(timer)
 Set Brake Event at Brake Pin Low or High-to-Low. More...
 
#define TPWM_SET_BRAKE_PIN_SOURCE(timer, pin)
 Set External Brake Pin Source. More...
 

Functions

void TPWM_SetCounterClockSource (TIMER_T *timer, uint32_t u32CntClkSrc)
 Set PWM Counter Clock Source. More...
 
uint32_t TPWM_ConfigOutputFreqAndDuty (TIMER_T *timer, uint32_t u32Frequency, uint32_t u32DutyCycle)
 Configure PWM Output Frequency and Duty Cycle. More...
 
void TPWM_EnableDeadTime (TIMER_T *timer, uint32_t u32DTCount)
 Enable Dead-Time Function. More...
 
void TPWM_EnableDeadTimeWithPrescale (TIMER_T *timer, uint32_t u32DTCount)
 Enable Dead-Time Function. More...
 
void TPWM_DisableDeadTime (TIMER_T *timer)
 Disable Dead-Time Function. More...
 
void TPWM_EnableCounter (TIMER_T *timer)
 Enable PWM Counter. More...
 
void TPWM_DisableCounter (TIMER_T *timer)
 Disable PWM Generator. More...
 
void TPWM_EnableTriggerADC (TIMER_T *timer, uint32_t u32Condition)
 Enable Trigger ADC. More...
 
void TPWM_DisableTriggerADC (TIMER_T *timer)
 Disable Trigger ADC. More...
 
void TPWM_EnableFaultBrake (TIMER_T *timer, uint32_t u32CH0Level, uint32_t u32CH1Level, uint32_t u32BrakeSource)
 Enable Fault Brake Function. More...
 
void TPWM_EnableFaultBrakeInt (TIMER_T *timer, uint32_t u32IntSource)
 Enable Fault Brake Interrupt. More...
 
void TPWM_DisableFaultBrakeInt (TIMER_T *timer, uint32_t u32IntSource)
 Disable Fault Brake Interrupt. More...
 
uint32_t TPWM_GetFaultBrakeIntFlag (TIMER_T *timer, uint32_t u32IntSource)
 Indicate Fault Brake Interrupt Flag. More...
 
void TPWM_ClearFaultBrakeIntFlag (TIMER_T *timer, uint32_t u32IntSource)
 Clear Fault Brake Interrupt Flags. More...
 
void TPWM_SetLoadMode (TIMER_T *timer, uint32_t u32LoadMode)
 Enable load mode of selected channel. More...
 
void TPWM_EnableBrakePinDebounce (TIMER_T *timer, uint32_t u32BrakePinSrc, uint32_t u32DebounceCnt, uint32_t u32ClkSrcSel)
 Enable brake pin noise filter function. More...
 
void TPWM_DisableBrakePinDebounce (TIMER_T *timer)
 Disable brake pin noise filter function. More...
 
void TPWM_EnableBrakePinInverse (TIMER_T *timer)
 Enable brake pin inverse function. More...
 
void TPWM_DisableBrakePinInverse (TIMER_T *timer)
 Disable brake pin inverse function. More...
 
void TPWM_SetBrakePinSource (TIMER_T *timer, uint32_t u32BrakePinNum)
 Set brake pin source. More...
 

Detailed Description

Macro Definition Documentation

◆ TPWM_CLEAR_CMP_DOWN_INT_FLAG

#define TPWM_CLEAR_CMP_DOWN_INT_FLAG (   timer)

Clear Compare Down Event Interrupt Flag.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro clears compare down event interrupt flag.

Definition at line 619 of file timer_pwm.h.

◆ TPWM_CLEAR_CMP_UP_INT_FLAG

#define TPWM_CLEAR_CMP_UP_INT_FLAG (   timer)

Clear Compare Up Event Interrupt Flag.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro clears compare up event interrupt flag.

Definition at line 570 of file timer_pwm.h.

◆ TPWM_CLEAR_COUNTER

#define TPWM_CLEAR_COUNTER (   timer)

Clear Counter.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro is used to clear counter of specified TIMER PWM.

Definition at line 319 of file timer_pwm.h.

◆ TPWM_CLEAR_PERIOD_INT_FLAG

#define TPWM_CLEAR_PERIOD_INT_FLAG (   timer)

Clear Period Event Interrupt Flag.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro clears period event interrupt flag.

Definition at line 521 of file timer_pwm.h.

◆ TPWM_CLEAR_REACH_MAX_CNT_STATUS

#define TPWM_CLEAR_REACH_MAX_CNT_STATUS (   timer)

Clear Counter Reach Maximum Count Status.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro clears reach maximum count status.

Definition at line 644 of file timer_pwm.h.

◆ TPWM_CLEAR_TRG_ADC_STATUS

#define TPWM_CLEAR_TRG_ADC_STATUS (   timer)

Clear Trigger ADC Status.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro is used to clear PWM counter compare event trigger ADC status.

Definition at line 669 of file timer_pwm.h.

◆ TPWM_CLEAR_ZERO_INT_FLAG

#define TPWM_CLEAR_ZERO_INT_FLAG (   timer)

Clear Zero Event Interrupt Flag.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro clears zero event interrupt flag.

Definition at line 472 of file timer_pwm.h.

◆ TPWM_DISABLE_CMP_DOWN_INT

#define TPWM_DISABLE_CMP_DOWN_INT (   timer)

Disable Compare Down Event Interrupt.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro is used to disable the compare down event interrupt function.

Definition at line 594 of file timer_pwm.h.

◆ TPWM_DISABLE_CMP_UP_INT

#define TPWM_DISABLE_CMP_UP_INT (   timer)

Disable Compare Up Event Interrupt.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro is used to disable the compare up event interrupt function.

Definition at line 545 of file timer_pwm.h.

◆ TPWM_DISABLE_PERIOD_INT

#define TPWM_DISABLE_PERIOD_INT (   timer)

Disable Period Event Interrupt.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro is used to disable the period event interrupt function.

Definition at line 496 of file timer_pwm.h.

◆ TPWM_DISABLE_PWM_MODE

#define TPWM_DISABLE_PWM_MODE (   timer)

Disable PWM Counter Mode.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro is used to disable specified Timer channel as PWM counter mode, then timer counter mode is available.

Note
All registers about PWM counter function will be cleared to 0 after executing this macro.

Definition at line 164 of file timer_pwm.h.

◆ TPWM_DISABLE_ZERO_INT

#define TPWM_DISABLE_ZERO_INT (   timer)

Disable Zero Event Interrupt.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro is used to disable the zero event interrupt function.

Definition at line 447 of file timer_pwm.h.

◆ TPWM_ENABLE_CMP_DOWN_INT

#define TPWM_ENABLE_CMP_DOWN_INT (   timer)

Enable Compare Down Event Interrupt.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro is used to enable the compare down event interrupt function.

Definition at line 582 of file timer_pwm.h.

◆ TPWM_ENABLE_CMP_UP_INT

#define TPWM_ENABLE_CMP_UP_INT (   timer)

Enable Compare Up Event Interrupt.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro is used to enable the compare up event interrupt function.

Definition at line 533 of file timer_pwm.h.

◆ TPWM_ENABLE_COMPLEMENTARY_MODE

#define TPWM_ENABLE_COMPLEMENTARY_MODE (   timer)

Enable Complementary Mode.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro is used to enable complementary mode of Timer PWM module and independent mode will be disabled.

Definition at line 188 of file timer_pwm.h.

◆ TPWM_ENABLE_INDEPENDENT_MODE

#define TPWM_ENABLE_INDEPENDENT_MODE (   timer)

Enable Independent Mode.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro is used to enable independent mode of TIMER PWM module and complementary mode will be disabled.

Definition at line 176 of file timer_pwm.h.

◆ TPWM_ENABLE_OUTPUT

#define TPWM_ENABLE_OUTPUT (   timer,
  ch 
)

Enable Output Function.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
[in]chEnable specified channel output function. Valid values are the combination of:
Returns
None

This macro is used to enable output function of specified output pins.

Note
If the corresponding bit in ch parameter is 0, then output function will be disabled in this channel.

Definition at line 352 of file timer_pwm.h.

◆ TPWM_ENABLE_PERIOD_INT

#define TPWM_ENABLE_PERIOD_INT (   timer)

Enable Period Event Interrupt.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro is used to enable the period event interrupt function.

Definition at line 484 of file timer_pwm.h.

◆ TPWM_ENABLE_PWM_MODE

#define TPWM_ENABLE_PWM_MODE (   timer)

Enable PWM Counter Mode.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro is used to enable specified Timer channel as PWM counter mode, then timer counter mode is invalid.

Note
All registers about time counter function will be cleared to 0 and timer clock source will be changed to PCLKx automatically after executing this macro.

Definition at line 151 of file timer_pwm.h.

◆ TPWM_ENABLE_ZERO_INT

#define TPWM_ENABLE_ZERO_INT (   timer)

Enable Zero Event Interrupt.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro is used to enable the zero event interrupt function.

Definition at line 435 of file timer_pwm.h.

◆ TPWM_GET_CMP_DOWN_INT_FLAG

#define TPWM_GET_CMP_DOWN_INT_FLAG (   timer)

Get Compare Down Event Interrupt Flag.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Return values
0Compare down event interrupt did not occur
1Compare down event interrupt occurred

This macro indicates compare down event occurred or not.

Definition at line 607 of file timer_pwm.h.

◆ TPWM_GET_CMP_UP_INT_FLAG

#define TPWM_GET_CMP_UP_INT_FLAG (   timer)

Get Compare Up Event Interrupt Flag.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Return values
0Compare up event interrupt did not occur
1Compare up event interrupt occurred

This macro indicates compare up event occurred or not.

Definition at line 558 of file timer_pwm.h.

◆ TPWM_GET_CMPDAT

#define TPWM_GET_CMPDAT (   timer)

Get Comparator Value.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
Target comparator setting, CMPDAT (TIMERx_PWMCMPDAT[15:0])

This macro is used to get the comparator value of specified TIMER PWM.

Definition at line 307 of file timer_pwm.h.

◆ TPWM_GET_PERIOD

#define TPWM_GET_PERIOD (   timer)

Get Counter Period.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
Target period setting, PERIOD (TIMERx_PWMPERIOD[15:0])

This macro is used to get the period of specified TIMER PWM.

Definition at line 281 of file timer_pwm.h.

◆ TPWM_GET_PERIOD_INT_FLAG

#define TPWM_GET_PERIOD_INT_FLAG (   timer)

Get Period Event Interrupt Flag.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Return values
0Period event interrupt did not occur
1Period event interrupt occurred

This macro indicates period event occurred or not.

Definition at line 509 of file timer_pwm.h.

◆ TPWM_GET_PRESCALER

#define TPWM_GET_PRESCALER (   timer)

Get Counter Clock Prescaler.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
Target prescaler setting, CLKPSC (TIMERx_PWMCLKPSC[11:0])

Get the prescaler setting, the target counter clock divider is (CLKPSC + 1).

Definition at line 255 of file timer_pwm.h.

◆ TPWM_GET_REACH_MAX_CNT_STATUS

#define TPWM_GET_REACH_MAX_CNT_STATUS (   timer)

Get Counter Reach Maximum Count Status.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Return values
0Timer PWM counter never counts to maximum value
1Timer PWM counter counts to maximum value, 0xFFFF

This macro indicates Timer PWM counter has count to 0xFFFF or not.

Definition at line 632 of file timer_pwm.h.

◆ TPWM_GET_TRG_ADC_STATUS

#define TPWM_GET_TRG_ADC_STATUS (   timer)

Get Trigger ADC Status.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Return values
0Trigger ADC start conversion is not occur
1Specified counter compare event has trigger ADC start conversion

This macro is used to indicate PWM counter compare event has triggered ADC start conversion.

Definition at line 657 of file timer_pwm.h.

◆ TPWM_GET_ZERO_INT_FLAG

#define TPWM_GET_ZERO_INT_FLAG (   timer)

Get Zero Event Interrupt Flag.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Return values
0Zero event interrupt did not occur
1Zero event interrupt occurred

This macro indicates zero event occurred or not.

Definition at line 460 of file timer_pwm.h.

◆ TPWM_SET_BRAKE_PIN_HIGH_DETECT

#define TPWM_SET_BRAKE_PIN_HIGH_DETECT (   timer)

Set Brake Event at Brake Pin High or Low-to-High.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro is used to set detect brake event when external brake pin at high level or transfer from low to high.

Note
The default brake pin detection is high level or from low to high.

Definition at line 682 of file timer_pwm.h.

◆ TPWM_SET_BRAKE_PIN_LOW_DETECT

#define TPWM_SET_BRAKE_PIN_LOW_DETECT (   timer)

Set Brake Event at Brake Pin Low or High-to-Low.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro is used to set detect brake event when external brake pin at low level or transfer from high to low.

Definition at line 694 of file timer_pwm.h.

◆ TPWM_SET_BRAKE_PIN_SOURCE

#define TPWM_SET_BRAKE_PIN_SOURCE (   timer,
  pin 
)

Set External Brake Pin Source.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
[in]pinThe external brake pin source, could be one of following source
Returns
None

This macro is used to set detect brake event when external brake pin at high level or transfer from low to high.

Definition at line 711 of file timer_pwm.h.

◆ TPWM_SET_CMPDAT

#define TPWM_SET_CMPDAT (   timer,
  cmp 
)

Set Comparator Value.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
[in]cmpComparator of specified channel. Valid values are between 0x0~0xFFFF.
Returns
None

This macro is used to set the comparator value of specified TIMER PWM.

Definition at line 295 of file timer_pwm.h.

◆ TPWM_SET_COUNTER_SYNC_MODE

#define TPWM_SET_COUNTER_SYNC_MODE (   timer,
  mode 
)

Set Counter Synchronous Mode.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
[in]modeSynchronous mode. Possible options are:
Returns
None

This macro is used to set counter synchronous mode of specified Timer PWM module.

Note
Only support all PWM counters are synchronous by TIMER0 PWM or TIMER0~1 PWM counter synchronous by TIMER0 PWM and TIMER2~3 PWM counter synchronous by TIMER2 PWM.

Definition at line 409 of file timer_pwm.h.

◆ TPWM_SET_COUNTER_TYPE

#define TPWM_SET_COUNTER_TYPE (   timer,
  type 
)

Set Counter Type.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
[in]typeTimer PWM count type, could be one of the following type
Returns
None

This macro is used to set Timer PWM counter type.

Definition at line 204 of file timer_pwm.h.

◆ TPWM_SET_MASK_OUTPUT

#define TPWM_SET_MASK_OUTPUT (   timer,
  ch,
  level 
)

Enable Output Function.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
[in]chEnable specified channel output mask function. Valid values are the combination of:
[in]levelOutput to high or low on specified mask channel.
Returns
None

This macro is used to enable output function of specified output pins.

Note
If ch parameter is 0, then output mask function will be disabled.

Definition at line 388 of file timer_pwm.h.

◆ TPWM_SET_OUTPUT_INVERSE

#define TPWM_SET_OUTPUT_INVERSE (   timer,
  ch 
)

Set Output Inverse.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
[in]chSet specified channel output is inversed or not. Valid values are the combination of:
Returns
None

This macro is used to enable output inverse of specified output pins.

Note
If ch parameter is 0, then output inverse function will be disabled.

Definition at line 369 of file timer_pwm.h.

◆ TPWM_SET_PERIOD

#define TPWM_SET_PERIOD (   timer,
  period 
)

Set Counter Period.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
[in]periodPeriod of specified channel. Valid values are between 0x0~0xFFFF.
Returns
None

This macro is used to set the period of specified TIMER PWM.

Definition at line 269 of file timer_pwm.h.

◆ TPWM_SET_PRESCALER

#define TPWM_SET_PRESCALER (   timer,
  prescaler 
)

Set Counter Clock Prescaler.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
[in]prescalerClock prescaler of specified channel. Valid values are between 0x0~0xFFF.
Returns
None

This macro is used to set the prescaler of specified TIMER PWM.

Note
If prescaler is 0, then there is no scaling in counter clock source.

Definition at line 243 of file timer_pwm.h.

◆ TPWM_START_COUNTER

#define TPWM_START_COUNTER (   timer)

Start PWM Counter.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro is used to enable PWM generator and start counter counting.

Definition at line 216 of file timer_pwm.h.

◆ TPWM_STOP_COUNTER

#define TPWM_STOP_COUNTER (   timer)

Stop PWM Counter.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro is used to stop PWM counter after current period is completed.

Definition at line 228 of file timer_pwm.h.

◆ TPWM_SW_TRIGGER_BRAKE

#define TPWM_SW_TRIGGER_BRAKE (   timer,
  type 
)

Software Trigger Brake Event.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
[in]typeType of brake trigger. Valid values are:
Returns
None

This macro is used to trigger brake event by writing PWMSWBRK register.

Definition at line 335 of file timer_pwm.h.

◆ TPWM_TRIGGER_COUNTER_SYNC

#define TPWM_TRIGGER_COUNTER_SYNC (   timer)

Trigger Counter Synchronous.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This macro is used to trigger synchronous event by specified TIMER PWM.

Note
1. This macro is only available for TIMER0 PWM and TIMER2 PWM.
  1. STRGEN (PWMSTRG[0]) is write only and always read as 0.

Definition at line 423 of file timer_pwm.h.

Function Documentation

◆ TPWM_ClearFaultBrakeIntFlag()

void TPWM_ClearFaultBrakeIntFlag ( TIMER_T timer,
uint32_t  u32IntSource 
)

Clear Fault Brake Interrupt Flags.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
[in]u32IntSourceInterrupt source, could be one of following source
Returns
None

This function is used to clear fault brake interrupt flags of selected source.

Note
The register write-protection function should be disabled before using this function.

Definition at line 326 of file timer_pwm.c.

◆ TPWM_ConfigOutputFreqAndDuty()

uint32_t TPWM_ConfigOutputFreqAndDuty ( TIMER_T timer,
uint32_t  u32Frequency,
uint32_t  u32DutyCycle 
)

Configure PWM Output Frequency and Duty Cycle.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
[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

This API is used to configure PWM output frequency and duty cycle in up count type and auto-reload operation mode.

Note
This API is only available if Timer PWM counter clock source is from TMRx_CLK.

Definition at line 55 of file timer_pwm.c.

◆ TPWM_DisableBrakePinDebounce()

void TPWM_DisableBrakePinDebounce ( TIMER_T timer)

Disable brake pin noise filter function.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This function is used to disable external brake pin detector noise filter function.

Definition at line 392 of file timer_pwm.c.

◆ TPWM_DisableBrakePinInverse()

void TPWM_DisableBrakePinInverse ( TIMER_T timer)

Disable brake pin inverse function.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This function is used to disable PWM brake pin inverse function.

Definition at line 415 of file timer_pwm.c.

◆ TPWM_DisableCounter()

void TPWM_DisableCounter ( TIMER_T timer)

Disable PWM Generator.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This function is used to disable PWM counter immediately by clear CNTEN (TIMERx_PWMCTL[0]) bit.

Definition at line 177 of file timer_pwm.c.

◆ TPWM_DisableDeadTime()

void TPWM_DisableDeadTime ( TIMER_T timer)

Disable Dead-Time Function.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This function is used to enable Dead-time of selected channel.

Note
The register write-protection function should be disabled before using this function.

Definition at line 149 of file timer_pwm.c.

◆ TPWM_DisableFaultBrakeInt()

void TPWM_DisableFaultBrakeInt ( TIMER_T timer,
uint32_t  u32IntSource 
)

Disable Fault Brake Interrupt.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
[in]u32IntSourceInterrupt source, could be one of following source
Returns
None

This function is used to disable fault brake interrupt.

Note
The register write-protection function should be disabled before using this function.

Definition at line 289 of file timer_pwm.c.

◆ TPWM_DisableTriggerADC()

void TPWM_DisableTriggerADC ( TIMER_T timer)

Disable Trigger ADC.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This function is used to disable counter compare event to trigger ADC.

Definition at line 211 of file timer_pwm.c.

◆ TPWM_EnableBrakePinDebounce()

void TPWM_EnableBrakePinDebounce ( TIMER_T timer,
uint32_t  u32BrakePinSrc,
uint32_t  u32DebounceCnt,
uint32_t  u32ClkSrcSel 
)

Enable brake pin noise filter function.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
[in]u32BrakePinSrcThe external brake pin source, could be one of following source
[in]u32DebounceCntThis value controls the real debounce sample time. The target debounce sample time is (debounce sample clock period) * (u32DebounceCnt).
[in]u32ClkSrcSelBrake pin detector debounce clock source, could be one of following source
Returns
None

This function is used to enable external brake pin detector noise filter function.

Definition at line 375 of file timer_pwm.c.

◆ TPWM_EnableBrakePinInverse()

void TPWM_EnableBrakePinInverse ( TIMER_T timer)

Enable brake pin inverse function.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This function is used to enable PWM brake pin inverse function.

Definition at line 404 of file timer_pwm.c.

◆ TPWM_EnableCounter()

void TPWM_EnableCounter ( TIMER_T timer)

Enable PWM Counter.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
Returns
None

This function is used to enable PWM generator and start counter counting.

Definition at line 163 of file timer_pwm.c.

◆ TPWM_EnableDeadTime()

void TPWM_EnableDeadTime ( TIMER_T timer,
uint32_t  u32DTCount 
)

Enable Dead-Time Function.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
[in]u32DTCountDead-Time duration in PWM clock count, valid values are between 0x0~0xFFF, but 0x0 means there is no Dead-Time insertion.
Returns
None

This function is used to enable Dead-Time function and counter source is the same as Timer PWM clock source.

Note
The register write-protection function should be disabled before using this function.

Definition at line 118 of file timer_pwm.c.

◆ TPWM_EnableDeadTimeWithPrescale()

void TPWM_EnableDeadTimeWithPrescale ( TIMER_T timer,
uint32_t  u32DTCount 
)

Enable Dead-Time Function.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
[in]u32DTCountDead-Time duration in PWM clock count, valid values are between 0x0~0xFFF, but 0x0 means there is no Dead-Time insertion.
Returns
None

This function is used to enable Dead-Time function and counter source is the Timer PWM clock source with prescale.

Note
The register write-protection function should be disabled before using this function.

Definition at line 134 of file timer_pwm.c.

◆ TPWM_EnableFaultBrake()

void TPWM_EnableFaultBrake ( TIMER_T timer,
uint32_t  u32CH0Level,
uint32_t  u32CH1Level,
uint32_t  u32BrakeSource 
)

Enable Fault Brake Function.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
[in]u32CH0LevelPWMx_CH0 output level while fault brake event occurs. Valid value is one of following setting
[in]u32CH1LevelPWMx_CH1 output level while fault brake event occurs. Valid value is one of following setting
[in]u32BrakeSourceFault brake source, combination of following source
Returns
None

This function is used to enable fault brake function.

Note
The register write-protection function should be disabled before using this function.

Definition at line 251 of file timer_pwm.c.

◆ TPWM_EnableFaultBrakeInt()

void TPWM_EnableFaultBrakeInt ( TIMER_T timer,
uint32_t  u32IntSource 
)

Enable Fault Brake Interrupt.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
[in]u32IntSourceInterrupt source, could be one of following source
Returns
None

This function is used to enable fault brake interrupt.

Note
The register write-protection function should be disabled before using this function.

Definition at line 271 of file timer_pwm.c.

◆ TPWM_EnableTriggerADC()

void TPWM_EnableTriggerADC ( TIMER_T timer,
uint32_t  u32Condition 
)

Enable Trigger ADC.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
[in]u32ConditionThe condition to trigger ADC. It could be one of following conditions:
Returns
None

This function is used to enable specified counter compare event to trigger ADC.

Definition at line 197 of file timer_pwm.c.

◆ TPWM_GetFaultBrakeIntFlag()

uint32_t TPWM_GetFaultBrakeIntFlag ( TIMER_T timer,
uint32_t  u32IntSource 
)

Indicate Fault Brake Interrupt Flag.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
[in]u32IntSourceInterrupt source, could be one of following source
Returns
Fault brake interrupt flag of specified source
Return values
0Fault brake interrupt did not occurred
1Fault brake interrupt occurred

This function is used to indicate fault brake interrupt flag occurred or not of selected source.

Definition at line 308 of file timer_pwm.c.

◆ TPWM_SetBrakePinSource()

void TPWM_SetBrakePinSource ( TIMER_T timer,
uint32_t  u32BrakePinNum 
)

Set brake pin source.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
[in]u32BrakePinNumBrake pin selection. One of the following:
Returns
None

This function is used to set PWM brake pin source.

Definition at line 431 of file timer_pwm.c.

◆ TPWM_SetCounterClockSource()

void TPWM_SetCounterClockSource ( TIMER_T timer,
uint32_t  u32CntClkSrc 
)

Set PWM Counter Clock Source.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
[in]u32CntClkSrcPWM counter clock source, could be one of following source
Returns
None

This function is used to set PWM counter clock source.

Definition at line 38 of file timer_pwm.c.

◆ TPWM_SetLoadMode()

void TPWM_SetLoadMode ( TIMER_T timer,
uint32_t  u32LoadMode 
)

Enable load mode of selected channel.

Parameters
[in]timerThe pointer of the specified Timer module. It could be TIMER0, TIMER1, TIMER2, TIMER3.
[in]u32LoadModeTimer PWM counter loading mode, could be one of following mode
Returns
None

This function is used to enable load mode of selected channel.

Note
The default loading mode is period loading mode.

Definition at line 345 of file timer_pwm.c.