AR-610 Receiver

Dependents:   DAQuadrocopter

Committer:
lordofthestorm12
Date:
Wed Mar 06 17:26:54 2019 +0000
Revision:
0:7450fa6b4ac5
Receiver

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lordofthestorm12 0:7450fa6b4ac5 1 /*
lordofthestorm12 0:7450fa6b4ac5 2 // --- DA Tschuchnik Danner --- Library für den AR-610 von Spektrum ---
lordofthestorm12 0:7450fa6b4ac5 3 // Throttle [1100us bis 1900us]
lordofthestorm12 0:7450fa6b4ac5 4 // Aile, Elev & Rudd [1200us bis 1800us]
lordofthestorm12 0:7450fa6b4ac5 5 // Coding by JuyN::GumM
lordofthestorm12 0:7450fa6b4ac5 6 */
lordofthestorm12 0:7450fa6b4ac5 7 // --------------
lordofthestorm12 0:7450fa6b4ac5 8
lordofthestorm12 0:7450fa6b4ac5 9 #ifndef AR610_LIB_H
lordofthestorm12 0:7450fa6b4ac5 10 #define AR610_LIB_H
lordofthestorm12 0:7450fa6b4ac5 11
lordofthestorm12 0:7450fa6b4ac5 12 #include "mbed.h"
lordofthestorm12 0:7450fa6b4ac5 13
lordofthestorm12 0:7450fa6b4ac5 14 #define CORVALRECIVER 1000000
lordofthestorm12 0:7450fa6b4ac5 15
lordofthestorm12 0:7450fa6b4ac5 16 // --------------
lordofthestorm12 0:7450fa6b4ac5 17
lordofthestorm12 0:7450fa6b4ac5 18 class Receiver_obj{
lordofthestorm12 0:7450fa6b4ac5 19
lordofthestorm12 0:7450fa6b4ac5 20 public:
lordofthestorm12 0:7450fa6b4ac5 21
lordofthestorm12 0:7450fa6b4ac5 22 // * Konstrukt für den AR-610, übergabe als Interruptet-Pin für die Flankenerfassung des PPW-Signals...
lordofthestorm12 0:7450fa6b4ac5 23 Receiver_obj(PinName InterruptPin);
lordofthestorm12 0:7450fa6b4ac5 24 // * Erstellung des Dekonstruktors, grüundsätzlich nicht notwendig...
lordofthestorm12 0:7450fa6b4ac5 25 // ~Receiver_obj();
lordofthestorm12 0:7450fa6b4ac5 26
lordofthestorm12 0:7450fa6b4ac5 27 // * RETURN des korrigierten Wertes (um Faktor 10^6[ Kor von Float auf Int])...
lordofthestorm12 0:7450fa6b4ac5 28 double CurVal();
lordofthestorm12 0:7450fa6b4ac5 29
lordofthestorm12 0:7450fa6b4ac5 30 // * Startet den Timer wenn ein Interrupt am initialisierten Pin auftritt[steigende Flanke]...
lordofthestorm12 0:7450fa6b4ac5 31 void STARTTIMER();
lordofthestorm12 0:7450fa6b4ac5 32
lordofthestorm12 0:7450fa6b4ac5 33 // * Stoppt den Timer bei einer aufgetrettenen, fallenden Flanke und speichert diesen Wert in die Variable _CurrentPulseWidth_us...
lordofthestorm12 0:7450fa6b4ac5 34 void STOPTIMER();
lordofthestorm12 0:7450fa6b4ac5 35
lordofthestorm12 0:7450fa6b4ac5 36 // * Deklarierung des Pin's und des Timers...
lordofthestorm12 0:7450fa6b4ac5 37 private:
lordofthestorm12 0:7450fa6b4ac5 38 InterruptIn _interruptin;
lordofthestorm12 0:7450fa6b4ac5 39 Timer t_Runtime;
lordofthestorm12 0:7450fa6b4ac5 40
lordofthestorm12 0:7450fa6b4ac5 41 // * Deklarierung der Variablen...
lordofthestorm12 0:7450fa6b4ac5 42 protected:
lordofthestorm12 0:7450fa6b4ac5 43 double _CurrentPulseWidth_us;
lordofthestorm12 0:7450fa6b4ac5 44
lordofthestorm12 0:7450fa6b4ac5 45 };
lordofthestorm12 0:7450fa6b4ac5 46
lordofthestorm12 0:7450fa6b4ac5 47 // --------------
lordofthestorm12 0:7450fa6b4ac5 48
lordofthestorm12 0:7450fa6b4ac5 49
lordofthestorm12 0:7450fa6b4ac5 50 #endif