1 #ifndef __STEPPER3_INTERRUPT_H__2MHD6D6PQ1__
2 #define __STEPPER3_INTERRUPT_H__2MHD6D6PQ1__
7 #define TIMER_FREQ 748800
9 typedef struct _StepperContext StepperContext;
10 typedef struct _StepperState StepperState;
11 typedef struct _StepperTimerStep StepperTimerStep;
13 #define MAX_STEPS_PER_PERIOD 40
14 #define NUM_STEPPERS 2
16 #define STEPPER_MAX_VELOCITY 4000
17 #define STEPPER_MAX_ACCELRATION 4000
26 const uint32_t *acc_steps;
27 const uint32_t *run_steps;
28 const uint32_t *hold_steps;
30 uint8_t sequence_length;
39 StepperAccSeq *acceleration_sequence;
47 #define STEPPER_POWER_ACC 30
48 #define STEPPER_POWER_RUN 20
49 #define STEPPER_POWER_HOLD 10
50 #define STEPPER_POWER_OFF 0
52 #define STEPPER_DIRECTION_NONE 0
53 #define STEPPER_DIRECTION_FORWARD 1
54 #define STEPPER_DIRECTION_BACKWARD 2
56 struct _StepperTimerStep
58 StepperTimerStep *
next;
66 struct _StepperContext
69 unsigned long period_count;
70 AT91PS_TC timer_channel;
71 StepperState steppers[NUM_STEPPERS];
72 StepperTimerStep *steps;
73 StepperTimerStep *current_step;
74 StepperUserCallback user_callback;
77 extern StepperContext stepper_context;
80 void stepper_timer_interrupt(
void);