电机下压
This commit is contained in:
@@ -24,6 +24,8 @@ typedef struct{
|
||||
int count;
|
||||
int max_count;
|
||||
moter_stat stat;
|
||||
void (*fun_in_end)(void *t);
|
||||
void *t;
|
||||
}self_def;
|
||||
|
||||
|
||||
@@ -73,12 +75,42 @@ static void moter_run(void *t)
|
||||
s->stat=STOP;
|
||||
DBG_LOG("moter stoped.");
|
||||
emit moter_end_signal(s);
|
||||
if(s->fun_in_end){
|
||||
s->fun_in_end(s->t);
|
||||
s->fun_in_end=0;
|
||||
s->t=0;
|
||||
}
|
||||
}
|
||||
ev=0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>ص<EFBFBD>
|
||||
void moter_down(void (*fun)(void *t),void *t)
|
||||
{
|
||||
self_def *s=&g_self;
|
||||
if(fun){
|
||||
s->fun_in_end=fun;
|
||||
s->t=t;
|
||||
}
|
||||
moter_start(0,MOTER_MAX_COUNT-s->count);
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>ص<EFBFBD>
|
||||
void moter_up(void (*fun)(void *t),void *t)
|
||||
{
|
||||
self_def *s=&g_self;
|
||||
if(fun){
|
||||
s->fun_in_end=fun;
|
||||
s->t=t;
|
||||
}
|
||||
moter_start(0,-s->count-100);
|
||||
}
|
||||
|
||||
|
||||
void moter_start(int fre,int step_count)
|
||||
{
|
||||
self_def *s=&g_self;
|
||||
@@ -101,6 +133,7 @@ void moter_start_slot(void *t,int fre,int step_count)
|
||||
if(s->count+step_count>s->max_count)
|
||||
{
|
||||
DBG_WARN("steps count exceeded limit!,max=%d",s->max_count);
|
||||
end_irq(s);
|
||||
return ;
|
||||
}
|
||||
else{
|
||||
|
Reference in New Issue
Block a user