-
Notifications
You must be signed in to change notification settings - Fork 1
/
manipulator.h
79 lines (70 loc) · 1.51 KB
/
manipulator.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
67
68
69
70
71
72
73
74
75
76
77
78
79
/**
* @file manipulator.h
* @author Timarrr (tigrmango@gmail.com)
* @brief Controls the manipulator
* @version 0.1
* @date 2023-03-31
*
* @copyright Copyright (c) 2023
*
*/
#ifndef MANIPULATOR_H
#define MANIPULATOR_H
#include "SparkFun_PCA9536_Arduino_Library.h"
#include "config.h"
#include <Arduino.h>
/**
* @brief Class responsible for controlling the manipulator
*
*/
class Manipulator {
public:
/**
* @brief Construct a new Manipulator object
*
* @param launch Should this subsystem actually launch?
* @param test Do we need to test the subsystem?
*/
Manipulator(bool launch, bool test);
/**
* @brief Open/close the manipulator
*
* @param delta >0 - open, <0 - close
*/
void setOpenClose(int delta);
// @param delta +1 - CW, -1 - CCW
/**
* @brief Rotate the manipulator
*
* @param delta
*/
void setRotate(int delta);
private:
/**
* @brief PCA interfacing helper
*
* @param ch Channel
* @param power Power
*/
inline void writePCA(int ch, int power);
/**
* @brief PCA interfacing helper
*
* @param ch1 First channel
* @param ch2 Second channel
* @param power Power
*/
inline void set(int ch1, int ch2, int power);
/**
* @brief PCA9536 object
*
*/
PCA9536 *m_pca;
/**
* @brief if there's some errors in init then this variable is set to true
* and manipulator is disabled
*
*/
bool defunct = false;
};
#endif