lpc_lib_pwm.h

来自「使用embest IDE开发工具开发的基于LPC2294 的触摸屏开发」· C头文件 代码 · 共 52 行

H
52
字号
// (--------------------- 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 + =
减小字号Ctrl + -
显示快捷键?