-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmotors.h
46 lines (35 loc) · 975 Bytes
/
motors.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
#ifndef MOTORS_H
#define MOTORS_H
#define PIN_MTR_LEFT_1 PIN_MOTOR1_1
#define PIN_MTR_LEFT_2 PIN_MOTOR1_2
#define PIN_MTR_RIGHT_1 PIN_MOTOR2_1
#define PIN_MTR_RIGHT_2 PIN_MOTOR2_2
const uint8_t mtrPins[] = {PIN_MOTOR1_1, PIN_MOTOR1_2, PIN_MOTOR2_1, PIN_MOTOR2_2};
struct Motor {
Motor(uint8_t p1, uint8_t p2) : pin1(p1), pin2(p2) {};
uint8_t pin1, pin2;
};
const Motor leftMotor(PIN_MTR_LEFT_1, PIN_MTR_LEFT_2);
const Motor rightMotor(PIN_MTR_RIGHT_1, PIN_MTR_RIGHT_2);
enum DecayMode { // internal value corresponds to the fixed pin level
FastDecay = 0,
SlowDecay = 1
};
#define CoastMode FastDecay
#define BreakMode SlowDecay
enum MotorDirection {
Forward = 0,
Backward = 1
};
void MotorPwmDrive(Motor mtr, DecayMode decay, MotorDirection dir, uint8_t power);
/*enum MtrMenuItem {
Forward,
Backward,
Forward_Backward
};
MtrMenuItem getMtr_MenuItem();
void mtrMenu_StepDown();
void mtrMenu_StepUp();
void showMtrMenu();
*/
#endif /* MOTORS_H */