MotorController
coding_wheels.h
Go to the documentation of this file.
1 /** @file */
2 
3 #ifndef CODING_WHEELS_H
4 #define CODING_WHEELS_H
5 
6 #include "hal.h"
7 
8 /**
9  * @brief Possible values for coding wheels orientation.
10  */
11 typedef enum {
12  DIRECT = 0U, /**< Direct orientation */
13  INDIRECT = 1U /**< Indirect orientation */
15 
16 /**
17  * @brief Configuration structure for coding wheels.
18  *
19  * @remark The `orientation` parameters allow the user to specify which rotation direction
20  * corresponds to a forward movement of the robot.
21  */
22 typedef struct {
23  int32_t initial_right_ticks; /**< Initial value of the right coding wheel counter */
24  wheel_orientation_t right_wheel_orientation; /**< Orientation of the right coding wheel */
25  int32_t initial_left_ticks; /**< Initial value of the left coding wheel counter */
26  wheel_orientation_t left_wheel_orientation; /**< Orientation of the left coding wheel */
28 
29 /*
30  * Number of ticks counted by the right coding wheel.
31  */
32 extern volatile int32_t right_ticks;
33 
34 /*
35  * Number of ticks counted by the left coding wheel.
36  */
37 extern volatile int32_t left_ticks;
38 
39 /**
40  * @brief Perform all the initializations required by the coding wheels.
41  *
42  * @param[in] config The initial configuration of the coding wheels driver.
43  * For common use, initial_left_ticks and initial_right_ticks should
44  * be set to 0.
45  * @remark Behaviour is undefined for now if initial ticks aren't 0.
46  */
47 extern void init_coding_wheels(coding_wheels_config_t config);
48 
49 #endif /* CODING_WHEELS_H */
Configuration structure for coding wheels.
Definition: coding_wheels.h:22
wheel_orientation_t right_wheel_orientation
Definition: coding_wheels.h:24
void init_coding_wheels(coding_wheels_config_t config)
Perform all the initializations required by the coding wheels.
Definition: coding_wheels.c:53
wheel_orientation_t
Possible values for coding wheels orientation.
Definition: coding_wheels.h:11
wheel_orientation_t left_wheel_orientation
Definition: coding_wheels.h:26