-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRobotCCompatibility.h
157 lines (122 loc) · 3.53 KB
/
RobotCCompatibility.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/*
Copyright 2018 Ben Schattinger
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#if !defined(INC_2017VEXIQRINGMASTER_ROBOTC_H) && !defined(ROBOTC)
#define INC_2017VEXIQRINGMASTER_ROBOTC_H
#include <cstdint>
#include <string>
#define task int
//Control
extern void delay(int d);
//Math
extern float abs(const float input);
extern float acos(const float Cosine);
extern float asin(const float Sine);
extern float atan(const float Tangent);
extern float atan2(const float y, const float x);
extern float atof(std::string str);
extern long atoi(std::string str);
extern float ceil(const float input);
extern float cos(const float fRadians);
extern float cosDegrees(const float fDegrees);
extern float degreesToRadians(const float fDegrees);
extern float exp(const float input);
extern float floor(const float input);
extern float log(const float input);
extern float log10(const float input);
extern const float PI;
extern float pow(const float base, const float exponent);
extern short radiansToDegrees(const float fRadians);
extern long randLong();
extern short sgn(const float input);
extern float sin(const float fRadians);
extern float sinDegrees(const float fDegrees);
extern void srand(const long nSeedValue);
extern float sqrt(const float input);
extern int abs(int in);
//Ports
enum tMotor {
port1,
port2,
port3,
port4,
port5,
port6,
port7,
port8,
port9,
port10,
port11,
port12
};
//Remote Control
enum TVexJoysticks {
ChA, ChB, ChC, Chd, BtnEUp, BtnEDown, BtnFUp, BtnFDown, BtnLUp, BtnLDown, BtnRUp, BtnRDown
};
extern short getJoystickValue(TVexJoysticks t);
//Display
extern void displayTextLine(const int nLineNumber, std::string sFormatString, ...);
extern void displayCenteredTextLine(const int nLineNumber, std::string sFormatString, ...);
//Debug
#define writeDebugStream printf
#define writeDebugStreamLine(format, ...) printf(format "\n", __VA_ARGS__)
template <typename T>
extern void datalogAddValue(int datalog, T data);
//Motors
extern void setMotorSpeed(tMotor port, int speed);
extern int getMotorEncoder(tMotor port);
extern void resetMotorEncoder(tMotor port);
extern void setMotorTarget(tMotor port, float target, int speed);
extern int getMotorSpeed(tMotor port);
//Sensors
enum colorSensorModes {
colorTypeUninitialized,
colorTypeGrayscale_Ambient,
colorTypeGrayscale_Reflected,
colorTypeRGB_12Colors_Ambient,
colorTypeRGB_12Colors_Reflected,
colorTypeRGB_Hue_Ambient,
colorTypeRGB_Hue_Reflected,
colorTypeRGB_Raw_Ambient,
colorTypeRGB_Raw_Reflected
};
enum colors{
colorNone,
colorRedViolet,
colorRed,
colorDarkOrange,
colorOrange,
colorDarkYellow,
colorYellow,
colorLimeGreen,
colorGreen,
colorBlueGreen,
colorBlue,
colorDarkBlue,
colorViolet
};
extern colors getColorName(tMotor port);
extern int getColorValue(tMotor port);
extern int getColorProximity(tMotor port);
extern void setColorMode(tMotor port, colorSensorModes mode);
//Tasks
extern void startTask(int());
//Timers
enum timers{
T1,
T2,
T3,
T4
};
extern void clearTimer(timers timer);
int time1[4];
#endif //INC_2017VEXIQRINGMASTER_ROBOTC_H