RobotCore
1.0
WPILib port to raspberry Pi
Toggle main menu visibility
Loading...
Searching...
No Matches
DriverStation.java
1
// Copyright (c) FIRST and other WPILib contributors.
2
// Open Source Software; you can modify and/or share it under the terms of
3
// the WPILib BSD license file in the root directory of this project.
4
5
package
org.wpilib.driverstation;
6
7
import
java.util.concurrent.locks.Lock;
8
import
java.util.concurrent.locks.ReentrantLock;
9
import
org.wpilib.datalog.DataLog;
10
import
org.wpilib.driverstation.internal.DriverStationBackend;
11
13
public
final
class
DriverStation {
14
private
DriverStation() {}
15
16
private
static
final
Lock m_dsLock =
new
ReentrantLock();
17
private
static
final
GenericHID
[] m_hids =
new
GenericHID
[
DriverStationBackend
.
JOYSTICK_PORTS
];
18
private
static
final
Gamepad
[] m_gamepads =
new
Gamepad
[
DriverStationBackend
.
JOYSTICK_PORTS
];
19
20
private
static
GenericHID
getGenericHIDUnderLock(
int
port) {
21
GenericHID
toRet = m_hids[port];
22
if
(toRet ==
null
) {
23
toRet =
new
GenericHID
(port);
24
m_hids[port] = toRet;
25
}
26
return
toRet;
27
}
28
36
public
static
GenericHID
getGenericHID
(
int
port) {
37
m_dsLock.lock();
38
try
{
39
return
getGenericHIDUnderLock(port);
40
}
finally
{
41
m_dsLock.unlock();
42
}
43
}
44
52
public
static
Gamepad
getGamepad
(
int
port) {
53
m_dsLock.lock();
54
try
{
55
Gamepad
toRet = m_gamepads[port];
56
if
(toRet ==
null
) {
57
toRet =
new
Gamepad
(getGenericHIDUnderLock(port));
58
m_gamepads[port] = toRet;
59
}
60
return
toRet;
61
}
finally
{
62
m_dsLock.unlock();
63
}
64
}
65
72
public
static
void
startDataLog
(
DataLog
log) {
73
DriverStationBackend
.
startDataLog
(log);
74
}
75
82
public
static
void
startDataLog
(
DataLog
log,
boolean
logJoysticks) {
83
DriverStationBackend
.
startDataLog
(log, logJoysticks);
84
}
85
91
public
static
void
provideRefreshedDataEventHandle
(
int
handle) {
92
DriverStationBackend
.
provideRefreshedDataEventHandle
(handle);
93
}
94
100
public
static
void
removeRefreshedDataEventHandle
(
int
handle) {
101
DriverStationBackend
.
removeRefreshedDataEventHandle
(handle);
102
}
103
}
org.wpilib.datalog.DataLog
Definition
DataLog.java:30
org.wpilib.driverstation.DriverStation.provideRefreshedDataEventHandle
static void provideRefreshedDataEventHandle(int handle)
Definition
DriverStation.java:91
org.wpilib.driverstation.DriverStation.startDataLog
static void startDataLog(DataLog log)
Definition
DriverStation.java:72
org.wpilib.driverstation.DriverStation.removeRefreshedDataEventHandle
static void removeRefreshedDataEventHandle(int handle)
Definition
DriverStation.java:100
org.wpilib.driverstation.DriverStation.getGenericHID
static GenericHID getGenericHID(int port)
Definition
DriverStation.java:36
org.wpilib.driverstation.DriverStation.getGamepad
static Gamepad getGamepad(int port)
Definition
DriverStation.java:52
org.wpilib.driverstation.DriverStation.startDataLog
static void startDataLog(DataLog log, boolean logJoysticks)
Definition
DriverStation.java:82
org.wpilib.driverstation.Gamepad
Definition
Gamepad.java:27
org.wpilib.driverstation.Gamepad.Gamepad
Gamepad(final int port)
Definition
Gamepad.java:177
org.wpilib.driverstation.GenericHID
Definition
GenericHID.java:23
org.wpilib.driverstation.internal.DriverStationBackend
Definition
DriverStationBackend.java:50
org.wpilib.driverstation.internal.DriverStationBackend.removeRefreshedDataEventHandle
static void removeRefreshedDataEventHandle(int handle)
Definition
DriverStationBackend.java:2172
org.wpilib.driverstation.internal.DriverStationBackend.provideRefreshedDataEventHandle
static void provideRefreshedDataEventHandle(int handle)
Definition
DriverStationBackend.java:2163
org.wpilib.driverstation.internal.DriverStationBackend.JOYSTICK_PORTS
static final int JOYSTICK_PORTS
Definition
DriverStationBackend.java:52
org.wpilib.driverstation.internal.DriverStationBackend.startDataLog
static void startDataLog(DataLog log, boolean logJoysticks)
Definition
DriverStationBackend.java:2255
org
wpilib
driverstation
DriverStation.java
Generated by
1.18.0