Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: USBDevice mbed-rtos mbed
Fork of JoyStick by
AutoScale.h
00001 #ifndef AUTOSCALE_H 00002 #define AUTOSCALE_H 00003 00004 #include "mbed.h" 00005 #include "AnalogFilterInterface.h" 00006 00007 /** 00008 Auto scale a analog input to it's desired min/max values 00009 This is handy of you connect a potentiometer to a analog input where you cannot make the full values, but 00010 your flight simulator expects full values 00011 **/ 00012 class AutoScale : public AnalogFilterInterface 00013 { 00014 private: 00015 const long _expectedMax; 00016 const long _expectedMin; 00017 long _currentMax; 00018 long _currentMin; 00019 long _current; 00020 double _a; 00021 double _b; 00022 double _mul; 00023 public: 00024 AutoScale(AnalogFilterInterface *chain,long expectedMin, long expectedMax); 00025 AutoScale(AnalogFilterInterface *chain,long expectedMin, long expectedMax, double multiplier); 00026 ~AutoScale(); 00027 00028 virtual void setData(long data); 00029 virtual long getData() const; 00030 private: 00031 void reCalc(); 00032 }; 00033 00034 #endif
Generated on Wed Jul 13 2022 20:21:10 by
1.7.2
