A fork of AR8000
Dependents: Sumo_v2 Sumo_v2_Unstable Sumo_v2_RG13
AR8000.h
- Committer:
- BlazeX
- Date:
- 2012-04-14
- Revision:
- 2:5bb207fd97c5
- Parent:
- 1:a5bfae540999
- Child:
- 6:ce4f088d8111
File content as of revision 2:5bb207fd97c5:
#pragma once //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 < 2200)\ 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: //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 TrimL; //-1...+1 Left Trim float TrimR; //-1...+1 Right Trim float TrimK; //-1...+1 Knob int ControlActive; //0=Failsafe, 1=Empfang vorhanden int State; //0, 1, 2 //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(); };