#ifndef __PLSR_H__ #define __PLSR_H__ #include "stdint.h" /* 结构体定义,每段脉冲的参数 */ typedef struct { uint32_t Frequency ; ///<< 脉冲的频率 int32_t PulseCount; ///<< 脉冲的总数 int8_t NextPulse; ///<< 下一段脉冲是第几个 , 若为 -1 代表无下一个脉冲 uint8_t Direction; ///<< 脉冲的方向 0为正转, 1为反转 } Pulse; typedef struct { uint8_t StartPulse; ///<< 起始的脉冲段 uint8_t PulseMod; ///<< 相对模式还是绝对模式 uint8_t NowPulse; ///<< 当前处于第几段脉冲 uint8_t PrePulse; ///<< 之前处于第几段脉冲 int32_t MAX_Pulse; ///<< 最多的脉冲数 int32_t AccCount; } BaseOption; /* 变量声明 */ extern Pulse PulseOutput[10]; extern BaseOption Base; extern int32_t PulseCount; extern int32_t AllPulseCount; /* 函数声明 */ void SetFrequency(uint8_t Channel, uint32_t Frequency); void SetPulse(uint8_t Pulse, uint32_t Ferquency, int32_t Count, uint8_t Direction, int8_t NextPulse); void PulseInit(uint8_t StartPulse, uint8_t PulseMod, int32_t MAX_Pulse); void PulseStart(void); int32_t GetAcc(int32_t Start, int32_t End, int32_t AccCount); #endif