-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmotors.h
66 lines (51 loc) · 1.51 KB
/
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef MOTORS_H
#define MOTORS_H
#include <stdint.h>
#include <hal.h>
#define MOTOR_SPEED_LIMIT 1100 // [step/s]
/**
* @brief Sets the speed of the left motor
*
* @param speed speed desired in step/s
*/
void left_motor_set_speed(int speed);
/**
* @brief Sets the speed of the right motor
*
* @param speed speed desired in step/s
*/
void right_motor_set_speed(int speed);
/**
* @brief Reads the position counter of the left motor
*
* @return position counter of the left motor in step
*/
int32_t left_motor_get_pos(void);
/**
* @brief Reads the position counter of the right motor
*
* @return position counter of the right motor in step
*/
int32_t right_motor_get_pos(void);
/**
* @brief sets the position counter of the left motor to the given value
*
* @param counter_value value to store in the position counter of the motor in step
*/
void left_motor_set_pos(int32_t counter_value);
/**
* @brief sets the position counter of the right motor to the given value
*
* @param counter_value value to store in the position counter of the motor in step
*/
void right_motor_set_pos(int32_t counter_value);
/**
* @brief Initializes the control of the motors.
*/
void motors_init(void);
//move certain numbers of steps
void left_motor_set_speed_step(int speed, int32_t limit_counter_value);
void right_motor_set_speed_step(int speed, int32_t limit_counter_value);
uint8_t get_ongoing_state (void);
void motors_set_ongoing(uint8_t _ongoing);
#endif /* MOTOR_H */