📄 lpc_lib_pwm.h
字号:
// (--------------------- compiler condition --------------------------
#ifndef lpc_lib_pwm_h
#define lpc_lib_pwm_h
#include "..\..\com\type_redefine.h"
#include "..\..\com\lpc22xx_register.h"
#include "..\..\com\lpc_lib_pll\lpc_lib_pll.h"
#define P0_0_PWM1_EN (0x02) //10
#define P0_7_PWM2_EN (0x02<<14) //10
#define P0_1_PWM3_EN (0x02<<2) //10
#define P0_8_PWM4_EN (0x02<<16) //10
#define P0_21_PWM5_EN (0x02<<10) //10
#define P0_9_PWM6_EN (0x02<<18) //10
// the mask of control bit
#define P0_0_PWM1_MASK (0x03) //11
#define P0_7_PWM2_MASK (0x03<<14) //11
#define P0_1_PWM3_MASK (0x03<<2) //11
#define P0_8_PWM4_MASK (0x03<<16) //11
#define P0_21_PWM5_MASK (0x03<<10) //11
#define P0_9_PWM6_MASK (0x03<<18) //11
#define PWMPR 2
typedef enum { pwm1,pwm2,pwm3,pwm4,pwm5,pwm6} pwm_sel;
/*
struct pwm_pulse_para{
pwm_sel channel;
INT32U pulse_f;
FP32 pulse_prop;
};
*/
void pwm_init(INT8U edge,pwm_sel channel,INT8U onoff);
void pwm_set_f(INT32U f);
void pwm_single_edge(pwm_sel channel,INT32U f,FP32 pulse_prop);
void pwm_double_edge(pwm_sel channel,INT32U f,INT32U polarity,FP32 pulse_prop,FP32 pulse_position);
void pwm_enable(void);
void pwm_close(void);
//void pwm_pulse(struct pwm_pulse_para pulse);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -