HID Joystick - For use with X-Plane or other programs that can read HID JoySticks

Dependencies:   USBDevice mbed-rtos mbed

Fork of JoyStick by Ries Twisk

This is a simple Joystick HID that I use for xplane and a home build yoke + paddels, see this forum with the look and feel of it : http://forums.x-plane.org/index.php?showtopic=70041

The analog input are filtered with a LowPass IIR filter and the digital input's will be derived from the analog input and de-bounced.

The analog values are read at a 1Khz interval and to ensure we don't push the USB stack to much at a maximum rate of 20 updates/sec HID data is send over USB only if any values where changed. The JoyStick will send 16Bit analog values as opposite of 8 bit values that are normally used to increase accuracy of the whole system. This is well noticeable within x-plane!

The JoyStick uses the JoyStick copied from Wim Huiskamp and modified to suite my needs and the MBED RTOS libraries for reading analog inputs, sending debug data over USB and sending HID data, 3 threads in total.

Revision:
5:a0bb17c379ce
Parent:
2:ae7a31a3c618
--- a/AnalogInFiltered.h	Thu Mar 10 14:05:02 2016 +0000
+++ b/AnalogInFiltered.h	Wed Jun 22 12:50:16 2016 +0000
@@ -7,12 +7,12 @@
 /**
 Analog input, this reads a analog value from a PIN and send the data through the filterchain
 */
-class AnalogInFiltered {
+class AnalogInFiltered : public AnalogFilterInterface {
     private:
         AnalogIn *_ain;
+        const int _fuzzyFactor;
+        AnalogFilterInterface   *_filter;
         long   _lastValue;
-        int _fuzzyFactor;
-        AnalogFilterInterface   *_filter;
     public:   
         /**
         filter : Failter chain
@@ -22,11 +22,8 @@
         ~AnalogInFiltered();
         
         // Read a value from analog in
-        void measure ();
-        
-        
-        long getData();
-        
+        virtual void setData(long data);
+        virtual long getData() const;
         
         // Test if the input value is changed based on a offset
         bool getIsChanged();