00001 #ifndef __MOTOR_DRIVER_INTERFACE_H__ 00002 #define __MOTOR_DRIVER_INTERFACE_H__ 00003 00027 #include "mcdc3006s_data.h" 00028 00029 class MotorDriverInterface { 00030 public: 00034 MotorDriverInterface() 00035 { 00036 } 00037 00041 virtual ~MotorDriverInterface() 00042 { 00043 } 00044 00048 virtual int init(int baudrate, char *dev, char *sem) = 0; 00049 00055 virtual int enableDriver() = 0; 00056 00062 virtual int disableDriver() = 0; 00063 00075 virtual int getDriverConf(driverConf_t *dc) = 0; 00076 00083 virtual int setDriverConf(driverConf_t dc) = 0; 00084 00098 virtual int saveToFlash() = 0; 00099 00100 /* set configuration to the driver */ 00101 00112 virtual int activateLimits(int action) = 0; 00113 00114 /* get configuration from the driver */ 00115 00126 virtual long int getDriverMaxPos() = 0; 00127 00136 virtual long int getDriverMinPos() = 0; 00137 00147 virtual long int getDriverMaxVel() = 0; 00148 00157 virtual long int getDriverMaxAcc() = 0; 00158 00169 virtual long int getDriverMaxDec() = 0; 00170 00181 virtual int getDriverCurLim() = 0; 00182 00193 virtual int getDriverPCurLim() = 0; 00194 00195 /* get status from the driver */ 00196 00203 virtual int getDriverStatus(driverStatus_t * drvStatus) = 0; 00204 00205 /* get motorSensor from the driver */ 00206 00213 virtual int getDriverSensor(driverSensor_t *sensor) = 0; 00214 00221 virtual int getDriverInstantPos(long int *positon) = 0; 00222 00229 virtual int getDriverInstantVel(long int *velocity) = 0; 00230 00238 virtual int getDriverInstantCurrent(int *current) = 0; 00239 00248 virtual int setDriverMaxPos(long int maxPos) = 0; 00249 00258 virtual int setDriverMinPos(long int minPos) = 0; 00259 00266 virtual int setDriverMaxVel(long int maxVel) = 0; 00267 00274 virtual int setDriverMaxAcc(long int maxAcc) = 0; 00275 00283 virtual int setDriverMaxDec(long int maxDec) = 0; 00284 00291 virtual int setDriverCurLim(int cl) = 0; 00292 00299 virtual int setDriverPCurLim(int pcl) = 0; 00300 00308 virtual int setDriverBaud(int baud) = 0; 00309 00310 /* direct movement */ 00311 00318 virtual int moveDriverAbsPos(long int pos) = 0; 00319 00326 virtual int moveDriverRelPos(long int pos) = 0; 00327 00334 virtual int moveDriverVel(long int vel) = 0; 00335 00336 /* Calibrate Driver */ 00337 00348 virtual int setDriverHomePosition(long int home) = 0; 00349 00364 virtual int calibrateDriver(long int limit, int current_limit, int calibration_speed, int time_out) = 0; 00365 }; 00366 00367 #endif