A fork of AR8000
Dependents: Sumo_v2 Sumo_v2_Unstable Sumo_v2_RG13
Diff: AR8000.cpp
- Revision:
- 10:0c22ced44247
- Parent:
- 9:c57888a66a5f
--- a/AR8000.cpp Fri Apr 20 11:02:25 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -#include "mbed.h" -#include "AR8000.h" - - -//Initialisieren -AR8000::AR8000() : -#ifdef AR8000_CONNECTORS_MIRRORED - ChInt0(InterruptIn(p17)), - ChInt1(InterruptIn(p16)), - ChInt2(InterruptIn(p12)), - ChInt3(InterruptIn(p11)), - ChInt4(InterruptIn(p8)), - ChInt5(InterruptIn(p7)), - ChInt6(InterruptIn(p6)), - ChInt7(InterruptIn(p5)) -#else - ChInt0(InterruptIn(p5)), - ChInt1(InterruptIn(p6)), - ChInt2(InterruptIn(p7)), - ChInt3(InterruptIn(p8)), - ChInt4(InterruptIn(p11)), - ChInt5(InterruptIn(p12)), - ChInt6(InterruptIn(p16)), - ChInt7(InterruptIn(p17)) -#endif -{} - -void AR8000::Init() -{ - Time.start(); - - for(int i= 0; i < 8; i++) - { - LastRise[i]= 0; - dTime[i]= 1000; - } - - ChInt0.mode(PullDown); ChInt0.rise<AR8000>(this, &AR8000::Rise0); ChInt0.fall<AR8000>(this, &AR8000::Fall0); - ChInt1.mode(PullDown); ChInt1.rise<AR8000>(this, &AR8000::Rise1); ChInt1.fall<AR8000>(this, &AR8000::Fall1); - ChInt2.mode(PullDown); ChInt2.rise<AR8000>(this, &AR8000::Rise2); ChInt2.fall<AR8000>(this, &AR8000::Fall2); - ChInt3.mode(PullDown); ChInt3.rise<AR8000>(this, &AR8000::Rise3); ChInt3.fall<AR8000>(this, &AR8000::Fall3); - ChInt4.mode(PullDown); ChInt4.rise<AR8000>(this, &AR8000::Rise4); ChInt4.fall<AR8000>(this, &AR8000::Fall4); - ChInt5.mode(PullDown); ChInt5.rise<AR8000>(this, &AR8000::Rise5); ChInt5.fall<AR8000>(this, &AR8000::Fall5); - ChInt6.mode(PullDown); ChInt6.rise<AR8000>(this, &AR8000::Rise6); ChInt6.fall<AR8000>(this, &AR8000::Fall6); - ChInt7.mode(PullDown); ChInt7.rise<AR8000>(this, &AR8000::Rise7); ChInt7.fall<AR8000>(this, &AR8000::Fall7); - - Update(); -} - -//Update-Methode -void AR8000::Update() -{ - //Rohdaten �hmen - for(int i= 0; i<8; i++) - RawChannels[i]= dTime[i]; - - //Steuerbefehle berechnen - Throttle= float(dTime[0]-1000) * 0.001; - Aileron= float(dTime[1]-1500) * 0.002; - Elevator= float(dTime[2]-1500) * 0.002; - Rudder= float(dTime[3]-1500) * 0.002; - - Aux1= float(dTime[6]-1500) * 0.002; - Aux2= float(dTime[7]-1500) * 0.002; - if(dTime[4] < 1500) - { - State1= 0; - Aux3= float(dTime[4]-1250) * 0.004; - } - else - { - State1= 1; - Aux3= float(dTime[4]-1750) * 0.004; - } - State2= dTime[5] < 1200 ? 0 : dTime[5] < 1700 ? 1 : 2; -} \ No newline at end of file