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.

Committer:
rvt
Date:
Wed Jun 22 12:50:16 2016 +0000
Revision:
5:a0bb17c379ce
Parent:
4:2cc58c173de8
Latest

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rvt 4:2cc58c173de8 1 #ifndef BUTTON_H
rvt 4:2cc58c173de8 2 #define BUTTON_H
rvt 4:2cc58c173de8 3
rvt 4:2cc58c173de8 4 #include "mbed.h"
rvt 4:2cc58c173de8 5
rvt 4:2cc58c173de8 6 class Button {
rvt 4:2cc58c173de8 7 private:
rvt 4:2cc58c173de8 8 DigitalIn *_digitalIn;
rvt 4:2cc58c173de8 9 bool _lastValue;
rvt 4:2cc58c173de8 10 bool _value;
rvt 5:a0bb17c379ce 11 const bool _reversed;
rvt 4:2cc58c173de8 12 public:
rvt 4:2cc58c173de8 13 /**
rvt 4:2cc58c173de8 14 filter : Failter chain
rvt 4:2cc58c173de8 15 pin : Analog input to read
rvt 4:2cc58c173de8 16 */
rvt 4:2cc58c173de8 17 Button(PinName pin, bool reversed, bool pullUp);
rvt 4:2cc58c173de8 18 ~Button();
rvt 4:2cc58c173de8 19
rvt 4:2cc58c173de8 20 void measure();
rvt 5:a0bb17c379ce 21 bool getData() const;
rvt 4:2cc58c173de8 22 bool getIsChanged();
rvt 4:2cc58c173de8 23
rvt 4:2cc58c173de8 24 };
rvt 4:2cc58c173de8 25
rvt 4:2cc58c173de8 26 #endif