Successful acro and level mode now! Relying on MPU9250 as base sensor. I'm working continuously on tuning and features :) NEWEST VERSION ON: https://github.com/MaEtUgR/FlyBed (CODE 100% compatible/copyable)

Dependencies:   mbed

Committer:
maetugr
Date:
Tue Sep 08 13:38:10 2015 +0000
Revision:
0:37f0c1e8fa66
MPU9250 on the new Board works fine over SPI; RC is broken and works with FlyBed2 :(

Who changed what in which revision?

UserRevisionLine numberNew contents of line
maetugr 0:37f0c1e8fa66 1 #ifndef RC_CHANNEL_H
maetugr 0:37f0c1e8fa66 2 #define RC_CHANNEL_H
maetugr 0:37f0c1e8fa66 3
maetugr 0:37f0c1e8fa66 4 #include "mbed.h"
maetugr 0:37f0c1e8fa66 5
maetugr 0:37f0c1e8fa66 6 class RC_Channel
maetugr 0:37f0c1e8fa66 7 {
maetugr 0:37f0c1e8fa66 8 public:
maetugr 0:37f0c1e8fa66 9 RC_Channel(PinName mypin, int index); // NO p19/p20!!!!, they don't support InterruptIn
maetugr 0:37f0c1e8fa66 10 int read(); // read the last measured data
maetugr 0:37f0c1e8fa66 11
maetugr 0:37f0c1e8fa66 12 private:
maetugr 0:37f0c1e8fa66 13 int index; // to know which channel of the RC an instance has (only for calibrations savings)
maetugr 0:37f0c1e8fa66 14 int time; // last measurement data
maetugr 0:37f0c1e8fa66 15 float scale; // calibration values
maetugr 0:37f0c1e8fa66 16 float offset;
maetugr 0:37f0c1e8fa66 17
maetugr 0:37f0c1e8fa66 18 InterruptIn myinterrupt; // interrupt on the pin to react when signal falls or rises
maetugr 0:37f0c1e8fa66 19 void rise(); // start the time measurement when signal rises
maetugr 0:37f0c1e8fa66 20 void fall(); // stop the time mesurement and save the value when signal falls
maetugr 0:37f0c1e8fa66 21 Timer timer; // timer to measure the up time of the signal and if the signal timed out
maetugr 0:37f0c1e8fa66 22
maetugr 0:37f0c1e8fa66 23 Ticker timeoutchecker; // Ticker to see if signal broke down
maetugr 0:37f0c1e8fa66 24 void timeoutcheck(); // to check for timeout, checked every second
maetugr 0:37f0c1e8fa66 25
maetugr 0:37f0c1e8fa66 26 // Calibration value saving
maetugr 0:37f0c1e8fa66 27 void saveCalibrationValue(float * value, char * fileextension);
maetugr 0:37f0c1e8fa66 28 void loadCalibrationValue(float * value, char * fileextension);
maetugr 0:37f0c1e8fa66 29 };
maetugr 0:37f0c1e8fa66 30
maetugr 0:37f0c1e8fa66 31 #endif