-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWPIObjMgr.cpp
More file actions
61 lines (55 loc) · 1.24 KB
/
WPIObjMgr.cpp
File metadata and controls
61 lines (55 loc) · 1.24 KB
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
#include "WPIObjMgr.h"
#include "Config.h"
namespace Spyder
{
Joystick* GetJoystick(UINT32 port)
{
static Joystick* s_joysticks[] = {0, 0, 0, 0};
if(!s_joysticks[port])
{
s_joysticks[port] = new Joystick(port);
}
return s_joysticks[port];
}
Relay* GetRelay(UINT32 channel)
{
static std::map<UINT32, Relay*> s_relays;
if(!s_relays[channel])
{
s_relays[channel] = new Relay(1, channel, Relay::kBothDirections);
}
return s_relays[channel];
}
Victor* GetVictor(UINT32 channel)
{
static std::map<UINT32, Victor*> s_victors;
if(!s_victors[channel])
{
s_victors[channel] = new Victor(1, channel);
}
return s_victors[channel];
}
Encoder* GetEncoder(UINT32 aChannel, UINT32 bChannel, bool inverse)
{
static std::map<UINT32, Encoder*> s_encoders;
if(!s_encoders[aChannel])
{
s_encoders[aChannel] = new Encoder(aChannel, bChannel, inverse);
}
return s_encoders[aChannel];
}
double GetDeadzone()
{
static ConfigVar<double> deadzone("controller_deadzone", 0.15);
return deadzone.GetVal();
}
Solenoid* GetSolenoid(UINT32 channel)
{
static std::map<UINT32, Solenoid*> s_solenoids;
if(!s_solenoids[channel])
{
s_solenoids[channel] = new Solenoid(channel);
}
return s_solenoids[channel];
}
}