91
91
Stepper::Stepper (unsigned number_of_steps, int motor_pin_0, int motor_pin_1)
92
92
{
93
93
initMotor (number_of_steps, motor_pin_0, motor_pin_1,
94
- 0 , 0 , 0 , (unsigned char *)phasesMatrix2, 2 , 4 );
94
+ 0 , 0 , 0 , 2 , (unsigned char *)phasesMatrix2, 4 );
95
95
}
96
96
97
97
/*
@@ -103,7 +103,7 @@ Stepper::Stepper(unsigned number_of_steps, int motor_pin_0, int motor_pin_1,
103
103
{
104
104
initMotor (number_of_steps, motor_pin_0, motor_pin_1,
105
105
motor_pin_2, motor_pin_3,
106
- 0 , (unsigned char *)phasesMatrix4, 4 , 4 );
106
+ 0 , 4 , (unsigned char *)phasesMatrix4, 4 );
107
107
}
108
108
109
109
/*
@@ -116,7 +116,61 @@ Stepper::Stepper(unsigned number_of_steps, int motor_pin_0, int motor_pin_1,
116
116
{
117
117
initMotor (number_of_steps, motor_pin_0, motor_pin_1,
118
118
motor_pin_2, motor_pin_3,
119
- motor_pin_4, (unsigned char *)phasesMatrix5, 5 , 10 );
119
+ motor_pin_4, 5 , (unsigned char *)phasesMatrix5, 10 );
120
+ }
121
+
122
+ /*
123
+ * universal constructor for motors with only one wire
124
+ * Sets which wires should control the motor, pointer to the phases matrix, number of pins and phases.
125
+ */
126
+ Stepper::Stepper (unsigned number_of_steps, int motor_pin_0,
127
+ int pin_count, unsigned char *phasesMatrix, int phase_count)
128
+ {
129
+ initMotor (number_of_steps, motor_pin_0, 0 ,
130
+ 0 , 0 ,
131
+ 0 , pin_count,
132
+ phasesMatrix,phase_count);
133
+ }
134
+
135
+ /*
136
+ * universal constructor for motors with maximum two wires
137
+ * Sets which wires should control the motor, pointer to the phases matrix, number of pins and phases.
138
+ */
139
+ Stepper::Stepper (unsigned number_of_steps, int motor_pin_0, int motor_pin_1,
140
+ int pin_count, unsigned char *phasesMatrix, int phase_count)
141
+ {
142
+ initMotor (number_of_steps, motor_pin_0, motor_pin_1,
143
+ 0 , 0 ,
144
+ 0 , pin_count,
145
+ phasesMatrix,phase_count);
146
+ }
147
+
148
+ /*
149
+ * universal constructor for motors with maximum three wires
150
+ * Sets which wires should control the motor, pointer to the phases matrix, number of pins and phases.
151
+ */
152
+ Stepper::Stepper (unsigned number_of_steps, int motor_pin_0, int motor_pin_1,
153
+ int motor_pin_2, int pin_count,
154
+ unsigned char *phasesMatrix, int phase_count)
155
+ {
156
+ initMotor (number_of_steps, motor_pin_0, motor_pin_1,
157
+ motor_pin_2, 0 ,
158
+ 0 , pin_count,
159
+ phasesMatrix,phase_count);
160
+ }
161
+
162
+ /*
163
+ * universal constructor for motors with maximum four wires
164
+ * Sets which wires should control the motor, pointer to the phases matrix, number of pins and phases.
165
+ */
166
+ Stepper::Stepper (unsigned number_of_steps, int motor_pin_0, int motor_pin_1,
167
+ int motor_pin_2, int motor_pin_3, int pin_count,
168
+ unsigned char *phasesMatrix, int phase_count)
169
+ {
170
+ initMotor (number_of_steps, motor_pin_0, motor_pin_1,
171
+ motor_pin_2, motor_pin_3,
172
+ 0 , pin_count,
173
+ phasesMatrix,phase_count);
120
174
}
121
175
122
176
/*
@@ -125,13 +179,13 @@ Stepper::Stepper(unsigned number_of_steps, int motor_pin_0, int motor_pin_1,
125
179
*/
126
180
Stepper::Stepper (unsigned number_of_steps, int motor_pin_0, int motor_pin_1,
127
181
int motor_pin_2, int motor_pin_3,
128
- int motor_pin_4, unsigned char *phasesMatrix ,
129
- int pin_count, int phase_count)
182
+ int motor_pin_4, int pin_count ,
183
+ unsigned char *phasesMatrix, int phase_count)
130
184
{
131
185
initMotor (number_of_steps, motor_pin_0, motor_pin_1,
132
186
motor_pin_2, motor_pin_3,
133
- motor_pin_4, phasesMatrix ,
134
- pin_count, phase_count);
187
+ motor_pin_4, pin_count ,
188
+ phasesMatrix, phase_count);
135
189
}
136
190
137
191
/*
@@ -200,8 +254,8 @@ void Stepper::stepMotor(unsigned char thisPhase)
200
254
*/
201
255
void Stepper::initMotor (unsigned number_of_steps, unsigned char motor_pin_0, unsigned char motor_pin_1,
202
256
unsigned char motor_pin_2, unsigned char motor_pin_3,
203
- unsigned char motor_pin_4, unsigned char *phasesMatrix ,
204
- unsigned char pin_count, unsigned char phase_count)
257
+ unsigned char motor_pin_4, unsigned char pin_count ,
258
+ unsigned char *phasesMatrix, unsigned char phase_count)
205
259
{
206
260
this ->step_number = 0 ; // which step the motor is on
207
261
this ->number_of_steps = number_of_steps; // total number of steps for this motor
0 commit comments