-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStepper.h
61 lines (40 loc) · 951 Bytes
/
Stepper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
* Stepper.h
*
* Created on: Nov 1, 2016
* Author: nem
*/
#ifndef STEPPER_H_
#define STEPPER_H_
#include <basictypes.h>
#define STEPPER_MODE_FULL_STEP 0
#define STEPPER_MODE_HALF_STEP 1
#define STEPPER_OFF 0
#define STEPPER_ON 1
#define STEPS_PER_ROTATION_FULL_STEP_MODE 100
#define STEPS_PER_ROTATION_HALF_STEP_MODE 200
#define CLOCKWISE 1
#define COUNTER_CLOCKWISE 0
#define STEPPER_ENABLE J2[37]
#define STEPPER_MODE J2[38]
#define STEPPER_CLK J2[39]
#define STEPPER_DIR J2[40]
class Stepper {
public:
Stepper();
virtual ~Stepper();
void Step(BYTE direction, WORD steps);
void Disable(void);
void Enable(void);
BYTE GetState(void);
void SetMode (BYTE mode);
BYTE GetMode(void);
void SetDirection(BYTE direction);
BYTE GetDirection(void);
void Init(BYTE mode);
private:
BYTE state; // running or stopped
BYTE motor_mode; // half or full
BYTE direction; // CW or CCW
};
#endif /* STEPPER_H_ */