PAN1080 Peripheral API
Modules | Macros | Functions
Pwm Interface

Pwm Interface. More...

Collaboration diagram for Pwm Interface:

Modules

 Pwm channel number
 Pwm channel number constants definitions.
 
 Pwm clk divider
 Pwm clk divider constants definitions.
 
 Pwm aligned type
 Pwm aligned type constants definitions.
 
 Pwm period interrupt condition
 Pwm period interrupt trigger condition constants definitions.
 
 Pwm operate type
 Pwm operate type constants definitions.
 
 Pwm count mode
 Pwm count mode constants definitions.
 

Macros

#define PWM_CHANNEL_NUM   (8)
 

Functions

__STATIC_INLINE void PWM_EnableOutput (PWM_T *pwm, uint32_t u32ChannelMask)
 This function enables PWM output generation of selected channels. More...
 
__STATIC_INLINE void PWM_DisableOutput (PWM_T *pwm, uint32_t u32ChannelMask)
 This function disables PWM output generation of selected channels. More...
 
__STATIC_INLINE void PWM_EnableDeadZone (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Duration)
 This function enable Dead zone of selected channel. More...
 
__STATIC_INLINE void PWM_DisableDeadZone (PWM_T *pwm, uint32_t u32ChannelNum)
 This function disable Dead zone of selected channel. More...
 
__STATIC_INLINE void PWM_EnableCMPDInt (PWM_T *pwm, uint32_t u32ChannelNum)
 This function enable Compare_Down interrupt of selected channel. More...
 
__STATIC_INLINE void PWM_DisableCMPDInt (PWM_T *pwm, uint32_t u32ChannelNum)
 This function disable Compare_Down interrupt of selected channel. More...
 
__STATIC_INLINE void PWM_ClearCMPDIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 This function clears Compare_Down interrupt flag of selected channel. More...
 
__STATIC_INLINE uint32_t PWM_GetCMPDIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 This function get Compare_Down interrupt flag of selected channel. More...
 
__STATIC_INLINE void PWM_EnablePeriodInt (PWM_T *pwm, uint32_t u32ChannelNum)
 This function enable Period interrupt of selected channel. More...
 
__STATIC_INLINE void PWM_DisablePeriodInt (PWM_T *pwm, uint32_t u32ChannelNum)
 This function disable Period interrupt of selected channel. More...
 
__STATIC_INLINE void PWM_ClearPeriodIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 This function clears Period interrupt flag of selected channel. More...
 
__STATIC_INLINE uint32_t PWM_GetPeriodIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 This function get Period interrupt flag of selected channel. More...
 
__STATIC_INLINE void PWM_EnableZeroInt (PWM_T *pwm, uint32_t u32ChannelNum)
 This function enable Zero interrupt of selected channel. More...
 
__STATIC_INLINE void PWM_DisableZeroInt (PWM_T *pwm, uint32_t u32ChannelNum)
 This function disable Zero interrupt of selected channel. More...
 
__STATIC_INLINE void PWM_ClearZeroIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 This function clears Zero interrupt flag of selected channel. More...
 
__STATIC_INLINE uint32_t PWM_GetZeroIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 This function get Zero interrupt flag of selected channel. More...
 
__STATIC_INLINE void PWM_EnableCMPUInt (PWM_T *pwm, uint32_t u32ChannelNum)
 This function enable Compare_Up interrupt of selected channel. More...
 
__STATIC_INLINE void PWM_DisableCMPUInt (PWM_T *pwm, uint32_t u32ChannelNum)
 This function disable Compare_Up interrupt of selected channel. More...
 
__STATIC_INLINE void PWM_ClearCMPUIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 This function clears Compare_Up interrupt flag of selected channel. More...
 
__STATIC_INLINE uint32_t PWM_GetCMPUIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 This function get Compare_Up interrupt flag of selected channel. More...
 
__STATIC_INLINE void PWM_EnableCenterInt (PWM_T *pwm, uint32_t u32ChannelNum, PWM_IntPeriodTypeDef IntPeriodType)
 This function enable Central interrupt of selected channel. More...
 
__STATIC_INLINE void PWM_DisableCenterInt (PWM_T *pwm, uint32_t u32ChannelNum)
 This function disable Central interrupt of selected channel. More...
 
__STATIC_INLINE void PWM_ClearCenterIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 This function clear Central interrupt of selected channel. More...
 
__STATIC_INLINE uint32_t PWM_GetCenterIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 This function get Central interrupt of selected channel. More...
 
__STATIC_INLINE void PWM_EnableIndependentMode (PWM_T *pwm)
 This function enable independent mode. More...
 
__STATIC_INLINE void PWM_EnableComplementaryMode (PWM_T *pwm)
 This function enable complementary mode. More...
 
__STATIC_INLINE void PWM_DisableComplementaryMode (PWM_T *pwm)
 This function disable complementary mode, and enable independent mode. More...
 
__STATIC_INLINE void PWM_EnableGroupMode (PWM_T *pwm)
 This function enable group mode. More...
 
__STATIC_INLINE void PWM_DisableGroupMode (PWM_T *pwm)
 This function disable group mode. More...
 
__STATIC_INLINE void PWM_EnableSyncMode (PWM_T *pwm)
 This function enable synchronous mode. More...
 
__STATIC_INLINE void PWM_DisableSyncMode (PWM_T *pwm)
 This function disable synchronous mode, and enable independent mode. More...
 
__STATIC_INLINE void PWM_SetPrescaler (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Prescaler)
 This function set the prescaler of the selected channel. More...
 
__STATIC_INLINE void PWM_ResetPrescaler (PWM_T *pwm, uint32_t u32ChannelNum)
 This function reset the prescaler of the selected channel. More...
 
__STATIC_INLINE void PWM_SetDivider (PWM_T *pwm, uint32_t u32ChannelNum, PWM_ClkDivDef Divider)
 This function set the divider of the selected channel. More...
 
__STATIC_INLINE void PWM_SetCMR (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32CMR)
 This function set the duty of the selected channel. More...
 
__STATIC_INLINE void PWM_SetCNR (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32CNR)
 This function set the period of the selected channel. More...
 
__STATIC_INLINE void PWM_SetCMRD (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32CMRD)
 This function set the duty of the selected channel for PWM asymmetric Mode. More...
 
__STATIC_INLINE void PWM_SetAlignedType (PWM_T *pwm, uint32_t u32ChannelMask, PWM_AlignedTypeDef AlignedType)
 This function set the PWM aligned type. More...
 
__STATIC_INLINE void PWM_EnableAsymmetricMode (PWM_T *pwm)
 This function enables PWM asymmetric mode. More...
 
__STATIC_INLINE void PWM_DisableAsymmetricMode (PWM_T *pwm)
 This function disables PWM asymmetric mode. More...
 
__STATIC_INLINE void PWM_EnablePCA (PWM_T *pwm)
 This function enables PWM Precise Center-Aligned Type. More...
 
__STATIC_INLINE void PWM_DisablePCA (PWM_T *pwm)
 This function disables PWM Precise Center-Aligned Type. More...
 
__STATIC_INLINE void PWM_SetCntMode (PWM_T *pwm, uint32_t u32ChannelNum, PWM_CntModeDef CntMode)
 This function set the CntMode of the selected channel. More...
 
uint32_t PWM_ConfigOutputChannel (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Frequency, uint32_t u32DutyCycle, PWM_OperateTypeDef OperateType)
 This function config PWM generator and get the nearest frequency in edge aligned auto-reload mode. More...
 
void PWM_Start (PWM_T *pwm, uint32_t u32ChannelMask)
 This function start PWM module. More...
 
void PWM_Stop (PWM_T *pwm, uint32_t u32ChannelMask)
 This function stop PWM module. More...
 
void PWM_ForceStop (PWM_T *pwm, uint32_t u32ChannelMask)
 This function stop PWM generation immediately by clear channel enable bit. More...
 
void PWM_EnableOutputInverter (PWM_T *pwm, uint32_t u32ChannelMask)
 This function enable output inverter of specified channel(s) More...
 
void PWM_DisableOutputInverter (PWM_T *pwm, uint32_t u32ChannelMask)
 This function disable output inverter of specified channel(s) More...
 

Detailed Description

Pwm Interface.

Macro Definition Documentation

◆ PWM_CHANNEL_NUM

#define PWM_CHANNEL_NUM   (8)

PWM channel number

Function Documentation

◆ PWM_ClearCenterIntFlag()

__STATIC_INLINE void PWM_ClearCenterIntFlag ( PWM_T *  pwm,
uint32_t  u32ChannelNum 
)

This function clear Central interrupt of selected channel.

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

◆ PWM_ClearCMPDIntFlag()

__STATIC_INLINE void PWM_ClearCMPDIntFlag ( PWM_T *  pwm,
uint32_t  u32ChannelNum 
)

This function clears Compare_Down interrupt flag of selected channel.

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

◆ PWM_ClearCMPUIntFlag()

__STATIC_INLINE void PWM_ClearCMPUIntFlag ( PWM_T *  pwm,
uint32_t  u32ChannelNum 
)

This function clears Compare_Up interrupt flag of selected channel.

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

◆ PWM_ClearPeriodIntFlag()

__STATIC_INLINE void PWM_ClearPeriodIntFlag ( PWM_T *  pwm,
uint32_t  u32ChannelNum 
)

This function clears Period interrupt flag of selected channel.

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

◆ PWM_ClearZeroIntFlag()

__STATIC_INLINE void PWM_ClearZeroIntFlag ( PWM_T *  pwm,
uint32_t  u32ChannelNum 
)

This function clears Zero interrupt flag of selected channel.

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

◆ PWM_ConfigOutputChannel()

uint32_t PWM_ConfigOutputChannel ( PWM_T *  pwm,
uint32_t  u32ChannelNum,
uint32_t  u32Frequency,
uint32_t  u32DutyCycle,
PWM_OperateTypeDef  OperateType 
)

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~7
[in]u32FrequencyTarget generator frequency
[in]u32DutyCycleTarget generator duty cycle percentage. Valid range are between 0 ~ 100. 10 means 10%, 20 means 20%...
[in]OperateTypeTarget operation type.Valid value Edge-aligned,Center-Aligned,Precise Center-Aligned
Returns
Nearest frequency clock in nano second
Note
Since every two channels, (0 & 1), (2 & 3), (4 & 5), (6 & 7) shares a prescaler. Call this API to configure PWM frequency may affect existing frequency of other channel.

◆ PWM_DisableAsymmetricMode()

__STATIC_INLINE void PWM_DisableAsymmetricMode ( PWM_T *  pwm)

This function disables PWM asymmetric mode.

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

◆ PWM_DisableCenterInt()

__STATIC_INLINE void PWM_DisableCenterInt ( PWM_T *  pwm,
uint32_t  u32ChannelNum 
)

This function disable Central interrupt of selected channel.

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

◆ PWM_DisableCMPDInt()

__STATIC_INLINE void PWM_DisableCMPDInt ( PWM_T *  pwm,
uint32_t  u32ChannelNum 
)

This function disable Compare_Down interrupt of selected channel.

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

◆ PWM_DisableCMPUInt()

__STATIC_INLINE void PWM_DisableCMPUInt ( PWM_T *  pwm,
uint32_t  u32ChannelNum 
)

This function disable Compare_Up interrupt of selected channel.

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

◆ PWM_DisableComplementaryMode()

__STATIC_INLINE void PWM_DisableComplementaryMode ( PWM_T *  pwm)

This function disable complementary mode, and enable independent mode.

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

◆ PWM_DisableDeadZone()

__STATIC_INLINE void PWM_DisableDeadZone ( PWM_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~7
Returns
None

◆ PWM_DisableGroupMode()

__STATIC_INLINE void PWM_DisableGroupMode ( PWM_T *  pwm)

This function disable group mode.

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

◆ PWM_DisableOutput()

__STATIC_INLINE void PWM_DisableOutput ( PWM_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

◆ PWM_DisableOutputInverter()

void PWM_DisableOutputInverter ( PWM_T *  pwm,
uint32_t  u32ChannelMask 
)

This function disable output inverter of specified channel(s)

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

◆ PWM_DisablePCA()

__STATIC_INLINE void PWM_DisablePCA ( PWM_T *  pwm)

This function disables PWM Precise Center-Aligned Type.

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

◆ PWM_DisablePeriodInt()

__STATIC_INLINE void PWM_DisablePeriodInt ( PWM_T *  pwm,
uint32_t  u32ChannelNum 
)

This function disable Period interrupt of selected channel.

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

◆ PWM_DisableSyncMode()

__STATIC_INLINE void PWM_DisableSyncMode ( PWM_T *  pwm)

This function disable synchronous mode, and enable independent mode.

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

◆ PWM_DisableZeroInt()

__STATIC_INLINE void PWM_DisableZeroInt ( PWM_T *  pwm,
uint32_t  u32ChannelNum 
)

This function disable Zero interrupt of selected channel.

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

◆ PWM_EnableAsymmetricMode()

__STATIC_INLINE void PWM_EnableAsymmetricMode ( PWM_T *  pwm)

This function enables PWM asymmetric mode.

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

◆ PWM_EnableCenterInt()

__STATIC_INLINE void PWM_EnableCenterInt ( PWM_T *  pwm,
uint32_t  u32ChannelNum,
PWM_IntPeriodTypeDef  IntPeriodType 
)

This function enable Central interrupt of selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~7
[in]IntPeriodTypePeriod interrupt type, could be either
Returns
None
Note
All channels share the same Central interrupt type setting.

◆ PWM_EnableCMPDInt()

__STATIC_INLINE void PWM_EnableCMPDInt ( PWM_T *  pwm,
uint32_t  u32ChannelNum 
)

This function enable Compare_Down interrupt of selected channel.

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

◆ PWM_EnableCMPUInt()

__STATIC_INLINE void PWM_EnableCMPUInt ( PWM_T *  pwm,
uint32_t  u32ChannelNum 
)

This function enable Compare_Up interrupt of selected channel.

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

◆ PWM_EnableComplementaryMode()

__STATIC_INLINE void PWM_EnableComplementaryMode ( PWM_T *  pwm)

This function enable complementary mode.

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

◆ PWM_EnableDeadZone()

__STATIC_INLINE void PWM_EnableDeadZone ( PWM_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~7
[in]u32DurationDead Zone length in PWM clock count, valid values are between 0~0xFF, but 0 means there is no dead zone.
Returns
None

◆ PWM_EnableGroupMode()

__STATIC_INLINE void PWM_EnableGroupMode ( PWM_T *  pwm)

This function enable group mode.

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

◆ PWM_EnableIndependentMode()

__STATIC_INLINE void PWM_EnableIndependentMode ( PWM_T *  pwm)

This function enable independent mode.

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

◆ PWM_EnableOutput()

__STATIC_INLINE void PWM_EnableOutput ( PWM_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

◆ PWM_EnableOutputInverter()

void PWM_EnableOutputInverter ( PWM_T *  pwm,
uint32_t  u32ChannelMask 
)

This function 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

◆ PWM_EnablePCA()

__STATIC_INLINE void PWM_EnablePCA ( PWM_T *  pwm)

This function enables PWM Precise Center-Aligned Type.

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

◆ PWM_EnablePeriodInt()

__STATIC_INLINE void PWM_EnablePeriodInt ( PWM_T *  pwm,
uint32_t  u32ChannelNum 
)

This function enable Period interrupt of selected channel.

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

◆ PWM_EnableSyncMode()

__STATIC_INLINE void PWM_EnableSyncMode ( PWM_T *  pwm)

This function enable synchronous mode.

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

◆ PWM_EnableZeroInt()

__STATIC_INLINE void PWM_EnableZeroInt ( PWM_T *  pwm,
uint32_t  u32ChannelNum 
)

This function enable Zero interrupt of selected channel.

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

◆ PWM_ForceStop()

void PWM_ForceStop ( PWM_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]u32ChannelMaskCombination of enabled channels. Each bit corresponds to a channel. Bit 0 is channel 0, bit 1 is channel 1...
Returns
None

◆ PWM_GetCenterIntFlag()

__STATIC_INLINE uint32_t PWM_GetCenterIntFlag ( PWM_T *  pwm,
uint32_t  u32ChannelNum 
)

This function get Central interrupt of selected channel.

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

◆ PWM_GetCMPDIntFlag()

__STATIC_INLINE uint32_t PWM_GetCMPDIntFlag ( PWM_T *  pwm,
uint32_t  u32ChannelNum 
)

This function get Compare_Down interrupt flag of selected channel.

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

◆ PWM_GetCMPUIntFlag()

__STATIC_INLINE uint32_t PWM_GetCMPUIntFlag ( PWM_T *  pwm,
uint32_t  u32ChannelNum 
)

This function get Compare_Up interrupt flag of selected channel.

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

◆ PWM_GetPeriodIntFlag()

__STATIC_INLINE uint32_t PWM_GetPeriodIntFlag ( PWM_T *  pwm,
uint32_t  u32ChannelNum 
)

This function get Period interrupt flag of selected channel.

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

◆ PWM_GetZeroIntFlag()

__STATIC_INLINE uint32_t PWM_GetZeroIntFlag ( PWM_T *  pwm,
uint32_t  u32ChannelNum 
)

This function get Zero interrupt flag of selected channel.

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

◆ PWM_ResetPrescaler()

__STATIC_INLINE void PWM_ResetPrescaler ( PWM_T *  pwm,
uint32_t  u32ChannelNum 
)

This function reset the prescaler of the selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~7
Returns
None
Note
Every even channel N, and channel (N + 1) share a prescaler. So if channel 0 prescaler reset, channel 1 will also be affected.

◆ PWM_SetAlignedType()

__STATIC_INLINE void PWM_SetAlignedType ( PWM_T *  pwm,
uint32_t  u32ChannelMask,
PWM_AlignedTypeDef  AlignedType 
)

This function set the PWM aligned type.

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

◆ PWM_SetCMR()

__STATIC_INLINE void PWM_SetCMR ( PWM_T *  pwm,
uint32_t  u32ChannelNum,
uint32_t  u32CMR 
)

This function set the duty of the selected channel.

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

◆ PWM_SetCMRD()

__STATIC_INLINE void PWM_SetCMRD ( PWM_T *  pwm,
uint32_t  u32ChannelNum,
uint32_t  u32CMRD 
)

This function set the duty of the selected channel for PWM asymmetric Mode.

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

◆ PWM_SetCNR()

__STATIC_INLINE void PWM_SetCNR ( PWM_T *  pwm,
uint32_t  u32ChannelNum,
uint32_t  u32CNR 
)

This function set the period of the selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~7
[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

◆ PWM_SetCntMode()

__STATIC_INLINE void PWM_SetCntMode ( PWM_T *  pwm,
uint32_t  u32ChannelNum,
PWM_CntModeDef  CntMode 
)

This function set the CntMode of the selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~7
[in]CntModePWM cntmode select. Valid value 0:one shot,1:auto reload
Returns
None

◆ PWM_SetDivider()

__STATIC_INLINE void PWM_SetDivider ( PWM_T *  pwm,
uint32_t  u32ChannelNum,
PWM_ClkDivDef  Divider 
)

This function set the divider of the selected channel.

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

◆ PWM_SetPrescaler()

__STATIC_INLINE void PWM_SetPrescaler ( PWM_T *  pwm,
uint32_t  u32ChannelNum,
uint32_t  u32Prescaler 
)

This function set the prescaler of the selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~7
[in]u32PrescalerClock prescaler of specified channel. Valid values are between 1 ~ 0xFF
Returns
None
Note
Every even channel N, and channel (N + 1) share a prescaler. So if channel 0 prescaler changed, channel 1 will also be affected.

◆ PWM_Start()

void PWM_Start ( PWM_T *  pwm,
uint32_t  u32ChannelMask 
)

This function start PWM module.

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

◆ PWM_Stop()

void PWM_Stop ( PWM_T *  pwm,
uint32_t  u32ChannelMask 
)

This function stop PWM module.

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