root / branches / simulator / projects / simulator / libsim / motors.c @ 1074
History | View | Annotate | Download (577 Bytes)
1 | 942 | bcoltin | #include "motor.h" |
---|---|---|---|
2 | #include "util.h" |
||
3 | 995 | dsschult | #include <robot_shared.h> |
4 | 906 | bcoltin | |
5 | 995 | dsschult | extern RobotShared* shared_state;
|
6 | 990 | dsschult | |
7 | 906 | bcoltin | void motors_init(void) |
8 | { |
||
9 | 990 | dsschult | /* not needed in simulator */
|
10 | 906 | bcoltin | } |
11 | |||
12 | void motor1_set(int direction, int speed) |
||
13 | { |
||
14 | 995 | dsschult | if (direction == FORWARD)
|
15 | 990 | dsschult | shared_state->motor1 = speed; |
16 | else if (direction == BACKWARD) |
||
17 | 995 | dsschult | shared_state->motor1 = -1*speed;
|
18 | 906 | bcoltin | } |
19 | |||
20 | void motor2_set(int direction, int speed) |
||
21 | { |
||
22 | 995 | dsschult | if (direction == FORWARD)
|
23 | 990 | dsschult | shared_state->motor2 = speed; |
24 | else if (direction == BACKWARD) |
||
25 | 995 | dsschult | shared_state->motor2 = -1*speed;
|
26 | 906 | bcoltin | } |
27 | |||
28 | void motors_off(void) |
||
29 | { |
||
30 | 990 | dsschult | /* not needed in simulator */
|
31 | 906 | bcoltin | } |