This is the latest WPILib src, VisionSample2013, cRIO image, ... pulled down from firstforge.wpi.edu.

There might be risks in using the top of tree rather than an official release, but the commit messages do mention fixes for some deadlocks and race conditions.

git-svn-id: https://robotics.mvla.net/svn/frc971/2013/trunk/src@4066 f308d9b7-e957-4cde-b6ac-9a88185e7312
diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/AnalogIOButton.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/AnalogIOButton.cpp
new file mode 100644
index 0000000..b4b09ee
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/AnalogIOButton.cpp
@@ -0,0 +1,20 @@
+/*----------------------------------------------------------------------------*/

+/* Copyright (c) FIRST 2011. All Rights Reserved.							  */

+/* Open Source Software - may be modified and shared by FRC teams. The code   */

+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */

+/*----------------------------------------------------------------------------*/

+

+#include "Buttons/AnalogIOButton.h"

+#include "DriverStation.h"

+

+const double AnalogIOButton::kThreshold = 0.5;

+

+AnalogIOButton::AnalogIOButton(int port) :

+	m_port(port)

+{

+}

+

+bool AnalogIOButton::Get()

+{

+	return DriverStation::GetInstance()->GetEnhancedIO().GetAnalogIn(m_port) < kThreshold;

+}

diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/AnalogIOButton.h b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/AnalogIOButton.h
new file mode 100644
index 0000000..5261479
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/AnalogIOButton.h
@@ -0,0 +1,26 @@
+/*----------------------------------------------------------------------------*/

+/* Copyright (c) FIRST 2011. All Rights Reserved.							  */

+/* Open Source Software - may be modified and shared by FRC teams. The code   */

+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */

+/*----------------------------------------------------------------------------*/

+

+#ifndef __ANALOG_IO_BUTTON_H__

+#define __ANALOG_IO_BUTTON_H__

+

+#include "Buttons/Button.h"

+

+class AnalogIOButton : public Trigger

+{

+public:

+	static const double kThreshold;

+

+	AnalogIOButton(int port);

+	virtual ~AnalogIOButton() {}

+	virtual bool Get();

+

+private:

+	int m_port;

+};

+

+#endif

+

diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/Button.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/Button.cpp
new file mode 100644
index 0000000..fb361d4
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/Button.cpp
@@ -0,0 +1,34 @@
+/*----------------------------------------------------------------------------*/

+/* Copyright (c) FIRST 2011. All Rights Reserved.							  */

+/* Open Source Software - may be modified and shared by FRC teams. The code   */

+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */

+/*----------------------------------------------------------------------------*/

+

+#include "Button.h"

+

+/**

+ * Specifies the command to run when a button is first pressed

+ * @param command The pointer to the command to run

+ */

+void Button::WhenPressed(Command *command) {

+	WhenActive(command);

+}

+

+/**

+ * Specifies the command to be scheduled while the button is pressed

+ * The command will be scheduled repeatedly while the button is pressed and will

+ * be canceled when the button is released.

+ * @param command The pointer to the command to run

+ */

+void Button::WhileHeld(Command *command) {

+	WhileActive(command);

+}

+

+/**

+ * Specifies the command to run when the button is released

+ * The command will be scheduled a single time.

+ * @param The pointer to the command to run

+ */

+void Button::WhenReleased(Command *command) {

+	WhenInactive(command);

+}

diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/Button.h b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/Button.h
new file mode 100644
index 0000000..7ea6799
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/Button.h
@@ -0,0 +1,33 @@
+/*----------------------------------------------------------------------------*/

+/* Copyright (c) FIRST 2011. All Rights Reserved.							  */

+/* Open Source Software - may be modified and shared by FRC teams. The code   */

+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */

+/*----------------------------------------------------------------------------*/

+

+#ifndef __BUTTON_H__

+#define __BUTTON_H__

+

+#include "Buttons/Trigger.h"

+#include "Commands/Command.h"

+

+/**

+ * This class provides an easy way to link commands to OI inputs.

+ *

+ * It is very easy to link a button to a command.  For instance, you could

+ * link the trigger button of a joystick to a "score" command.

+ *

+ * This class represents a subclass of Trigger that is specifically aimed at

+ * buttons on an operator interface as a common use case of the more generalized

+ * Trigger objects. This is a simple wrapper around Trigger with the method names

+ * renamed to fit the Button object use.

+ * 

+ * @author brad

+ */

+class Button : public Trigger {

+public:

+	virtual void WhenPressed(Command *command);

+	virtual void WhileHeld(Command *command);

+	virtual void WhenReleased(Command *command);

+};

+

+#endif

diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/ButtonScheduler.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/ButtonScheduler.cpp
new file mode 100644
index 0000000..8f23312
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/ButtonScheduler.cpp
@@ -0,0 +1,21 @@
+/*----------------------------------------------------------------------------*/

+/* Copyright (c) FIRST 2011. All Rights Reserved.							  */

+/* Open Source Software - may be modified and shared by FRC teams. The code   */

+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */

+/*----------------------------------------------------------------------------*/

+

+#include "Buttons/ButtonScheduler.h"

+

+#include "Commands/Scheduler.h"

+

+ButtonScheduler::ButtonScheduler(bool last, Trigger *button, Command *orders) :

+	m_pressedLast(last),

+	m_button(button),

+	m_command(orders)

+{

+}

+

+void ButtonScheduler::Start()

+{

+	Scheduler::GetInstance()->AddButton(this);

+}

diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/ButtonScheduler.h b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/ButtonScheduler.h
new file mode 100644
index 0000000..5e243aa
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/ButtonScheduler.h
@@ -0,0 +1,27 @@
+/*----------------------------------------------------------------------------*/

+/* Copyright (c) FIRST 2011. All Rights Reserved.							  */

+/* Open Source Software - may be modified and shared by FRC teams. The code   */

+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */

+/*----------------------------------------------------------------------------*/

+

+#ifndef __BUTTON_SCHEDULER_H__

+#define __BUTTON_SCHEDULER_H__

+

+class Trigger;

+class Command;

+

+class ButtonScheduler

+{

+public:

+	ButtonScheduler(bool last, Trigger *button, Command *orders);

+	virtual ~ButtonScheduler() {}

+	virtual void Execute() = 0;

+	void Start();

+

+protected:

+	bool m_pressedLast;

+	Trigger *m_button;

+	Command *m_command;

+};

+

+#endif

diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/DigitalIOButton.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/DigitalIOButton.cpp
new file mode 100644
index 0000000..0933ac2
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/DigitalIOButton.cpp
@@ -0,0 +1,20 @@
+/*----------------------------------------------------------------------------*/

+/* Copyright (c) FIRST 2011. All Rights Reserved.							  */

+/* Open Source Software - may be modified and shared by FRC teams. The code   */

+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */

+/*----------------------------------------------------------------------------*/

+

+#include "Buttons/DigitalIOButton.h"

+#include "DriverStation.h"

+

+const bool DigitalIOButton::kActiveState = false;

+

+DigitalIOButton::DigitalIOButton(int port) :

+	m_port(port)

+{

+}

+

+bool DigitalIOButton::Get()

+{

+	return DriverStation::GetInstance()->GetEnhancedIO().GetDigital(m_port) == kActiveState;

+}

diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/DigitalIOButton.h b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/DigitalIOButton.h
new file mode 100644
index 0000000..3682471
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/DigitalIOButton.h
@@ -0,0 +1,26 @@
+/*----------------------------------------------------------------------------*/

+/* Copyright (c) FIRST 2011. All Rights Reserved.							  */

+/* Open Source Software - may be modified and shared by FRC teams. The code   */

+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */

+/*----------------------------------------------------------------------------*/

+

+#ifndef __DIGITAL_IO_BUTTON_H__

+#define __DIGITAL_IO_BUTTON_H__

+

+#include "Buttons/Button.h"

+

+class DigitalIOButton: public Button

+{

+public:

+	static const bool kActiveState;

+

+	DigitalIOButton(int port);

+	virtual ~DigitalIOButton() {}

+

+	virtual bool Get();

+

+private:

+	int m_port;

+};

+

+#endif

diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/HeldButtonScheduler.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/HeldButtonScheduler.cpp
new file mode 100644
index 0000000..d1addd5
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/HeldButtonScheduler.cpp
@@ -0,0 +1,32 @@
+/*----------------------------------------------------------------------------*/

+/* Copyright (c) FIRST 2011. All Rights Reserved.							  */

+/* Open Source Software - may be modified and shared by FRC teams. The code   */

+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */

+/*----------------------------------------------------------------------------*/

+

+#include "Buttons/HeldButtonScheduler.h"

+

+#include "Buttons/Button.h"

+#include "Commands/Command.h"

+

+HeldButtonScheduler::HeldButtonScheduler(bool last, Trigger *button, Command *orders) :

+	ButtonScheduler(last, button, orders)

+{

+}

+

+void HeldButtonScheduler::Execute()

+{

+	if (m_button->Grab())

+	{

+		m_pressedLast = true;

+		m_command->Start();

+	}

+	else

+	{

+		if (m_pressedLast)

+		{

+			m_pressedLast = false;

+			m_command->Cancel();

+		}

+	}

+}

diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/HeldButtonScheduler.h b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/HeldButtonScheduler.h
new file mode 100644
index 0000000..e37880e
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/HeldButtonScheduler.h
@@ -0,0 +1,23 @@
+/*----------------------------------------------------------------------------*/

+/* Copyright (c) FIRST 2011. All Rights Reserved.							  */

+/* Open Source Software - may be modified and shared by FRC teams. The code   */

+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */

+/*----------------------------------------------------------------------------*/

+

+#ifndef __HELD_BUTTON_SCHEDULER_H__

+#define __HELD_BUTTON_SCHEDULER_H__

+

+#include "Buttons/ButtonScheduler.h"

+

+class Trigger;

+class Command;

+

+class HeldButtonScheduler : public ButtonScheduler

+{

+public:

+	HeldButtonScheduler(bool last, Trigger *button, Command *orders);

+	virtual ~HeldButtonScheduler() {}

+	virtual void Execute();

+};

+

+#endif

diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/InternalButton.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/InternalButton.cpp
new file mode 100644
index 0000000..c4ab06a
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/InternalButton.cpp
@@ -0,0 +1,34 @@
+/*----------------------------------------------------------------------------*/

+/* Copyright (c) FIRST 2011. All Rights Reserved.							  */

+/* Open Source Software - may be modified and shared by FRC teams. The code   */

+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */

+/*----------------------------------------------------------------------------*/

+

+#include "Buttons/InternalButton.h"

+

+InternalButton::InternalButton() :

+	m_pressed(false),

+	m_inverted(false)

+{

+}

+

+InternalButton::InternalButton(bool inverted) :

+	m_pressed(inverted),

+	m_inverted(inverted)

+{

+}

+

+void InternalButton::SetInverted(bool inverted)

+{

+	m_inverted = inverted;

+}

+

+void InternalButton::SetPressed(bool pressed)

+{

+	m_pressed = pressed;

+}

+

+bool InternalButton::Get()

+{

+	return m_pressed ^ m_inverted;

+}

diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/InternalButton.h b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/InternalButton.h
new file mode 100644
index 0000000..68d78fa
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/InternalButton.h
@@ -0,0 +1,29 @@
+/*----------------------------------------------------------------------------*/

+/* Copyright (c) FIRST 2011. All Rights Reserved.							  */

+/* Open Source Software - may be modified and shared by FRC teams. The code   */

+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */

+/*----------------------------------------------------------------------------*/

+

+#ifndef __INTERNAL_BUTTON_H__

+#define __INTERNAL_BUTTON_H__

+

+#include "Buttons/Button.h"

+

+class InternalButton : public Button

+{

+public:

+	InternalButton();

+	InternalButton(bool inverted);

+	virtual ~InternalButton() {}

+

+	void SetInverted(bool inverted);

+	void SetPressed(bool pressed);

+

+	virtual bool Get();

+

+private:

+	bool m_pressed;

+	bool m_inverted;

+};

+

+#endif

diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/JoystickButton.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/JoystickButton.cpp
new file mode 100644
index 0000000..cfe096d
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/JoystickButton.cpp
@@ -0,0 +1,18 @@
+/*----------------------------------------------------------------------------*/

+/* Copyright (c) FIRST 2011. All Rights Reserved.							  */

+/* Open Source Software - may be modified and shared by FRC teams. The code   */

+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */

+/*----------------------------------------------------------------------------*/

+

+#include "Buttons/JoystickButton.h"

+

+JoystickButton::JoystickButton(GenericHID *joystick, int buttonNumber) :

+	m_joystick(joystick),

+	m_buttonNumber(buttonNumber)

+{

+}

+

+bool JoystickButton::Get()

+{

+    return m_joystick->GetRawButton(m_buttonNumber);

+}

diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/JoystickButton.h b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/JoystickButton.h
new file mode 100644
index 0000000..24f3480
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/JoystickButton.h
@@ -0,0 +1,26 @@
+/*----------------------------------------------------------------------------*/

+/* Copyright (c) FIRST 2011. All Rights Reserved.							  */

+/* Open Source Software - may be modified and shared by FRC teams. The code   */

+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */

+/*----------------------------------------------------------------------------*/

+

+#ifndef __JOYSTICK_BUTTON_H__

+#define __JOYSTICK_BUTTON_H__

+

+#include "GenericHID.h"

+#include "Buttons/Button.h"

+

+class JoystickButton : public Button

+{

+public:

+	JoystickButton(GenericHID *joystick, int buttonNumber);

+	virtual ~JoystickButton() {}

+

+	virtual bool Get();

+

+private:

+	GenericHID *m_joystick;

+	int m_buttonNumber;

+};

+

+#endif

diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/NetworkButton.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/NetworkButton.cpp
new file mode 100644
index 0000000..065965e
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/NetworkButton.cpp
@@ -0,0 +1,29 @@
+/*----------------------------------------------------------------------------*/

+/* Copyright (c) FIRST 2011. All Rights Reserved.							  */

+/* Open Source Software - may be modified and shared by FRC teams. The code   */

+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */

+/*----------------------------------------------------------------------------*/

+

+#include "Buttons/NetworkButton.h"

+#include "networktables/NetworkTable.h"

+

+NetworkButton::NetworkButton(const char *tableName, const char *field) ://TODO how is this supposed to work???

+	m_netTable(NetworkTable::GetTable(tableName)),

+	m_field(field)

+{

+}

+

+NetworkButton::NetworkButton(ITable *table, const char *field) :

+	m_netTable(table),

+	m_field(field)

+{

+}

+

+bool NetworkButton::Get()

+{

+	/*if (m_netTable->isConnected())

+		return m_netTable->GetBoolean(m_field.c_str());

+	else

+		return false;*/

+	return m_netTable->GetBoolean(m_field);

+}

diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/NetworkButton.h b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/NetworkButton.h
new file mode 100644
index 0000000..bdfdd9d
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/NetworkButton.h
@@ -0,0 +1,28 @@
+/*----------------------------------------------------------------------------*/

+/* Copyright (c) FIRST 2011. All Rights Reserved.							  */

+/* Open Source Software - may be modified and shared by FRC teams. The code   */

+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */

+/*----------------------------------------------------------------------------*/

+

+#ifndef __NETWORK_BUTTON_H__

+#define __NETWORK_BUTTON_H__

+

+#include "Buttons/Button.h"

+#include <string>

+

+class NetworkButton : public Button

+{

+public:

+	NetworkButton(const char *tableName, const char *field);

+	NetworkButton(ITable* table, const char *field);

+	virtual ~NetworkButton() {}

+

+	virtual bool Get();

+

+private:

+	ITable* m_netTable;

+	std::string m_field;

+

+};

+

+#endif

diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/PressedButtonScheduler.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/PressedButtonScheduler.cpp
new file mode 100644
index 0000000..29be444
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/PressedButtonScheduler.cpp
@@ -0,0 +1,31 @@
+/*----------------------------------------------------------------------------*/

+/* Copyright (c) FIRST 2011. All Rights Reserved.							  */

+/* Open Source Software - may be modified and shared by FRC teams. The code   */

+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */

+/*----------------------------------------------------------------------------*/

+

+#include "Buttons/PressedButtonScheduler.h"

+

+#include "Buttons/Button.h"

+#include "Commands/Command.h"

+

+PressedButtonScheduler::PressedButtonScheduler(bool last, Trigger *button, Command *orders) :

+	ButtonScheduler(last, button, orders)

+{

+}

+

+void PressedButtonScheduler::Execute()

+{

+	if (m_button->Grab())

+	{

+		if (!m_pressedLast)

+		{

+			m_pressedLast = true;

+			m_command->Start();

+		}

+	}

+	else

+	{

+		m_pressedLast = false;

+	}

+}

diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/PressedButtonScheduler.h b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/PressedButtonScheduler.h
new file mode 100644
index 0000000..98fb987
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/PressedButtonScheduler.h
@@ -0,0 +1,23 @@
+/*----------------------------------------------------------------------------*/

+/* Copyright (c) FIRST 2011. All Rights Reserved.							  */

+/* Open Source Software - may be modified and shared by FRC teams. The code   */

+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */

+/*----------------------------------------------------------------------------*/

+

+#ifndef __PRESSED_BUTTON_SCHEDULER_H__

+#define __PRESSED_BUTTON_SCHEDULER_H__

+

+#include "Buttons/ButtonScheduler.h"

+

+class Trigger;

+class Command;

+

+class PressedButtonScheduler : public ButtonScheduler

+{

+public:

+	PressedButtonScheduler(bool last, Trigger *button, Command *orders);

+	virtual ~PressedButtonScheduler() {}

+	virtual void Execute();

+};

+

+#endif

diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/ReleasedButtonScheduler.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/ReleasedButtonScheduler.cpp
new file mode 100644
index 0000000..5d9e87f
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/ReleasedButtonScheduler.cpp
@@ -0,0 +1,31 @@
+/*----------------------------------------------------------------------------*/

+/* Copyright (c) FIRST 2011. All Rights Reserved.							  */

+/* Open Source Software - may be modified and shared by FRC teams. The code   */

+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */

+/*----------------------------------------------------------------------------*/

+

+#include "Buttons/ReleasedButtonScheduler.h"

+

+#include "Buttons/Button.h"

+#include "Commands/Command.h"

+

+ReleasedButtonScheduler::ReleasedButtonScheduler(bool last, Trigger *button, Command *orders) :

+	ButtonScheduler(last, button, orders)

+{

+}

+

+void ReleasedButtonScheduler::Execute()

+{

+	if (m_button->Grab())

+	{

+		m_pressedLast = true;

+	}

+	else

+	{

+		if (m_pressedLast)

+		{

+			m_pressedLast = false;

+			m_command->Start();

+		}

+	}

+}

diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/ReleasedButtonScheduler.h b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/ReleasedButtonScheduler.h
new file mode 100644
index 0000000..942682d
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/ReleasedButtonScheduler.h
@@ -0,0 +1,23 @@
+/*----------------------------------------------------------------------------*/

+/* Copyright (c) FIRST 2011. All Rights Reserved.							  */

+/* Open Source Software - may be modified and shared by FRC teams. The code   */

+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */

+/*----------------------------------------------------------------------------*/

+

+#ifndef __RELEASED_BUTTON_SCHEDULER_H__

+#define __RELEASED_BUTTON_SCHEDULER_H__

+

+#include "Buttons/ButtonScheduler.h"

+

+class Trigger;

+class Command;

+

+class ReleasedButtonScheduler : public ButtonScheduler

+{

+public:

+	ReleasedButtonScheduler(bool last, Trigger *button, Command *orders);

+	virtual ~ReleasedButtonScheduler() {}

+	virtual void Execute();

+};

+

+#endif

diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/Trigger.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/Trigger.cpp
new file mode 100644
index 0000000..054f273
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/Trigger.cpp
@@ -0,0 +1,65 @@
+/*----------------------------------------------------------------------------*/

+/* Copyright (c) FIRST 2011. All Rights Reserved.							  */

+/* Open Source Software - may be modified and shared by FRC teams. The code   */

+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */

+/*----------------------------------------------------------------------------*/

+

+#include "Buttons/Button.h"

+

+#include "Buttons/HeldButtonScheduler.h"

+#include "Buttons/PressedButtonScheduler.h"

+#include "Buttons/ReleasedButtonScheduler.h"

+

+Trigger::Trigger() {

+	m_table = NULL;

+}

+

+bool Trigger::Grab()

+{

+	if (Get())

+		return true;

+	else if (m_table != NULL)

+	{

+		//if (m_table->isConnected())//TODO is connected on button?

+			return m_table->GetBoolean("pressed");

+		/*else

+			return false;*/

+	}

+	else

+		return false;

+}

+

+void Trigger::WhenActive(Command *command)

+{

+	PressedButtonScheduler *pbs = new PressedButtonScheduler(Grab(), this, command);

+	pbs->Start();

+}

+

+void Trigger::WhileActive(Command *command)

+{

+	HeldButtonScheduler *hbs = new HeldButtonScheduler(Grab(), this, command);

+	hbs->Start();

+}

+

+void Trigger::WhenInactive(Command *command)

+{

+	ReleasedButtonScheduler *rbs = new ReleasedButtonScheduler(Grab(), this, command);

+	rbs->Start();

+}

+

+

+

+std::string Trigger::GetSmartDashboardType(){

+	return "Button";

+}

+

+void Trigger::InitTable(ITable* table){

+	m_table = table;

+	if(m_table!=NULL){

+		m_table->PutBoolean("pressed", Get());

+	}

+}

+

+ITable* Trigger::GetTable(){

+	return m_table;

+}

diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/Trigger.h b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/Trigger.h
new file mode 100644
index 0000000..dc40e9e
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Buttons/Trigger.h
@@ -0,0 +1,47 @@
+/*----------------------------------------------------------------------------*/

+/* Copyright (c) FIRST 2011. All Rights Reserved.							  */

+/* Open Source Software - may be modified and shared by FRC teams. The code   */

+/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */

+/*----------------------------------------------------------------------------*/

+

+#ifndef __TRIGGER_H__

+#define __TRIGGER_H__

+

+#include "SmartDashboard/Sendable.h"

+

+class Command;

+

+/**

+ * This class provides an easy way to link commands to inputs.

+ *

+ * It is very easy to link a polled input to a command.  For instance, you could

+ * link the trigger button of a joystick to a "score" command or an encoder reaching

+ * a particular value.

+ *

+ * It is encouraged that teams write a subclass of Trigger if they want to have

+ * something unusual (for instance, if they want to react to the user holding

+ * a button while the robot is reading a certain sensor input).  For this, they

+ * only have to write the {@link Trigger#Get()} method to get the full functionality

+ * of the Trigger class.

+ *

+ * @author Brad Miller, Joe Grinstead

+ */

+class Trigger : public Sendable

+{

+public:

+	Trigger();

+	virtual ~Trigger() {}

+	bool Grab();

+	virtual bool Get() = 0;

+	void WhenActive(Command *command);

+	void WhileActive(Command *command);

+	void WhenInactive(Command *command);

+	

+	virtual void InitTable(ITable* table);

+	virtual ITable* GetTable();

+	virtual std::string GetSmartDashboardType();

+protected:

+	ITable* m_table;

+};

+

+#endif