1 #ifndef __STEPPER_H__JPA916UOFT__
2 #define __STEPPER_H__JPA916UOFT__
4 #include <AT91SAM7S64.h>
12 #define DIST_SCALE (2 * PPS * PPS)
17 typedef struct _StepperAccSeq StepperAccSeq;
25 #define STEPPER_ACC_INVALID LONG_MAX
27 #define STEPPER_MAX_VELOCITY 4000
28 #define STEPPER_MAX_ACCELRATION 4000
30 typedef void (*StepperUserCallback)(
unsigned int stepper_index,
31 unsigned long period);
34 typedef unsigned int StepperResult;
36 #define STEPPER_ERR_MEM 1
37 #define STEPPER_ERR_TOO_LATE 2
38 #define STEPPER_ERR_INDEX 3
41 stepper_init(AT91PS_TC
timer,
unsigned int id);
44 stepper_init_io(
unsigned int stepper_index, uint32_t mask,
45 const uint32_t *acc,
const uint32_t *run,
46 const uint32_t *hold,
unsigned int nsteps);
52 stepper_add_acc_seq(
unsigned int stepper_index, StepperAccSeq *new_seq);
55 stepper_add_acc(
unsigned int stepper_index,
unsigned int period,
long acc);
58 stepper_insert_callback(
unsigned int stepper_index,
unsigned int period);
61 stepper_set_callback_proc(StepperUserCallback callback);
64 stepper_current_period();
67 stepper_current_step(
unsigned int stepper_index);
70 stepper_step_frac(
unsigned int stepper_index);
73 stepper_current_velocity(
unsigned int stepper_index);
76 stepper_velocity(
unsigned int stepper_index,
unsigned long period);
79 stepper_state_at(
unsigned int stepper_index,
unsigned long period,
80 long *velocity,
long long *position);
83 stepper_set_velocity(
unsigned int stepper_index,
unsigned long *periodp,
84 unsigned long max_acc,
long final_speed);
87 stepper_allocate_seq();
90 stepper_free_seq(StepperAccSeq *seq);
95 stepper_timing_errors(
unsigned int stepper_index,
long *min,
long *max);