Project

General

Profile

Statistics
| Revision:

root / branches / simulator / projects / simulator / libsim / motors.c @ 1047

History | View | Annotate | Download (577 Bytes)

1
#include "motor.h"
2
#include "util.h"
3
#include <robot_shared.h>
4

    
5
extern RobotShared* shared_state;
6

    
7
void motors_init(void)
8
{
9
  /* not needed in simulator */
10
}
11

    
12
void motor1_set(int direction, int speed)
13
{
14
  if (direction == FORWARD)
15
    shared_state->motor1 = speed;
16
  else if (direction == BACKWARD)
17
    shared_state->motor1 = -1*speed;
18
}
19

    
20
void motor2_set(int direction, int speed)
21
{
22
        if (direction == FORWARD)
23
    shared_state->motor2 = speed;
24
  else if (direction == BACKWARD)
25
    shared_state->motor2 = -1*speed;
26
}
27

    
28
void motors_off(void)
29
{
30
  /* not needed in simulator */
31
}
32