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/AnalogChannel.h b/azaleasource/WPILibCProgramming/trunk/WPILib/AnalogChannel.h
new file mode 100644
index 0000000..246315e
--- /dev/null
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/AnalogChannel.h
@@ -0,0 +1,88 @@
+/*----------------------------------------------------------------------------*/
+/* Copyright (c) FIRST 2008. 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_CHANNEL_H_
+#define ANALOG_CHANNEL_H_
+
+#include "ChipObject.h"
+#include "SensorBase.h"
+#include "PIDSource.h"
+#include "LiveWindow/LiveWindowSendable.h"
+
+class AnalogModule;
+
+/**
+ * Analog channel class.
+ *
+ * Each analog channel is read from hardware as a 12-bit number representing -10V to 10V.
+ *
+ * Connected to each analog channel is an averaging and oversampling engine. This engine accumulates
+ * the specified ( by SetAverageBits() and SetOversampleBits() ) number of samples before returning a new
+ * value. This is not a sliding window average. The only difference between the oversampled samples and
+ * the averaged samples is that the oversampled samples are simply accumulated effectively increasing the
+ * resolution, while the averaged samples are divided by the number of samples to retain the resolution,
+ * but get more stable values.
+ */
+class AnalogChannel : public SensorBase, public PIDSource, public LiveWindowSendable
+{
+public:
+ static const UINT8 kAccumulatorModuleNumber = 1;
+ static const UINT32 kAccumulatorNumChannels = 2;
+ static const UINT32 kAccumulatorChannels[kAccumulatorNumChannels];
+
+ AnalogChannel(UINT8 moduleNumber, UINT32 channel);
+ explicit AnalogChannel(UINT32 channel);
+ virtual ~AnalogChannel();
+
+ AnalogModule *GetModule();
+
+ INT16 GetValue();
+ INT32 GetAverageValue();
+
+ float GetVoltage();
+ float GetAverageVoltage();
+
+ UINT8 GetModuleNumber();
+ UINT32 GetChannel();
+
+ void SetAverageBits(UINT32 bits);
+ UINT32 GetAverageBits();
+ void SetOversampleBits(UINT32 bits);
+ UINT32 GetOversampleBits();
+
+ UINT32 GetLSBWeight();
+ INT32 GetOffset();
+
+ bool IsAccumulatorChannel();
+ void InitAccumulator();
+ void SetAccumulatorInitialValue(INT64 value);
+ void ResetAccumulator();
+ void SetAccumulatorCenter(INT32 center);
+ void SetAccumulatorDeadband(INT32 deadband);
+ INT64 GetAccumulatorValue();
+ UINT32 GetAccumulatorCount();
+ void GetAccumulatorOutput(INT64 *value, UINT32 *count);
+
+ double PIDGet();
+
+ void UpdateTable();
+ void StartLiveWindowMode();
+ void StopLiveWindowMode();
+ std::string GetSmartDashboardType();
+ void InitTable(ITable *subTable);
+ ITable * GetTable();
+
+private:
+ void InitChannel(UINT8 moduleNumber, UINT32 channel);
+ UINT32 m_channel;
+ AnalogModule *m_module;
+ tAccumulator *m_accumulator;
+ INT64 m_accumulatorOffset;
+
+ ITable *m_table;
+};
+
+#endif