Project

General

Profile

Revision 1412

motor 1 and motor 2 changed to motor L and motor R

View differences:

trunk/code/projects/libdragonfly/motor.c
68 68
}
69 69

  
70 70
/**
71
 * Sets the speed and direction of motor1.
71
 * Sets the speed and direction of the left motor.
72 72
 * motors_init must be called before this function can be used.
73 73
 *
74 74
 * @param direction Either FORWARD or BACKWARD to set the direction of rotation.
75 75
 * @param speed The speed the motor will run at, in the range 0-255.
76 76
 * 
77
 * @see motor2_set, motors_init
77
 * @see motor_r_set, motors_init
78 78
 **/
79
void motor1_set(int direction, int speed) {
79
void motor_l_set(int direction, int speed) {
80 80

  
81 81
  if(direction == 0) {
82 82
    // turn off PWM first if switching directions
......
101 101
}
102 102

  
103 103
/**
104
 * Sets the speed and direction of motor2.
104
 * Sets the speed and direction of the right motor.
105 105
 * motors_init must be called before this function can be used.
106 106
 *
107 107
 * @param direction Either FORWARD or BACKWARD to set the direction of rotation.
108 108
 * @param speed The speed the motor will run at, in the range 0-255.
109 109
 *
110
 * @see motor1_set, motors_init
110
 * @see motor_l_set, motors_init
111 111
 **/
112
void motor2_set(int direction, int speed) {
112
void motor_r_set(int direction, int speed) {
113 113
  if(direction == 0) {
114 114
    //		PORTD |= 0x20;
115 115
    //		PORTD &= 0x7F;
......
134 134
}
135 135

  
136 136
/**
137
 * Sets the speed and direction of motor1.
138
 * motors_init must be called before this function can be used.
139
 *
140
 * @param direction Either FORWARD or BACKWARD to set the direction of rotation.
141
 * @param speed The speed the motor will run at, in the range 0-255.
142
 *
143
 * @see motor2_set, motors_init
144
 **/
145
void motor1_set(int direction, int speed) {
146
	motor_l_set(direction, speed);
147
}
148

  
149
/**
150
 * Sets the speed and direction of motor2.
151
 * motors_init must be called before this function can be used.
152
 *
153
 * @param direction Either FORWARD or BACKWARD to set the direction of rotation.
154
 * @param speed The speed the motor will run at, in the range 0-255.
155
 *
156
 * @see motor2_set, motors_init
157
 **/
158
void motor2_set(int direction, int speed) {
159
	motor_r_set(direction, speed);
160
}
161

  
162

  
163
/**
137 164
 * Turns off both motors.
138 165
 *
139 166
 * @see motors_init
trunk/code/projects/libdragonfly/motor.h
51 51

  
52 52
/** @brief Initialize the motors **/
53 53
void motors_init(void);
54
/** @brief Set speed and direction of motor1 **/
54
/** @brief Set speed and direction of motor1 
55
 *  @deprecated use the left motor function instead. it's more intuitive and easier to read.**/
55 56
void motor1_set(int direction, int speed);
56
/** @brief Set speed and direction of motor2 **/
57
/** @brief Set speed and direction of motor2 
58
 *  @deprecated use the right motor function instead. it's more intuitive and easier to read.**/
57 59
void motor2_set(int direction, int speed);
60
/** @brief Set speed and direction of left motor **/
61
void motor_l_set(int direction, int speed);
62
/** @brief Set speed and direction of right motor **/
63
void motor_r_set(int direction, int speed);
58 64
/** @brief Turn the motors off **/
59 65
void motors_off(void);
60 66

  

Also available in: Unified diff