PAN1080 Peripheral API
Macros | Typedefs | Enumerations | Functions
pan_pwm.h File Reference

Panchip series pwm driver header file. More...

Go to the source code of this file.

Macros

#define PWM_CHANNEL_NUM   (8)
 
#define PWM_CH0   0x0
 
#define PWM_CH1   0x1
 
#define PWM_CH2   0x2
 
#define PWM_CH3   0x3
 
#define PWM_CH4   0x4
 
#define PWM_CH5   0x5
 
#define PWM_CH6   0x6
 
#define PWM_CH7   0x7
 

Typedefs

typedef enum _PWM_ClkDivDef PWM_ClkDivDef
 
typedef enum _PWM_AlignedTypeDef PWM_AlignedTypeDef
 
typedef enum _PWM_IntPeriodTypeDef PWM_IntPeriodTypeDef
 
typedef enum _PWM_OperateTypeDef PWM_OperateTypeDef
 
typedef enum _PWM_CntModeDef PWM_CntModeDef
 

Enumerations

enum  _PWM_ClkDivDef {
  PWM_CLK_DIV_1 = 4 , PWM_CLK_DIV_2 = 0 , PWM_CLK_DIV_4 = 1 , PWM_CLK_DIV_8 = 2 ,
  PWM_CLK_DIV_16 = 3
}
 
enum  _PWM_AlignedTypeDef { PWM_EDGE_ALIGNED = 0 , PWM_CENTER_ALIGNED = 1 }
 
enum  _PWM_IntPeriodTypeDef { PWM_PERIOD_INT_UNDERFLOW = 0 , PWM_PERIOD_INT_MATCH_CNR = 1 }
 
enum  _PWM_OperateTypeDef { OPERATION_EDGE_ALIGNED = 0x01 , OPERATION_CENTER_ALIGNED = 0x02 , OPERATION_PRECISE_CENTER_ALIGNED = 0x04 }
 
enum  _PWM_CntModeDef { PWM_CNTMODE_ONE_SHOT = 0x00 , PWM_CNTMODE_AUTO_RELOAD = 0x01 }
 

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

Panchip series pwm driver header file.

Version
V1.00
Revision
3
Date
21/11/12 18:33