M471M/R1/S BSP V3.01.000
The Board Support Package for M4521
Macros | Functions
pwm.h File Reference

M471M/R1/S PWM driver header file. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PWM_CHANNEL_NUM   (6)
 
#define PWM_CH_0_MASK
 
#define PWM_CH_1_MASK
 
#define PWM_CH_2_MASK
 
#define PWM_CH_3_MASK
 
#define PWM_CH_4_MASK
 
#define PWM_CH_5_MASK
 
#define PWM_UP_COUNTER   (0UL)
 
#define PWM_DOWN_COUNTER   (1UL)
 
#define PWM_UP_DOWN_COUNTER   (2UL)
 
#define PWM_EDGE_ALIGNED   (1UL)
 
#define PWM_CENTER_ALIGNED   (2UL)
 
#define PWM_OUTPUT_NOTHING   (0UL)
 
#define PWM_OUTPUT_LOW   (1UL)
 
#define PWM_OUTPUT_HIGH   (2UL)
 
#define PWM_OUTPUT_TOGGLE   (3UL)
 
#define PWM_TRIGGER_ADC_EVEN_ZERO_POINT   (0UL)
 
#define PWM_TRIGGER_ADC_EVEN_PERIOD_POINT   (1UL)
 
#define PWM_TRIGGER_ADC_EVEN_ZERO_OR_PERIOD_POINT   (2UL)
 
#define PWM_TRIGGER_ADC_EVEN_COMPARE_UP_COUNT_POINT   (3UL)
 
#define PWM_TRIGGER_ADC_EVEN_COMPARE_DOWN_COUNT_POINT   (4UL)
 
#define PWM_TRIGGER_ADC_ODD_ZERO_POINT   (5UL)
 
#define PWM_TRIGGER_ADC_ODD_PERIOD_POINT   (6UL)
 
#define PWM_TRIGGER_ADC_ODD_ZERO_OR_PERIOD_POINT   (7UL)
 
#define PWM_TRIGGER_ADC_ODD_COMPARE_UP_COUNT_POINT   (8UL)
 
#define PWM_TRIGGER_ADC_ODD_COMPARE_DOWN_COUNT_POINT   (9UL)
 
#define PWM_TRIGGER_ADC_CH_0_FREE_COMPARE_UP_COUNT_POINT   (10UL)
 
#define PWM_TRIGGER_ADC_CH_0_FREE_COMPARE_DOWN_COUNT_POINT   (11UL)
 
#define PWM_TRIGGER_ADC_CH_2_FREE_COMPARE_UP_COUNT_POINT   (12UL)
 
#define PWM_TRIGGER_ADC_CH_2_FREE_COMPARE_DOWN_COUNT_POINT   (13UL)
 
#define PWM_TRIGGER_ADC_CH_4_FREE_COMPARE_UP_COUNT_POINT   (14UL)
 
#define PWM_TRIGGER_ADC_CH_4_FREE_COMPARE_DOWN_COUNT_POINT   (15UL)
 
#define PWM_FB_EDGE_BKP0   (PWM_BRKCTL0_1_BRKP0EEN_Msk)
 
#define PWM_FB_EDGE_BKP1   (PWM_BRKCTL0_1_BRKP1EEN_Msk)
 
#define PWM_FB_EDGE_SYS_CSS   (PWM_BRKCTL0_1_SYSEBEN_Msk | PWM_FAILBRK_CSSBRKEN_Msk)
 
#define PWM_FB_EDGE_SYS_BOD   (PWM_BRKCTL0_1_SYSEBEN_Msk | PWM_FAILBRK_BODBRKEN_Msk)
 
#define PWM_FB_EDGE_SYS_COR   (PWM_BRKCTL0_1_SYSEBEN_Msk | PWM_FAILBRK_CORBRKEN_Msk)
 
#define PWM_FB_LEVEL_BKP0   (PWM_BRKCTL0_1_BRKP0LEN_Msk)
 
#define PWM_FB_LEVEL_BKP1   (PWM_BRKCTL0_1_BRKP1LEN_Msk)
 
#define PWM_FB_LEVEL_SYS_CSS   (PWM_BRKCTL0_1_SYSLBEN_Msk | PWM_FAILBRK_CSSBRKEN_Msk)
 
#define PWM_FB_LEVEL_SYS_BOD   (PWM_BRKCTL0_1_SYSLBEN_Msk | PWM_FAILBRK_BODBRKEN_Msk)
 
#define PWM_FB_LEVEL_SYS_COR   (PWM_BRKCTL0_1_SYSLBEN_Msk | PWM_FAILBRK_CORBRKEN_Msk)
 
#define PWM_FB_EDGE   (0UL)
 
#define PWM_FB_LEVEL   (8UL)
 
#define PWM_CAPTURE_INT_RISING_LATCH   (1UL)
 
#define PWM_CAPTURE_INT_FALLING_LATCH   (0x100UL)
 
#define PWM_CAPTURE_PDMA_RISING_LATCH   (0x2UL)
 
#define PWM_CAPTURE_PDMA_FALLING_LATCH   (0x4UL)
 
#define PWM_CAPTURE_PDMA_RISING_FALLING_LATCH   (0x6UL)
 
#define PWM_DUTY_INT_DOWN_COUNT_MATCH_CMP   (PWM_INTEN0_CMPDIEN0_Msk)
 
#define PWM_DUTY_INT_UP_COUNT_MATCH_CMP   (PWM_INTEN0_CMPUIEN0_Msk)
 
#define PWM_IFA_EVEN_ZERO_POINT
 
#define PWM_IFA_EVEN_PERIOD_POINT
 
#define PWM_IFA_EVEN_COMPARE_UP_COUNT_POINT
 
#define PWM_IFA_EVEN_COMPARE_DOWN_COUNT_POINT
 
#define PWM_IFA_ODD_ZERO_POINT
 
#define PWM_IFA_ODD_PERIOD_POINT
 
#define PWM_IFA_ODD_COMPARE_UP_COUNT_POINT
 
#define PWM_IFA_ODD_COMPARE_DOWN_COUNT_POINT
 
#define PWM_LOAD_MODE_IMMEDIATE
 
#define PWM_LOAD_MODE_WINDOW
 
#define PWM_LOAD_MODE_CENTER
 
#define PWM_SYNC_OUT_FROM_SYNCIN_SWSYNC
 
#define PWM_SYNC_OUT_FROM_COUNT_TO_ZERO
 
#define PWM_SYNC_OUT_FROM_COUNT_TO_COMPARATOR
 
#define PWM_SYNC_OUT_DISABLE
 
#define PWM_PHS_DIR_DECREMENT
 
#define PWM_PHS_DIR_INCREMENT
 
#define PWM_NF_CLK_DIV_1
 
#define PWM_NF_CLK_DIV_2
 
#define PWM_NF_CLK_DIV_4
 
#define PWM_NF_CLK_DIV_8
 
#define PWM_NF_CLK_DIV_16
 
#define PWM_NF_CLK_DIV_32
 
#define PWM_NF_CLK_DIV_64
 
#define PWM_NF_CLK_DIV_128
 
#define PWM_CLKSRC_PWM_CLK
 
#define PWM_CLKSRC_TIMER0
 
#define PWM_CLKSRC_TIMER1
 
#define PWM_CLKSRC_TIMER2
 
#define PWM_CLKSRC_TIMER3
 
#define PWM_ENABLE_COMPLEMENTARY_MODE(pwm)
 This macro enable complementary mode. More...
 
#define PWM_DISABLE_COMPLEMENTARY_MODE(pwm)
 This macro disable complementary mode, and enable independent mode. More...
 
#define PWM_ENABLE_GROUP_MODE(pwm)
 This macro enable group mode. More...
 
#define PWM_DISABLE_GROUP_MODE(pwm)
 This macro disable group mode. More...
 
#define PWM_ENABLE_TIMER_SYNC(pwm, u32ChannelMask)
 Enable timer synchronous mode of specified channel(s) More...
 
#define PWM_DISABLE_TIMER_SYNC(pwm, u32ChannelMask)
 Disable timer synchronous mode of specified channel(s) More...
 
#define PWM_ENABLE_OUTPUT_INVERTER(pwm, u32ChannelMask)
 This macro enable output inverter of specified channel(s) More...
 
#define PWM_GET_CAPTURE_RISING_DATA(pwm, u32ChannelNum)
 This macro get captured rising data. More...
 
#define PWM_GET_CAPTURE_FALLING_DATA(pwm, u32ChannelNum)
 This macro get captured falling data. More...
 
#define PWM_MASK_OUTPUT(pwm, u32ChannelMask, u32LevelMask)
 This macro mask output logic to high or low. More...
 
#define PWM_SET_PRESCALER(pwm, u32ChannelNum, u32Prescaler)
 This macro set the prescaler of the selected channel. More...
 
#define PWM_SET_CMR(pwm, u32ChannelNum, u32CMR)
 This macro set the comparator of the selected channel. More...
 
#define PWM_SET_FTCMR(pwm, u32ChannelNum, u32FTCMR)
 This macro set the free trigger comparator of the selected channel. More...
 
#define PWM_SET_CNR(pwm, u32ChannelNum, u32CNR)
 This macro set the period of the selected channel. More...
 
#define PWM_SET_ALIGNED_TYPE(pwm, u32ChannelMask, u32AlignedType)
 This macro set the PWM aligned type. More...
 
#define PWM_SET_LOAD_WINDOW(pwm, u32ChannelMask)
 Set load window of window loading mode for specified channel(s) More...
 
#define PWM_TRIGGER_SYNC(pwm, u32ChannelNum)
 Trigger synchronous event from specified channel(s) More...
 
#define PWM_CLR_COUNTER(pwm, u32ChannelMask)
 Clear counter of specified channel(s) More...
 
#define PWM_SET_OUTPUT_LEVEL(pwm, u32ChannelMask, u32ZeroLevel, u32CmpUpLevel, u32PeriodLevel, u32CmpDownLevel)
 Set output level at zero, compare up, period(center) and compare down of specified channel(s) More...
 
#define PWM_TRIGGER_BRAKE(pwm, u32ChannelMask, u32BrakeType)
 Trigger brake event from specified channel(s) More...
 
#define PWM_SET_DEADZONE_CLK_SRC(pwm, u32ChannelNum, u32AfterPrescaler)
 Set Dead zone clock source. More...
 

Functions

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. More...
 
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. More...
 
void PWM_Start (PWM_T *pwm, uint32_t u32ChannelMask)
 Start PWM module. More...
 
void PWM_Stop (PWM_T *pwm, uint32_t u32ChannelMask)
 Stop PWM module. More...
 
void PWM_ForceStop (PWM_T *pwm, uint32_t u32ChannelMask)
 Stop PWM generation immediately by clear channel enable bit. More...
 
void PWM_EnableADCTrigger (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Condition)
 Enable selected channel to trigger EADC. More...
 
void PWM_DisableADCTrigger (PWM_T *pwm, uint32_t u32ChannelNum)
 Disable selected channel to trigger EADC. More...
 
void PWM_ClearADCTriggerFlag (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Condition)
 Clear selected channel trigger EADC flag. More...
 
uint32_t PWM_GetADCTriggerFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 Get selected channel trigger EADC flag. More...
 
void PWM_EnableFaultBrake (PWM_T *pwm, uint32_t u32ChannelMask, uint32_t u32LevelMask, uint32_t u32BrakeSource)
 This function enable fault brake of selected channel(s) More...
 
void PWM_EnableCapture (PWM_T *pwm, uint32_t u32ChannelMask)
 Enable capture of selected channel(s) More...
 
void PWM_DisableCapture (PWM_T *pwm, uint32_t u32ChannelMask)
 Disable capture of selected channel(s) More...
 
void PWM_EnableOutput (PWM_T *pwm, uint32_t u32ChannelMask)
 Enables PWM output generation of selected channel(s) More...
 
void PWM_DisableOutput (PWM_T *pwm, uint32_t u32ChannelMask)
 Disables PWM output generation of selected channel(s) More...
 
void PWM_EnablePDMA (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32RisingFirst, uint32_t u32Mode)
 Enables PDMA transfer of selected channel for PWM capture. More...
 
void PWM_DisablePDMA (PWM_T *pwm, uint32_t u32ChannelNum)
 Disables PDMA transfer of selected channel for PWM capture. More...
 
void PWM_EnableDeadZone (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Duration)
 Enable Dead zone of selected channel. More...
 
void PWM_DisableDeadZone (PWM_T *pwm, uint32_t u32ChannelNum)
 Disable Dead zone of selected channel. More...
 
void PWM_EnableCaptureInt (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Edge)
 Enable capture interrupt of selected channel. More...
 
void PWM_DisableCaptureInt (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Edge)
 Disable capture interrupt of selected channel. More...
 
void PWM_ClearCaptureIntFlag (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Edge)
 Clear capture interrupt of selected channel. More...
 
uint32_t PWM_GetCaptureIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 Get capture interrupt of selected channel. More...
 
void PWM_EnableDutyInt (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32IntDutyType)
 Enable duty interrupt of selected channel. More...
 
void PWM_DisableDutyInt (PWM_T *pwm, uint32_t u32ChannelNum)
 Disable duty interrupt of selected channel. More...
 
void PWM_ClearDutyIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 Clear duty interrupt flag of selected channel. More...
 
uint32_t PWM_GetDutyIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 Get duty interrupt flag of selected channel. More...
 
void PWM_EnableFaultBrakeInt (PWM_T *pwm, uint32_t u32BrakeSource)
 This function enable fault brake interrupt. More...
 
void PWM_DisableFaultBrakeInt (PWM_T *pwm, uint32_t u32BrakeSource)
 This function disable fault brake interrupt. More...
 
void PWM_ClearFaultBrakeIntFlag (PWM_T *pwm, uint32_t u32BrakeSource)
 This function clear fault brake interrupt of selected source. More...
 
uint32_t PWM_GetFaultBrakeIntFlag (PWM_T *pwm, uint32_t u32BrakeSource)
 This function get fault brake interrupt flag of selected source. More...
 
void PWM_EnablePeriodInt (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32IntPeriodType)
 Enable period interrupt of selected channel. More...
 
void PWM_DisablePeriodInt (PWM_T *pwm, uint32_t u32ChannelNum)
 Disable period interrupt of selected channel. More...
 
void PWM_ClearPeriodIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 Clear period interrupt of selected channel. More...
 
uint32_t PWM_GetPeriodIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 Get period interrupt of selected channel. More...
 
void PWM_EnableZeroInt (PWM_T *pwm, uint32_t u32ChannelNum)
 Enable zero interrupt of selected channel. More...
 
void PWM_DisableZeroInt (PWM_T *pwm, uint32_t u32ChannelNum)
 Disable zero interrupt of selected channel. More...
 
void PWM_ClearZeroIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 Clear zero interrupt of selected channel. More...
 
uint32_t PWM_GetZeroIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 Get zero interrupt of selected channel. More...
 
void PWM_EnableAcc (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32IntFlagCnt, uint32_t u32IntAccSrc)
 Enable interrupt flag accumulator of selected channel. More...
 
void PWM_DisableAcc (PWM_T *pwm, uint32_t u32ChannelNum)
 Disable interrupt flag accumulator of selected channel. More...
 
void PWM_EnableAccInt (PWM_T *pwm, uint32_t u32ChannelNum)
 Enable interrupt flag accumulator interrupt of selected channel. More...
 
void PWM_DisableAccInt (PWM_T *pwm, uint32_t u32ChannelNum)
 Disable interrupt flag accumulator interrupt of selected channel. More...
 
void PWM_ClearAccInt (PWM_T *pwm, uint32_t u32ChannelNum)
 Clear interrupt flag accumulator interrupt of selected channel. More...
 
uint32_t PWM_GetAccInt (PWM_T *pwm, uint32_t u32ChannelNum)
 Get interrupt flag accumulator interrupt of selected channel. More...
 
void PWM_ClearFTDutyIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 Clear free trigger duty interrupt flag of selected channel. More...
 
uint32_t PWM_GetFTDutyIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 Get free trigger duty interrupt flag of selected channel. More...
 
void PWM_EnableLoadMode (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32LoadMode)
 Enable load mode of selected channel. More...
 
void PWM_DisableLoadMode (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32LoadMode)
 Disable load mode of selected channel. More...
 
void PWM_ConfigSyncPhase (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32SyncSrc, uint32_t u32Direction, uint32_t u32StartPhase)
 Configure synchronization phase of selected channel. More...
 
void PWM_EnableSyncPhase (PWM_T *pwm, uint32_t u32ChannelMask)
 Enable SYNC phase of selected channel(s) More...
 
void PWM_DisableSyncPhase (PWM_T *pwm, uint32_t u32ChannelMask)
 Disable SYNC phase of selected channel(s) More...
 
void PWM_EnableSyncNoiseFilter (PWM_T *pwm, uint32_t u32ClkCnt, uint32_t u32ClkDivSel)
 Enable PWM SYNC_IN noise filter function. More...
 
void PWM_DisableSyncNoiseFilter (PWM_T *pwm)
 Disable PWM SYNC_IN noise filter function. More...
 
void PWM_EnableSyncPinInverse (PWM_T *pwm)
 Enable PWM SYNC input pin inverse function. More...
 
void PWM_DisableSyncPinInverse (PWM_T *pwm)
 Disable PWM SYNC input pin inverse function. More...
 
void PWM_SetClockSource (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32ClkSrcSel)
 Set PWM clock source. More...
 
void PWM_EnableBrakeNoiseFilter (PWM_T *pwm, uint32_t u32BrakePinNum, uint32_t u32ClkCnt, uint32_t u32ClkDivSel)
 Enable PWM brake noise filter function. More...
 
void PWM_DisableBrakeNoiseFilter (PWM_T *pwm, uint32_t u32BrakePinNum)
 Disable PWM brake noise filter function. More...
 
void PWM_EnableBrakePinInverse (PWM_T *pwm, uint32_t u32BrakePinNum)
 Enable PWM brake pin inverse function. More...
 
void PWM_DisableBrakePinInverse (PWM_T *pwm, uint32_t u32BrakePinNum)
 Disable PWM brake pin inverse function. More...
 
void PWM_SetBrakePinSource (PWM_T *pwm, uint32_t u32BrakePinNum, uint32_t u32SelAnotherModule)
 Set PWM brake pin source. More...
 
uint32_t PWM_GetWrapAroundFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 Get the time-base counter reached its maximum value flag of selected channel. More...
 
void PWM_ClearWrapAroundFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 Clear the time-base counter reached its maximum value flag of selected channel. More...
 

Detailed Description

M471M/R1/S PWM driver header file.

SPDX-License-Identifier: Apache-2.0

Definition in file pwm.h.