A fork of AR8000
Dependents: Sumo_v2 Sumo_v2_Unstable Sumo_v2_RG13
Diff: AR8000.h
- Revision:
- 10:0c22ced44247
- Parent:
- 9:c57888a66a5f
--- a/AR8000.h Fri Apr 20 11:02:25 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -#pragma once - -#define AR8000_CONNECTORS_MIRRORED - -//Interrupt-Callback Vorlage -#define AR8000_RISE_FALL(Ch)\ -void Rise##Ch()\ -{\ - LastRise[Ch]= Time.read_us();\ -}\ -void Fall##Ch()\ -{\ - int dT= Time.read_us() - LastRise[Ch];\ - if(dT > 900 && dT < 2100)\ - dTime[Ch]= dT;\ -} - - -class AR8000 -{ -private: - InterruptIn ChInt0; //Interrupt-Handler fuer jeden Pin - InterruptIn ChInt1; - InterruptIn ChInt2; - InterruptIn ChInt3; - InterruptIn ChInt4; - InterruptIn ChInt5; - InterruptIn ChInt6; - InterruptIn ChInt7; - - Timer Time; //Timer for all 8 Channels - volatile int LastRise[8]; //Zeitpunkt der letzten steigende Flanke - volatile int dTime[8]; //Pulsdauer in us [1000...2000] - -public: - int RawChannels[8]; //Rohdaten [1000...2000] - - //Die Steuerbefehle - float Throttle; //0=Aus, 1=Vollgas - float Aileron; //-1=Links, 0=Nichts, +1=Rechts - float Elevator; //-1=Sinken, 0=Nichts, +1=Steigen - float Rudder; //-1=Links, 0=Nichts, +1=Rechts - - float Aux1; //-1...+1 Left Trim - float Aux2; //-1...+1 Right Trim - float Aux3; //-1...+1 Knob - - int State1; //0, 1 Gear - int State2; //0, 1, 2 F-Mode - - - //Initialisieren - AR8000(); - void Init(); - - //Interrupt-Callbacks definieren - AR8000_RISE_FALL(0); - AR8000_RISE_FALL(1); - AR8000_RISE_FALL(2); - AR8000_RISE_FALL(3); - AR8000_RISE_FALL(4); - AR8000_RISE_FALL(5); - AR8000_RISE_FALL(6); - AR8000_RISE_FALL(7); - - //Update-Methode - void Update(); -}; \ No newline at end of file