中级会员
 
- 积分
- 304
- 金钱
- 304
- 注册时间
- 2015-10-16
- 在线时间
- 49 小时
|
typedef struct RampGen_t //定义结构体
{
int32_t count;
int32_t XSCALE;
float out;
void (*Init)(struct RampGen_t *ramp, int32_t XSCALE);
float (*Calc)(struct RampGen_t *ramp);
void (*SetCounter)(struct RampGen_t *ramp, int32_t count);
void (*ResetCounter)(struct RampGen_t *ramp);
void (*SetScale)(struct RampGen_t *ramp, int32_t scale);
uint8_t (*IsOverflow)(struct RampGen_t *ramp);
}RampGen_t;
#define RAMP_GEN_DAFAULT \ //宏定义结构体变量?可以嘛?
{ \
.count = 0, \
.XSCALE = 0, \
.out = 0, \
.Init = &RampInit, \
.Calc = &RampCalc, \
.SetCounter = &RampSetCounter, \
.ResetCounter = &RampResetCounter, \
.SetScale = &RampSetScale, \
.IsOverflow = &RampIsOverflow, \
} \
RampGen_t LRSpeedRamp = RAMP_GEN_DAFAULT; //定义结构体变量,然后把宏定义的值赋到结构体变量中
这个程序是我看别人程序看来得,请问c语言编译有问题吗?
|
|