Thursday, October 9, 2008

proposed hardware interface

here is a proposal for the hardware interface.
comments please

/**************************************
*movement types
*LINEAR is the expected movement
*COS starts out full speed and tapers to 0
*SIN is the opposite
**************************************/
#define LINEAR 0
#define COS 1
#define SIN 2
/**************************************
*enumeration of the axis movement selected
*allows for easy scaling later
**************************************/
#define AXIS_X 0
#define AXIS_Y 1
#define AXIS_Z 2
/**************************************
*sets the feedrate
*@param feedrate feedrate in steps/min
**************************************/
void set_feedrate(float feedrate);

/**************************************
*this queues up a move to be executed upon call of start()
*if feedrate is set to 0, movements will happen at maximum rate.
*@param axis The axis to move.
*@param destination final location for this axis (in steps)
*@param movement_type specifies the movement rate modifier
*@param degrees_start specifies where on the sin/cos curve to start (required if movement_type != 0)
*@param degrees_end specifies where on the sin/cos curve to end (required if movement_type != 0)
**************************************/
void add_move(char axis, long destination);
void add move(char axis, long destination, char movement_type, int degrees_start, int degrees_end);

/**************************************
* call this to start a movement.
* this is only called after all axis movements are entered.
* @return 0 upon success, non zero if error
**************************************/
int start();

/**************************************
*returns the current location of the axis (in steps)
*@param axis axis to read
*@return selected axis location in steps from home
***************************************/
long get_axis_location(char axis);

/**************************************
*gets status of machine
*returns 1 if all systems go.
*@return status bits
**************************************/
unsigned int status();

No comments: