small(ish) fixes to DriverStation
diff --git a/aos/externals/WPILib/WPILib/DriverStation.cpp b/aos/externals/WPILib/WPILib/DriverStation.cpp
index 938f40d..9c2cb91 100644
--- a/aos/externals/WPILib/WPILib/DriverStation.cpp
+++ b/aos/externals/WPILib/WPILib/DriverStation.cpp
@@ -19,7 +19,6 @@
const UINT32 DriverStation::kBatteryChannel;
const UINT32 DriverStation::kJoystickPorts;
const UINT32 DriverStation::kJoystickAxes;
-const float DriverStation::kUpdatePeriod;
DriverStation* DriverStation::m_instance = NULL;
ReentrantSemaphore DriverStation::m_instanceSemaphore;
UINT8 DriverStation::m_updateNumber = 0;
@@ -73,6 +72,7 @@
DriverStation::~DriverStation()
{
+ Synchronized sync(m_instanceSemaphore);
m_task.Stop();
semDelete(m_statusDataSemaphore);
delete m_batteryChannel;
diff --git a/aos/externals/WPILib/WPILib/DriverStation.h b/aos/externals/WPILib/WPILib/DriverStation.h
index 9a5fe3f..1fcf1e8 100644
--- a/aos/externals/WPILib/WPILib/DriverStation.h
+++ b/aos/externals/WPILib/WPILib/DriverStation.h
@@ -13,6 +13,7 @@
#include "Task.h"
#include "Synchronized.h"
#include "RWLock.h"
+#include "Base.h"
struct FRCCommonControlData;
class AnalogChannel;
@@ -43,6 +44,17 @@
static const UINT32 kJoystickPorts = 4;
static const UINT32 kJoystickAxes = 6;
+ /**
+ * Returns the pointer to all of the data. This pointer will never change, but
+ * its contents will, so make sure to GetDataReadLock() if you want to make
+ * sure that it doesn't change while you're using it.
+ *
+ * You may NOT modify the contents!
+ */
+ const volatile struct FRCCommonControlData *GetControlData() {
+ return m_controlData;
+ }
+
float GetStickAxis(UINT32 stick, UINT32 axis);
short GetStickButtons(UINT32 stick);
@@ -128,13 +140,11 @@
void SetData();
private:
- static void InitTask(DriverStation *ds);
static DriverStation *m_instance;
static ReentrantSemaphore m_instanceSemaphore;
static UINT8 m_updateNumber;
- ///< TODO: Get rid of this and use the semaphore signaling
- static const float kUpdatePeriod = 0.02;
+ static void InitTask(DriverStation *ds);
void Run();
// Volatile because it gets modified by GetData() in a separate task. Be
@@ -173,6 +183,8 @@
bool m_userInAutonomous;
bool m_userInTeleop;
bool m_userInTest;
+
+ DISALLOW_COPY_AND_ASSIGN(DriverStation);
};
#endif