CH552/projects/examples/PWM/PWM.H

27 lines
1.6 KiB
C++
Raw Normal View History

2018-10-17 10:44:45 +02:00
#define PWM_INTERRUPT 1
#if PWM_INTERRUPT
extern void PWMInterruptEnable(); //PWM<57>ж<EFBFBD>ʹ<EFBFBD><CAB9>
#endif
#define SetPWMClk(CK_SE) (PWM_CK_SE = CK_SE) //<2F><>Ƶ,Ĭ<><C4AC>ʱ<EFBFBD><CAB1>Fsys
#define SetPWM1Dat(dat) (PWM_DATA1 = dat) //<2F><><EFBFBD><EFBFBD>PWM<57><4D><EFBFBD><EFBFBD>ռ<EFBFBD>ձ<EFBFBD>
#define SetPWM2Dat(dat) (PWM_DATA2 = dat)
#define PWM1PINAlter( ) {PIN_FUNC |= bPWM1_PIN_X;} //PWMӳ<4D><D3B3><EFBFBD><EFBFBD>P30
#define PWM2PINAlter( ) {PIN_FUNC |= bPWM2_PIN_X;} //PWMӳ<4D><D3B3><EFBFBD><EFBFBD>P31
#define ForceClearPWMFIFO( ) {PWM_CTRL |= bPWM_CLR_ALL;} //ǿ<><C7BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>PWM FIFO<46><4F>COUNT
#define CancleClearPWMFIFO( ) {PWM_CTRL &= ~bPWM_CLR_ALL;} //ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>PWM FIFO<46><4F>COUNT
#define PWM1OutEnable() (PWM_CTRL |= bPWM1_OUT_EN) //<2F><><EFBFBD><EFBFBD>PWM1<4D><31><EFBFBD><EFBFBD>
#define PWM2OutEnable() (PWM_CTRL |= bPWM2_OUT_EN) //<2F><><EFBFBD><EFBFBD>PWM2<4D><32><EFBFBD><EFBFBD>
#define DsiablePWM1Out() (PWM_CTRL &= ~bPWM1_OUT_EN) //<2F>ر<EFBFBD>PWM1<4D><31><EFBFBD><EFBFBD>
#define DisablePWM2Out() (PWM_CTRL &= ~bPWM2_OUT_EN) //<2F>ر<EFBFBD>PWM2<4D><32><EFBFBD><EFBFBD>
#define PWM1OutPolarHighAct()(PWM_CTRL &= ~bPWM1_POLAR) //PWM1<4D><31><EFBFBD><EFBFBD>Ĭ<EFBFBD>ϵͣ<CFB5><CDA3><EFBFBD><EFBFBD><EFBFBD>Ч
#define PWM2OutPolarHighAct()(PWM_CTRL &= ~bPWM2_POLAR) //PWM2<4D><32><EFBFBD><EFBFBD>Ĭ<EFBFBD>ϵͣ<CFB5><CDA3><EFBFBD><EFBFBD><EFBFBD>Ч
#define PWM1OutPolarLowAct() (PWM_CTRL |= bPWM1_POLAR) //PWM1<4D><31><EFBFBD><EFBFBD>Ĭ<EFBFBD>ϸߣ<CFB8><DFA3><EFBFBD><EFBFBD><EFBFBD>Ч
#define PWM2OutPolarLowAct() (PWM_CTRL |= bPWM2_POLAR) //PWM2<4D><32><EFBFBD><EFBFBD>Ĭ<EFBFBD>ϸߣ<CFB8><DFA3><EFBFBD><EFBFBD><EFBFBD>Ч