修改语法 typedef void *TIMER_ID; typedef void (* TAL_TIMER_CB)(void); TIMER_ID zcd_timer; void zcd_callback_func(void) {} unsigned char zero_crossing_detect_unit_sw_timer_create(TAL_TIMER_CB func, void *arg, TIMER_ID *timer_id) { //函数关联的是开启定时器,形参是时间到了执行硬件动作,并且查看是否开启硬件,初始化是开启定时器,并且返回OK if(zero_crossing_detect_unit.zcb_sw_timer_create(zcb_timer_callback, NULL, &zcd_timer) != OPRT_OK) { rt = OPRT_COM_ERROR; } return rt; }
时间: 2023-05-18 07:05:44 浏览: 149
zhsy.rar_InitStack_pop_typedef struct st
TIMER_ID *timer_id) {
// 初始化定时器并返回OK
zcd_timer = zero_crossing_detect_unit.zcb_sw_timer_create(func, arg, timer_id);
if (zcd_timer != NULL) {
return OK;
} else {
return ERROR;
}
}
// 回调函数
void zcd_callback_func(void) {}
// 定义类型
typedef void *TIMER_ID;
typedef void (*TAL_TIMER_CB)(void);
// 定义变量
TIMER_ID zcd_timer;
// 创建定时器
unsigned char zero_crossing_detect_unit_sw_timer_create(TAL_TIMER_CB func, void *arg, TIMER_ID *timer_id) {
// 调用函数创建定时器
zcd_timer = zero_crossing_detect_unit.zcb_sw_timer_create(func, arg, timer_id);
// 判断定时器是否创建成功
if (zcd_timer != NULL) {
return OK;
} else {
return ERROR;
}
}
阅读全文