-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautonswitch.c
95 lines (81 loc) · 2.61 KB
/
autonswitch.c
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
#include "main.h"
#define MIN_AUTON_MODE 1
/*******************************************************************************
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
NOTICE:
This file has moved to our main repository. We had too many issues dealing
with the submodule linking this project to our main one. You can find the new
and up-to-date version of this file at the following URL:
> https://github.com/EastRobotics/2616E/blob/master/In%20The%20Zone/src/2616E_lib/autonswitch.c
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*******************************************************************************/
unsigned char maxAutonMode;
unsigned char autonMode = MIN_AUTON_MODE;
bool position = false; // False for left, true for right
bool color = false; // False for red, true for blue
void autonInit(unsigned char _maxAutonMode) { maxAutonMode = _maxAutonMode; }
/*
** Sets the current autonomous mode to the supplied value
**
** PARAMETERS:
** int: The mode to set autonomous to
**
** RETURNS:
** bool: Whether or not the set number was a valid number
*/
bool setAutonMode(unsigned char _autonMode) {
if ((_autonMode >= MIN_AUTON_MODE) &&
(_autonMode <= maxAutonMode)) { // If valid input
autonMode = _autonMode;
}
return false;
}
/*
** Returns the current autonomous mode
**
** RETURNS:
** int: The current autonomous mode
*/
unsigned char getAutonMode() { return autonMode; }
/*
** Returns the minimum autonomous mode
**
** RETURNS:
** int: The minimum autonomous mode (Always 1)
*/
unsigned char getAutonModeMin() { return MIN_AUTON_MODE; }
/*
** Returns the maximum autonomous mode
**
** RETURNS:
** int: The current autonomous mode
*/
unsigned char getAutonModeMax() { return maxAutonMode; }
/*
** Sets the current autonomous position. False for left, true for right.
**
** PARAMETERS:
** bool: The autonomous position. False for left, true for right.
*/
void setAutonPosition(bool setPosition) { position = setPosition; }
/*
** Gets the current autonomous position. False for left, true for right.
**
** RETURNS:
** bool: The autonomous position. False for left, true for right.
*/
bool getAutonPosition() { return position; }
/*
** Sets the current autonomous color. False for blue, true for red.
**
** PARAMETERS:
** bool: The autonomous color. False for blue, true for red.
*/
void setAutonColor(bool setColor) { color = setColor; }
/*
** Gets the current autonomous color. False for blue, true for red.
**
** RETURNS:
** bool: The autonomous color. False for blue, true for red.
*/
bool getAutonColor() { return color; }