|
@@ -79,10 +79,15 @@ namespace upm {
|
79
|
79
|
STEPPER_NUM_STEPS = 0x1c
|
80
|
80
|
} REG_T;
|
81
|
81
|
|
82
|
|
- // legal directions
|
83
|
|
- typedef enum { DIR_CCW = 0x0a,
|
84
|
|
- DIR_CW = 0x05
|
85
|
|
- } DIRECTION_T;
|
|
82
|
+ // legal directions for the stepper
|
|
83
|
+ typedef enum { STEP_DIR_CCW = 0x0a,
|
|
84
|
+ STEP_DIR_CW = 0x05
|
|
85
|
+ } STEP_DIRECTION_T;
|
|
86
|
+
|
|
87
|
+ // legal directions for individual DC motors
|
|
88
|
+ typedef enum { DIR_CCW = 0x02,
|
|
89
|
+ DIR_CW = 0x01
|
|
90
|
+ } DC_DIRECTION_T;
|
86
|
91
|
|
87
|
92
|
/**
|
88
|
93
|
* grovemd constructor
|
|
@@ -130,22 +135,23 @@ namespace upm {
|
130
|
135
|
bool setPWMFrequencyPrescale(uint8_t freq=0x03);
|
131
|
136
|
|
132
|
137
|
/**
|
133
|
|
- * For controlling DC motors, set the direction
|
|
138
|
+ * For controlling DC motors, set the directions of motors A & B
|
134
|
139
|
*
|
135
|
|
- * @param dir direction, CW or CCW
|
|
140
|
+ * @param dirA direction for motor A, DIR_CW or DIR_CCW
|
|
141
|
+ * @param dirB direction for motor B, DIR_CW or DIR_CCW
|
136
|
142
|
* @return true if command successful
|
137
|
143
|
*/
|
138
|
|
- bool setDirection(DIRECTION_T dir);
|
|
144
|
+ bool setMotorDirections(DC_DIRECTION_T dirA, DC_DIRECTION_T dirB);
|
139
|
145
|
|
140
|
146
|
/**
|
141
|
147
|
* For controlling a stepper motor, set a direction, speed and
|
142
|
148
|
* then enable.
|
143
|
149
|
*
|
144
|
|
- * @param dir direction, CW or CCW
|
|
150
|
+ * @param dir direction, STEP_DIR_CW or STEP_DIR_CCW
|
145
|
151
|
* @param speed motor speed. Valid range is 1-255, higher is slower.
|
146
|
152
|
* @return true if command successful
|
147
|
153
|
*/
|
148
|
|
- bool enableStepper(DIRECTION_T dir, uint8_t speed);
|
|
154
|
+ bool enableStepper(STEP_DIRECTION_T dir, uint8_t speed);
|
149
|
155
|
|
150
|
156
|
/**
|
151
|
157
|
* For controlling a stepper motor, stop the stepper motor.
|