M4521_BSP V3.02.000
The Board Support Package for M4521
pwm.h
Go to the documentation of this file.
1/**************************************************************************/
12#ifndef __PWM_H__
13#define __PWM_H__
14
15#ifdef __cplusplus
16extern "C"
17{
18#endif
19
20
32#define PWM_CHANNEL_NUM (6)
33#define PWM_CH_0_MASK (0x1UL)
34#define PWM_CH_1_MASK (0x2UL)
35#define PWM_CH_2_MASK (0x4UL)
36#define PWM_CH_3_MASK (0x8UL)
37#define PWM_CH_4_MASK (0x10UL)
38#define PWM_CH_5_MASK (0x20UL)
40/*---------------------------------------------------------------------------------------------------------*/
41/* Counter Type Constant Definitions */
42/*---------------------------------------------------------------------------------------------------------*/
43#define PWM_UP_COUNTER (0UL)
44#define PWM_DOWN_COUNTER (1UL)
45#define PWM_UP_DOWN_COUNTER (2UL)
47/*---------------------------------------------------------------------------------------------------------*/
48/* Aligned Type Constant Definitions */
49/*---------------------------------------------------------------------------------------------------------*/
50#define PWM_EDGE_ALIGNED (1UL)
51#define PWM_CENTER_ALIGNED (2UL)
53/*---------------------------------------------------------------------------------------------------------*/
54/* Output Level Constant Definitions */
55/*---------------------------------------------------------------------------------------------------------*/
56#define PWM_OUTPUT_NOTHING (0UL)
57#define PWM_OUTPUT_LOW (1UL)
58#define PWM_OUTPUT_HIGH (2UL)
59#define PWM_OUTPUT_TOGGLE (3UL)
61/*---------------------------------------------------------------------------------------------------------*/
62/* Trigger Source Select Constant Definitions */
63/*---------------------------------------------------------------------------------------------------------*/
64#define PWM_TRIGGER_ADC_EVEN_ZERO_POINT (0UL)
65#define PWM_TRIGGER_ADC_EVEN_PERIOD_POINT (1UL)
66#define PWM_TRIGGER_ADC_EVEN_ZERO_OR_PERIOD_POINT (2UL)
67#define PWM_TRIGGER_ADC_EVEN_COMPARE_UP_COUNT_POINT (3UL)
68#define PWM_TRIGGER_ADC_EVEN_COMPARE_DOWN_COUNT_POINT (4UL)
69#define PWM_TRIGGER_ADC_ODD_ZERO_POINT (5UL)
70#define PWM_TRIGGER_ADC_ODD_PERIOD_POINT (6UL)
71#define PWM_TRIGGER_ADC_ODD_ZERO_OR_PERIOD_POINT (7UL)
72#define PWM_TRIGGER_ADC_ODD_COMPARE_UP_COUNT_POINT (8UL)
73#define PWM_TRIGGER_ADC_ODD_COMPARE_DOWN_COUNT_POINT (9UL)
74#define PWM_TRIGGER_ADC_CH_0_FREE_COMPARE_UP_COUNT_POINT (10UL)
75#define PWM_TRIGGER_ADC_CH_0_FREE_COMPARE_DOWN_COUNT_POINT (11UL)
76#define PWM_TRIGGER_ADC_CH_2_FREE_COMPARE_UP_COUNT_POINT (12UL)
77#define PWM_TRIGGER_ADC_CH_2_FREE_COMPARE_DOWN_COUNT_POINT (13UL)
78#define PWM_TRIGGER_ADC_CH_4_FREE_COMPARE_UP_COUNT_POINT (14UL)
79#define PWM_TRIGGER_ADC_CH_4_FREE_COMPARE_DOWN_COUNT_POINT (15UL)
81/*---------------------------------------------------------------------------------------------------------*/
82/* Fail brake Control Constant Definitions */
83/*---------------------------------------------------------------------------------------------------------*/
84#define PWM_FB_EDGE_BKP0 (PWM_BRKCTL0_1_BRKP0EEN_Msk)
85#define PWM_FB_EDGE_BKP1 (PWM_BRKCTL0_1_BRKP1EEN_Msk)
86#define PWM_FB_EDGE_SYS_CSS (PWM_BRKCTL0_1_SYSEBEN_Msk | PWM_FAILBRK_CSSBRKEN_Msk)
87#define PWM_FB_EDGE_SYS_BOD (PWM_BRKCTL0_1_SYSEBEN_Msk | PWM_FAILBRK_BODBRKEN_Msk)
88#define PWM_FB_EDGE_SYS_COR (PWM_BRKCTL0_1_SYSEBEN_Msk | PWM_FAILBRK_CORBRKEN_Msk)
90#define PWM_FB_LEVEL_BKP0 (PWM_BRKCTL0_1_BRKP0LEN_Msk)
91#define PWM_FB_LEVEL_BKP1 (PWM_BRKCTL0_1_BRKP1LEN_Msk)
92#define PWM_FB_LEVEL_SYS_CSS (PWM_BRKCTL0_1_SYSLBEN_Msk | PWM_FAILBRK_CSSBRKEN_Msk)
93#define PWM_FB_LEVEL_SYS_BOD (PWM_BRKCTL0_1_SYSLBEN_Msk | PWM_FAILBRK_BODBRKEN_Msk)
94#define PWM_FB_LEVEL_SYS_COR (PWM_BRKCTL0_1_SYSLBEN_Msk | PWM_FAILBRK_CORBRKEN_Msk)
96#define PWM_FB_EDGE (0UL)
97#define PWM_FB_LEVEL (8UL)
99/*---------------------------------------------------------------------------------------------------------*/
100/* Capture Control Constant Definitions */
101/*---------------------------------------------------------------------------------------------------------*/
102#define PWM_CAPTURE_INT_RISING_LATCH (1UL)
103#define PWM_CAPTURE_INT_FALLING_LATCH (0x100UL)
105#define PWM_CAPTURE_PDMA_RISING_LATCH (0x2UL)
106#define PWM_CAPTURE_PDMA_FALLING_LATCH (0x4UL)
107#define PWM_CAPTURE_PDMA_RISING_FALLING_LATCH (0x6UL)
109/*---------------------------------------------------------------------------------------------------------*/
110/* Duty Interrupt Type Constant Definitions */
111/*---------------------------------------------------------------------------------------------------------*/
112#define PWM_DUTY_INT_DOWN_COUNT_MATCH_CMP (PWM_INTEN0_CMPDIEN0_Msk)
113#define PWM_DUTY_INT_UP_COUNT_MATCH_CMP (PWM_INTEN0_CMPUIEN0_Msk)
115/*---------------------------------------------------------------------------------------------------------*/
116/* Interrupt Flag Accumulator Constant Definitions */
117/*---------------------------------------------------------------------------------------------------------*/
118#define PWM_IFA_EVEN_ZERO_POINT (0UL)
119#define PWM_IFA_EVEN_PERIOD_POINT (1UL)
120#define PWM_IFA_EVEN_COMPARE_UP_COUNT_POINT (2UL)
121#define PWM_IFA_EVEN_COMPARE_DOWN_COUNT_POINT (3UL)
122#define PWM_IFA_ODD_ZERO_POINT (4UL)
123#define PWM_IFA_ODD_PERIOD_POINT (5UL)
124#define PWM_IFA_ODD_COMPARE_UP_COUNT_POINT (6UL)
125#define PWM_IFA_ODD_COMPARE_DOWN_COUNT_POINT (7UL)
127/*---------------------------------------------------------------------------------------------------------*/
128/* Load Mode Constant Definitions */
129/*---------------------------------------------------------------------------------------------------------*/
130#define PWM_LOAD_MODE_IMMEDIATE (PWM_CTL0_IMMLDEN0_Msk)
131#define PWM_LOAD_MODE_WINDOW (PWM_CTL0_WINLDEN0_Msk)
132#define PWM_LOAD_MODE_CENTER (PWM_CTL0_CTRLD0_Msk)
134/*---------------------------------------------------------------------------------------------------------*/
135/* Synchronize Control Constant Definitions */
136/*---------------------------------------------------------------------------------------------------------*/
137#define PWM_SYNC_OUT_FROM_SYNCIN_SWSYNC (0UL)
138#define PWM_SYNC_OUT_FROM_COUNT_TO_ZERO (1UL)
139#define PWM_SYNC_OUT_FROM_COUNT_TO_COMPARATOR (2UL)
140#define PWM_SYNC_OUT_DISABLE (3UL)
141#define PWM_PHS_DIR_DECREMENT (0UL)
142#define PWM_PHS_DIR_INCREMENT (1UL)
144/*---------------------------------------------------------------------------------------------------------*/
145/* Noise Filter Clock Divide Select Constant Definitions */
146/*---------------------------------------------------------------------------------------------------------*/
147#define PWM_NF_CLK_DIV_1 (0UL)
148#define PWM_NF_CLK_DIV_2 (1UL)
149#define PWM_NF_CLK_DIV_4 (2UL)
150#define PWM_NF_CLK_DIV_8 (3UL)
151#define PWM_NF_CLK_DIV_16 (4UL)
152#define PWM_NF_CLK_DIV_32 (5UL)
153#define PWM_NF_CLK_DIV_64 (6UL)
154#define PWM_NF_CLK_DIV_128 (7UL)
156/*---------------------------------------------------------------------------------------------------------*/
157/* Clock Source Select Constant Definitions */
158/*---------------------------------------------------------------------------------------------------------*/
159#define PWM_CLKSRC_PWM_CLK (0UL)
160#define PWM_CLKSRC_TIMER0 (1UL)
161#define PWM_CLKSRC_TIMER1 (2UL)
162#define PWM_CLKSRC_TIMER2 (3UL)
163#define PWM_CLKSRC_TIMER3 (4UL) /* end of group PWM_EXPORTED_CONSTANTS */
167
168
180#define PWM_ENABLE_COMPLEMENTARY_MODE(pwm) ((pwm)->CTL1 = (pwm)->CTL1 | PWM_CTL1_OUTMODEn_Msk)
181
189#define PWM_DISABLE_COMPLEMENTARY_MODE(pwm) ((pwm)->CTL1 = (pwm)->CTL1 & ~PWM_CTL1_OUTMODEn_Msk)
190
198#define PWM_ENABLE_GROUP_MODE(pwm) ((pwm)->CTL0 = (pwm)->CTL0 | PWM_CTL0_GROUPEN_Msk)
199
207#define PWM_DISABLE_GROUP_MODE(pwm) ((pwm)->CTL0 = (pwm)->CTL0 & ~PWM_CTL0_GROUPEN_Msk)
208
218#define PWM_ENABLE_TIMER_SYNC(pwm, u32ChannelMask) ((pwm)->SSCTL |= (u32ChannelMask))
219
229#define PWM_DISABLE_TIMER_SYNC(pwm, u32ChannelMask) \
230 do{ \
231 int i;\
232 for(i = 0; i < 6; i++) { \
233 if((u32ChannelMask) & (1 << i)) \
234 (pwm)->SSCTL &= ~(1UL << i); \
235 } \
236 }while(0)
237
247#define PWM_ENABLE_OUTPUT_INVERTER(pwm, u32ChannelMask) ((pwm)->POLCTL = (u32ChannelMask))
248
257#define PWM_GET_CAPTURE_RISING_DATA(pwm, u32ChannelNum) (*(__IO uint32_t *) (&((pwm)->RCAPDAT0) + 2 * (u32ChannelNum)))
258
267#define PWM_GET_CAPTURE_FALLING_DATA(pwm, u32ChannelNum) (*(__IO uint32_t *) (&((pwm)->FCAPDAT0) + 2 * (u32ChannelNum)))
268
280#define PWM_MASK_OUTPUT(pwm, u32ChannelMask, u32LevelMask) \
281 { \
282 (pwm)->MSKEN = (u32ChannelMask); \
283 (pwm)->MSK = (u32LevelMask); \
284 }
285
297#define PWM_SET_PRESCALER(pwm, u32ChannelNum, u32Prescaler) (*(__IO uint32_t *) (&((pwm)->CLKPSC0_1) + ((u32ChannelNum) >> 1)) = (u32Prescaler))
298
309#define PWM_SET_CMR(pwm, u32ChannelNum, u32CMR) ((pwm)->CMPDAT[(u32ChannelNum)]= (u32CMR))
310
321#define PWM_SET_FTCMR(pwm, u32ChannelNum, u32FTCMR) (*(__IO uint32_t *) (&((pwm)->FTCMPDAT0_1) + ((u32ChannelNum) >> 1)) = (u32FTCMR))
322
334#define PWM_SET_CNR(pwm, u32ChannelNum, u32CNR) ((pwm)->PERIOD[(u32ChannelNum)] = (u32CNR))
335
348#define PWM_SET_ALIGNED_TYPE(pwm, u32ChannelMask, u32AlignedType) \
349 do{ \
350 int i; \
351 for(i = 0; i < 6; i++) { \
352 if((u32ChannelMask) & (1 << i)) \
353 (pwm)->CTL1 = (((pwm)->CTL1 & ~(3UL << (2 * i))) | ((u32AlignedType) << ( 2 * i))); \
354 } \
355 }while(0)
356
366#define PWM_SET_LOAD_WINDOW(pwm, u32ChannelMask) ((pwm)->LOAD |= (u32ChannelMask))
367
377#define PWM_TRIGGER_SYNC(pwm, u32ChannelNum) ((pwm)->SWSYNC |= (1 << ((u32ChannelNum) >> 1)))
378
388#define PWM_CLR_COUNTER(pwm, u32ChannelMask) ((pwm)->CNTCLR |= (u32ChannelMask))
389
419#define PWM_SET_OUTPUT_LEVEL(pwm, u32ChannelMask, u32ZeroLevel, u32CmpUpLevel, u32PeriodLevel, u32CmpDownLevel) \
420 do{ \
421 int i; \
422 for(i = 0; i < 6; i++) { \
423 if((u32ChannelMask) & (1 << i)) { \
424 (pwm)->WGCTL0 = (((pwm)->WGCTL0 & ~(3UL << (2 * i))) | ((u32ZeroLevel) << (2 * i))); \
425 (pwm)->WGCTL0 = (((pwm)->WGCTL0 & ~(3UL << (PWM_WGCTL0_PRDPCTLn_Pos + (2 * i)))) | ((u32PeriodLevel) << (PWM_WGCTL0_PRDPCTLn_Pos + (2 * i)))); \
426 (pwm)->WGCTL1 = (((pwm)->WGCTL1 & ~(3UL << (2 * i))) | ((u32CmpUpLevel) << (2 * i))); \
427 (pwm)->WGCTL1 = (((pwm)->WGCTL1 & ~(3UL << (PWM_WGCTL1_CMPDCTLn_Pos + (2 * i)))) | ((u32CmpDownLevel) << (PWM_WGCTL1_CMPDCTLn_Pos + (2 * i)))); \
428 } \
429 } \
430 }while(0)
431
444#define PWM_TRIGGER_BRAKE(pwm, u32ChannelMask, u32BrakeType) ((pwm)->SWBRK |= ((u32ChannelMask) << (u32BrakeType)))
445
456#define PWM_SET_DEADZONE_CLK_SRC(pwm, u32ChannelNum, u32AfterPrescaler) \
457 (*(__IO uint32_t *) (&((pwm)->DTCTL0_1) + ((u32ChannelNum) >> 1)) = (*(__IO uint32_t *) (&((pwm)->DTCTL0_1) + ((u32ChannelNum) >> 1)) & ~PWM_DTCTL0_1_DTCKSEL_Msk) | \
458 ((u32AfterPrescaler) << PWM_DTCTL0_1_DTCKSEL_Pos))
459
460/*---------------------------------------------------------------------------------------------------------*/
461/* Define PWM functions prototype */
462/*---------------------------------------------------------------------------------------------------------*/
463uint32_t PWM_ConfigCaptureChannel(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32UnitTimeNsec, uint32_t u32CaptureEdge);
464uint32_t PWM_ConfigOutputChannel(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Frequency, uint32_t u32DutyCycle);
465void PWM_Start(PWM_T *pwm, uint32_t u32ChannelMask);
466void PWM_Stop(PWM_T *pwm, uint32_t u32ChannelMask);
467void PWM_ForceStop(PWM_T *pwm, uint32_t u32ChannelMask);
468void PWM_EnableADCTrigger(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Condition);
469void PWM_DisableADCTrigger(PWM_T *pwm, uint32_t u32ChannelNum);
470void PWM_ClearADCTriggerFlag(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Condition);
471uint32_t PWM_GetADCTriggerFlag(PWM_T *pwm, uint32_t u32ChannelNum);
472void PWM_EnableFaultBrake(PWM_T *pwm, uint32_t u32ChannelMask, uint32_t u32LevelMask, uint32_t u32BrakeSource);
473void PWM_EnableCapture(PWM_T *pwm, uint32_t u32ChannelMask);
474void PWM_DisableCapture(PWM_T *pwm, uint32_t u32ChannelMask);
475void PWM_EnableOutput(PWM_T *pwm, uint32_t u32ChannelMask);
476void PWM_DisableOutput(PWM_T *pwm, uint32_t u32ChannelMask);
477void PWM_EnablePDMA(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32RisingFirst, uint32_t u32Mode);
478void PWM_DisablePDMA(PWM_T *pwm, uint32_t u32ChannelNum);
479void PWM_EnableDeadZone(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Duration);
480void PWM_DisableDeadZone(PWM_T *pwm, uint32_t u32ChannelNum);
481void PWM_EnableCaptureInt(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Edge);
482void PWM_DisableCaptureInt(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Edge);
483void PWM_ClearCaptureIntFlag(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Edge);
484uint32_t PWM_GetCaptureIntFlag(PWM_T *pwm, uint32_t u32ChannelNum);
485void PWM_EnableDutyInt(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32IntDutyType);
486void PWM_DisableDutyInt(PWM_T *pwm, uint32_t u32ChannelNum);
487void PWM_ClearDutyIntFlag(PWM_T *pwm, uint32_t u32ChannelNum);
488uint32_t PWM_GetDutyIntFlag(PWM_T *pwm, uint32_t u32ChannelNum);
489void PWM_EnableFaultBrakeInt(PWM_T *pwm, uint32_t u32BrakeSource);
490void PWM_DisableFaultBrakeInt(PWM_T *pwm, uint32_t u32BrakeSource);
491void PWM_ClearFaultBrakeIntFlag(PWM_T *pwm, uint32_t u32BrakeSource);
492uint32_t PWM_GetFaultBrakeIntFlag(PWM_T *pwm, uint32_t u32BrakeSource);
493void PWM_EnablePeriodInt(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32IntPeriodType);
494void PWM_DisablePeriodInt(PWM_T *pwm, uint32_t u32ChannelNum);
495void PWM_ClearPeriodIntFlag(PWM_T *pwm, uint32_t u32ChannelNum);
496uint32_t PWM_GetPeriodIntFlag(PWM_T *pwm, uint32_t u32ChannelNum);
497void PWM_EnableZeroInt(PWM_T *pwm, uint32_t u32ChannelNum);
498void PWM_DisableZeroInt(PWM_T *pwm, uint32_t u32ChannelNum);
499void PWM_ClearZeroIntFlag(PWM_T *pwm, uint32_t u32ChannelNum);
500uint32_t PWM_GetZeroIntFlag(PWM_T *pwm, uint32_t u32ChannelNum);
501void PWM_EnableAcc(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32IntFlagCnt, uint32_t u32IntAccSrc);
502void PWM_DisableAcc(PWM_T *pwm, uint32_t u32ChannelNum);
503void PWM_EnableAccInt(PWM_T *pwm, uint32_t u32ChannelNum);
504void PWM_DisableAccInt(PWM_T *pwm, uint32_t u32ChannelNum);
505void PWM_ClearAccInt(PWM_T *pwm, uint32_t u32ChannelNum);
506uint32_t PWM_GetAccInt(PWM_T *pwm, uint32_t u32ChannelNum);
507void PWM_ClearFTDutyIntFlag(PWM_T *pwm, uint32_t u32ChannelNum);
508uint32_t PWM_GetFTDutyIntFlag(PWM_T *pwm, uint32_t u32ChannelNum);
509void PWM_EnableLoadMode(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32LoadMode);
510void PWM_DisableLoadMode(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32LoadMode);
511void PWM_ConfigSyncPhase(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32SyncSrc, uint32_t u32Direction, uint32_t u32StartPhase);
512void PWM_EnableSyncPhase(PWM_T *pwm, uint32_t u32ChannelMask);
513void PWM_DisableSyncPhase(PWM_T *pwm, uint32_t u32ChannelMask);
514void PWM_EnableSyncNoiseFilter(PWM_T *pwm, uint32_t u32ClkCnt, uint32_t u32ClkDivSel);
518void PWM_SetClockSource(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32ClkSrcSel);
519void PWM_EnableBrakeNoiseFilter(PWM_T *pwm, uint32_t u32BrakePinNum, uint32_t u32ClkCnt, uint32_t u32ClkDivSel);
520void PWM_DisableBrakeNoiseFilter(PWM_T *pwm, uint32_t u32BrakePinNum);
521void PWM_EnableBrakePinInverse(PWM_T *pwm, uint32_t u32BrakePinNum);
522void PWM_DisableBrakePinInverse(PWM_T *pwm, uint32_t u32BrakePinNum);
523void PWM_SetBrakePinSource(PWM_T *pwm, uint32_t u32BrakePinNum, uint32_t u32SelAnotherModule);
524uint32_t PWM_GetWrapAroundFlag(PWM_T *pwm, uint32_t u32ChannelNum);
525void PWM_ClearWrapAroundFlag(PWM_T *pwm, uint32_t u32ChannelNum);
526
527 /* end of group PWM_EXPORTED_FUNCTIONS */
529 /* end of group PWM_Driver */
531 /* end of group Standard_Driver */
533
534#ifdef __cplusplus
535}
536#endif
537
538#endif //__PWM_H__
539
void PWM_ClearZeroIntFlag(PWM_T *pwm, uint32_t u32ChannelNum)
Clear zero interrupt of selected channel.
Definition: pwm.c:812
void PWM_ForceStop(PWM_T *pwm, uint32_t u32ChannelMask)
Stop PWM generation immediately by clear channel enable bit.
Definition: pwm.c:215
void PWM_Stop(PWM_T *pwm, uint32_t u32ChannelMask)
Stop PWM module.
Definition: pwm.c:193
void PWM_EnableSyncPhase(PWM_T *pwm, uint32_t u32ChannelMask)
Enable SYNC phase of selected channel(s)
Definition: pwm.c:1041
void PWM_EnableCapture(PWM_T *pwm, uint32_t u32ChannelMask)
Enable capture of selected channel(s)
Definition: pwm.c:399
void PWM_EnablePDMA(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32RisingFirst, uint32_t u32Mode)
Enables PDMA transfer of selected channel for PWM capture.
Definition: pwm.c:466
void PWM_EnableDeadZone(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Duration)
Enable Dead zone of selected channel.
Definition: pwm.c:501
void PWM_ClearCaptureIntFlag(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Edge)
Clear capture interrupt of selected channel.
Definition: pwm.c:570
void PWM_ClearADCTriggerFlag(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Condition)
Clear selected channel trigger EADC flag.
Definition: pwm.c:291
void PWM_DisableADCTrigger(PWM_T *pwm, uint32_t u32ChannelNum)
Disable selected channel to trigger EADC.
Definition: pwm.c:269
uint32_t PWM_ConfigCaptureChannel(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32UnitTimeNsec, uint32_t u32CaptureEdge)
Configure PWM capture and get the nearest unit time.
Definition: pwm.c:38
void PWM_EnableBrakeNoiseFilter(PWM_T *pwm, uint32_t u32BrakePinNum, uint32_t u32ClkCnt, uint32_t u32ClkDivSel)
Enable PWM brake noise filter function.
Definition: pwm.c:1181
void PWM_DisablePeriodInt(PWM_T *pwm, uint32_t u32ChannelNum)
Disable period interrupt of selected channel.
Definition: pwm.c:740
void PWM_EnableDutyInt(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32IntDutyType)
Enable duty interrupt of selected channel.
Definition: pwm.c:604
uint32_t PWM_GetAccInt(PWM_T *pwm, uint32_t u32ChannelNum)
Get interrupt flag accumulator interrupt of selected channel.
Definition: pwm.c:930
uint32_t PWM_GetFaultBrakeIntFlag(PWM_T *pwm, uint32_t u32BrakeSource)
This function get fault brake interrupt flag of selected source.
Definition: pwm.c:711
uint32_t PWM_GetFTDutyIntFlag(PWM_T *pwm, uint32_t u32ChannelNum)
Get free trigger duty interrupt flag of selected channel.
Definition: pwm.c:960
void PWM_ClearFTDutyIntFlag(PWM_T *pwm, uint32_t u32ChannelNum)
Clear free trigger duty interrupt flag of selected channel.
Definition: pwm.c:944
void PWM_DisableCaptureInt(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Edge)
Disable capture interrupt of selected channel.
Definition: pwm.c:553
void PWM_DisableFaultBrakeInt(PWM_T *pwm, uint32_t u32BrakeSource)
This function disable fault brake interrupt.
Definition: pwm.c:680
uint32_t PWM_ConfigOutputChannel(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Frequency, uint32_t u32DutyCycle)
This function Configure PWM generator and get the nearest frequency in edge aligned auto-reload mode.
Definition: pwm.c:102
void PWM_DisableLoadMode(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32LoadMode)
Disable load mode of selected channel.
Definition: pwm.c:996
void PWM_ConfigSyncPhase(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32SyncSrc, uint32_t u32Direction, uint32_t u32StartPhase)
Configure synchronization phase of selected channel.
Definition: pwm.c:1020
void PWM_DisableSyncNoiseFilter(PWM_T *pwm)
Disable PWM SYNC_IN noise filter function.
Definition: pwm.c:1109
void PWM_DisableBrakeNoiseFilter(PWM_T *pwm, uint32_t u32BrakePinNum)
Disable PWM brake noise filter function.
Definition: pwm.c:1196
void PWM_SetClockSource(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32ClkSrcSel)
Set PWM clock source.
Definition: pwm.c:1156
uint32_t PWM_GetADCTriggerFlag(PWM_T *pwm, uint32_t u32ChannelNum)
Get selected channel trigger EADC flag.
Definition: pwm.c:306
void PWM_DisableCapture(PWM_T *pwm, uint32_t u32ChannelMask)
Disable capture of selected channel(s)
Definition: pwm.c:415
void PWM_ClearWrapAroundFlag(PWM_T *pwm, uint32_t u32ChannelNum)
Clear the time-base counter reached its maximum value flag of selected channel.
Definition: pwm.c:1269
uint32_t PWM_GetZeroIntFlag(PWM_T *pwm, uint32_t u32ChannelNum)
Get zero interrupt of selected channel.
Definition: pwm.c:828
void PWM_EnableAcc(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32IntFlagCnt, uint32_t u32IntAccSrc)
Enable interrupt flag accumulator of selected channel.
Definition: pwm.c:853
void PWM_DisableDutyInt(PWM_T *pwm, uint32_t u32ChannelNum)
Disable duty interrupt of selected channel.
Definition: pwm.c:618
void PWM_EnableBrakePinInverse(PWM_T *pwm, uint32_t u32BrakePinNum)
Enable PWM brake pin inverse function.
Definition: pwm.c:1210
void PWM_EnableLoadMode(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32LoadMode)
Enable load mode of selected channel.
Definition: pwm.c:978
void PWM_ClearDutyIntFlag(PWM_T *pwm, uint32_t u32ChannelNum)
Clear duty interrupt flag of selected channel.
Definition: pwm.c:632
void PWM_EnablePeriodInt(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32IntPeriodType)
Enable period interrupt of selected channel.
Definition: pwm.c:726
void PWM_EnableFaultBrake(PWM_T *pwm, uint32_t u32ChannelMask, uint32_t u32LevelMask, uint32_t u32BrakeSource)
This function enable fault brake of selected channel(s)
Definition: pwm.c:335
uint32_t PWM_GetDutyIntFlag(PWM_T *pwm, uint32_t u32ChannelNum)
Get duty interrupt flag of selected channel.
Definition: pwm.c:648
void PWM_DisableDeadZone(PWM_T *pwm, uint32_t u32ChannelNum)
Disable Dead zone of selected channel.
Definition: pwm.c:518
void PWM_ClearAccInt(PWM_T *pwm, uint32_t u32ChannelNum)
Clear interrupt flag accumulator interrupt of selected channel.
Definition: pwm.c:914
uint32_t PWM_GetWrapAroundFlag(PWM_T *pwm, uint32_t u32ChannelNum)
Get the time-base counter reached its maximum value flag of selected channel.
Definition: pwm.c:1255
void PWM_EnableAccInt(PWM_T *pwm, uint32_t u32ChannelNum)
Enable interrupt flag accumulator interrupt of selected channel.
Definition: pwm.c:884
void PWM_DisableOutput(PWM_T *pwm, uint32_t u32ChannelMask)
Disables PWM output generation of selected channel(s)
Definition: pwm.c:446
void PWM_SetBrakePinSource(PWM_T *pwm, uint32_t u32BrakePinNum, uint32_t u32SelAnotherModule)
Set PWM brake pin source.
Definition: pwm.c:1239
void PWM_DisableAcc(PWM_T *pwm, uint32_t u32ChannelNum)
Disable interrupt flag accumulator of selected channel.
Definition: pwm.c:869
void PWM_ClearFaultBrakeIntFlag(PWM_T *pwm, uint32_t u32BrakeSource)
This function clear fault brake interrupt of selected source.
Definition: pwm.c:695
void PWM_EnableZeroInt(PWM_T *pwm, uint32_t u32ChannelNum)
Enable zero interrupt of selected channel.
Definition: pwm.c:784
void PWM_DisablePDMA(PWM_T *pwm, uint32_t u32ChannelNum)
Disables PDMA transfer of selected channel for PWM capture.
Definition: pwm.c:484
void PWM_DisableSyncPinInverse(PWM_T *pwm)
Disable PWM SYNC input pin inverse function.
Definition: pwm.c:1135
void PWM_Start(PWM_T *pwm, uint32_t u32ChannelMask)
Start PWM module.
Definition: pwm.c:178
void PWM_DisableZeroInt(PWM_T *pwm, uint32_t u32ChannelNum)
Disable zero interrupt of selected channel.
Definition: pwm.c:798
void PWM_DisableBrakePinInverse(PWM_T *pwm, uint32_t u32BrakePinNum)
Disable PWM brake pin inverse function.
Definition: pwm.c:1224
void PWM_ClearPeriodIntFlag(PWM_T *pwm, uint32_t u32ChannelNum)
Clear period interrupt of selected channel.
Definition: pwm.c:754
void PWM_EnableOutput(PWM_T *pwm, uint32_t u32ChannelMask)
Enables PWM output generation of selected channel(s)
Definition: pwm.c:431
void PWM_DisableSyncPhase(PWM_T *pwm, uint32_t u32ChannelMask)
Disable SYNC phase of selected channel(s)
Definition: pwm.c:1064
void PWM_EnableFaultBrakeInt(PWM_T *pwm, uint32_t u32BrakeSource)
This function enable fault brake interrupt.
Definition: pwm.c:664
void PWM_EnableSyncPinInverse(PWM_T *pwm)
Enable PWM SYNC input pin inverse function.
Definition: pwm.c:1122
void PWM_DisableAccInt(PWM_T *pwm, uint32_t u32ChannelNum)
Disable interrupt flag accumulator interrupt of selected channel.
Definition: pwm.c:899
uint32_t PWM_GetCaptureIntFlag(PWM_T *pwm, uint32_t u32ChannelNum)
Get capture interrupt of selected channel.
Definition: pwm.c:587
uint32_t PWM_GetPeriodIntFlag(PWM_T *pwm, uint32_t u32ChannelNum)
Get period interrupt of selected channel.
Definition: pwm.c:770
void PWM_EnableSyncNoiseFilter(PWM_T *pwm, uint32_t u32ClkCnt, uint32_t u32ClkDivSel)
Enable PWM SYNC_IN noise filter function.
Definition: pwm.c:1095
void PWM_EnableCaptureInt(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Edge)
Enable capture interrupt of selected channel.
Definition: pwm.c:536
void PWM_EnableADCTrigger(PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Condition)
Enable selected channel to trigger EADC.
Definition: pwm.c:246
Definition: M4521.h:4525