PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
setAcceleration.c
1 #include "abdrive.h"
2 
3 int abd_abs(int value);
4 
5 volatile int abd_rampStep[3];
6 volatile int abd_gotoRampStep[3];
7 
8 /*
9 void drive_setAcceleration(int ticksPerSecSq)
10 {
11  abd_rampStep[ABD_B] = ticksPerSecSq/50;
12 }
13 */
14 
15 void drive_setAcceleration(int forGotoOrSpeed, int ticksPerSecSq)
16 {
17  int accelTps2 = abd_abs(ticksPerSecSq) / 50;
18  switch(forGotoOrSpeed)
19  {
20  case FOR_SPEED:
21  {
22  abd_rampStep[ABD_B] = accelTps2;
23  }
24  case FOR_GOTO:
25  {
26  abd_gotoRampStep[ABD_B] = accelTps2;
27  }
28  }
29 }
30 
drive_setAcceleration
void drive_setAcceleration(int forGotoOrSpeed, int ticksPerSecSq)
Set the acceleration used by either drive_goto or drive_speed.
Definition: setAcceleration.c:15
FOR_SPEED
#define FOR_SPEED
This constant can be used in place of 0 to tell drive_setAcceleration and drive_setMaxVelocity to set...
Definition: abdrive.h:195
FOR_GOTO
#define FOR_GOTO
This constant can be used in place of 0 to tell drive_setAcceleration and drive_setMaxVelocity to set...
Definition: abdrive.h:184
abdrive.h
This library takes care of encoder monitoring and servo signaling, and provides a simple set of funct...