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.

AnalogFilterInterface.h

Committer:
rvt
Date:
2016-06-22
Revision:
5:a0bb17c379ce
Parent:
1:5b2ab44eb31f

File content as of revision 5:a0bb17c379ce:

#ifndef ANALOGFILTERINTERFACE_H
#define ANALOGFILTERINTERFACE_H

/**
    Analog filter Interface 
    This is the base class if you want to create your own filters and beable to chain them within analog inputs.
*/
class AnalogFilterInterface
{
    private:
        AnalogFilterInterface *_chain;
        long _data;
    public:
        AnalogFilterInterface(AnalogFilterInterface *chain);
        AnalogFilterInterface();
    
        // Set a datapoint
        virtual void setData(long data);

        // Get the filtered datapoint
        virtual long getData() const;
        
        // Get the chained filter
        virtual AnalogFilterInterface * getChain(){return _chain;};
};

#endif