Matthias Grob
/
FlyBed2
My fully self designed first stable working Quadrocopter Software.
Embed:
(wiki syntax)
Show/hide line numbers
RC_Channel.h
00001 #ifndef RC_CHANNEL_H 00002 #define RC_CHANNEL_H 00003 00004 #include "mbed.h" 00005 00006 class RC_Channel 00007 { 00008 public: 00009 RC_Channel(PinName mypin, int index); // NO p19/p20!!!!, they don't support InterruptIn 00010 int read(); // read the last measured data 00011 00012 private: 00013 int index; // to know which channel of the RC an instance has (only for calibrations savings) 00014 int time; // last measurement data 00015 float scale; // calibration values 00016 float offset; 00017 00018 InterruptIn myinterrupt; // interrupt on the pin to react when signal falls or rises 00019 void rise(); // start the time measurement when signal rises 00020 void fall(); // stop the time mesurement and save the value when signal falls 00021 Timer timer; // timer to measure the up time of the signal and if the signal timed out 00022 00023 Ticker timeoutchecker; // Ticker to see if signal broke down 00024 void timeoutcheck(); // to check for timeout, checked every second 00025 00026 // Calibration value saving 00027 void saveCalibrationValue(float * value, char * fileextension); 00028 void loadCalibrationValue(float * value, char * fileextension); 00029 }; 00030 00031 #endif
Generated on Thu Jul 14 2022 18:09:09 by 1.7.2